A failed run offers "Fix with AI": a chat session that finds the cause and proposes a fix - #71
Merged
Merged
Conversation
…e and proposes a fix A failed run said only "Workflow run failed (exit code N). See the run output." -- and did not refresh the diagram, so the error marks waited for something else to redraw it. Now the diagram is refreshed, and the notification says where it failed and what (`Run failed in x (in m › i): ValueError: …`, from the run record's error and instance path). With a chat behind the diagram it also offers "Fix with AI". Taking it starts a task in that diagram's chat: a new session in plan mode, named for where it failed, whose first message is the failure -- the node and the nested workflows it is in, the error, the end of the run's stderr (its traceback, kept as the run writes it), the run directory, and, when the product can resume runs, that the run can be resumed from the failure once fixed. Plan mode: the person asked for a diagnosis and a proposal, not for files to change under them. The panel sends the message as if typed, so it is in the transcript like any other. The path: the run driver's host gains `startChatTask`, set only for a profile with a chat; it reaches `ChatRuntime.startTask`, which posts `chat.startTask` to the panel on that diagram. Without a chat, a failed run is reported and nothing is offered. Claude-Session: https://claude.ai/code/session_015VK7fH1c4aKbexnq2QcuKU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A failed run used to say only "Workflow run failed (exit code N). See the run output.". It also did not refresh the diagram, so the error marks (#70) waited for something else to redraw it.
Now, when a run fails
Run failed in x (in m › i): ValueError: deep down. This comes from the run record's error and instance path (runner: a run's error names the failing actor by its path through nested workflows huawei-csl/wfpy#46).Fix with AI starts a task in that diagram's chat: a new session in plan mode, named for where it failed (
Fix: x (in m › i)). Its first message is the failure:appendTail, last 8 KB);cliResumeArgs), a note that the run can be resumed from the failure once fixed.Plan mode because the person asked for a diagnosis and a proposal, not for files to change under them. They switch to build to apply it. The panel sends the message as if typed, so it appears in the transcript like any other.
Wiring
startChatTask, set only when the profile has a chat.ChatRuntime.startTask, which postschat.startTaskto the panel on that diagram.Tests
run-failure.test.ts(6): where, headline, stderr tail, prompt contents, and no resume note when the run cannot be resumed.cli-run-driver-fix-with-ai.test.ts(3): a failing run with a real run record and traceback; the offer; the plan-mode task with path, traceback and resume note; no offer without a chat.chat-panel-start-task.test.ts(3): session created in mode and name, message sent once after creation, and the task dropped if creation is aborted.All workspaces pass, with neutrality 5/5 and typecheck 5/5.
https://claude.ai/code/session_015VK7fH1c4aKbexnq2QcuKU