Repository navigation
fix(chatd): journal workflow reports from recovered step chats - #259
Conversation
A step child that was mid-turn when the process restarted recovers through chat recovery and calls workflow_report while its run sits interrupted in the journal. The tool validated the value and answered "Value accepted", but no live run was waiting to scan the chat history, so the step stayed running without a value and the run stayed interrupted: the report reached nothing. workflow_report now binds to its step chat. When the run is still executing, the tool answers as before and the run's own waitStep picks the value up. Otherwise the tool writes the value to the journal step, so a resume_run_id replays it without running the child again, and a late report on a run that already ended fails with the run's status instead of accepting a value nothing will read. appendDynamicTools no longer warns about the collision between a step chat's own workflow_report definition and the server tool built from that same column: the built-in owning the name is the design, and the warning fired on every step-chat turn.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1f95fe9f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
OtherCollisionsStillWarn built its dynamic column from workflowStepTools, which defines only workflow_report, so the column never collided with the other_tool built-in and the warning the test expects never fired.
The warning names the tool in a log field, so a message-contains assertion on the tool name never matched.
|
@codex review
Please review the current head a3a9764: fix(chatd) journals workflow reports from recovered step chats (interrupted-run reports now reach the journal so resume_run_id replays them; late reports on ended runs fail clearly; the deliberate step-chat tool-name collision no longer warns). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3a9764cbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merged head
|
Part of #226.
Problem (found in UAT-256 U6b)
A workflow run that was mid-step when the coderd process restarted stays
interruptedin the journal. Chat recovery re-ran the step child's turn, the model calledworkflow_report, and the tool answered "Value accepted. The workflow has your result." But nothing read that value: the run'swaitSteploop died with the process, so the step row stayedrunningwithout a value and the run row stayedinterrupted. Autodeploy restarts the server on every merge, so this path happens in practice.Fix
workflow_reportnow binds to the step chat it serves and records the report where it will actually be read:resume_run_id): unchanged. The tool validates, answers, and the run'swaitStepreads the value from the chat history as before.status=reported, value), so the answer is true and a later resume replays the value without running the child again. The journal write is not best-effort here: a failed write answers with an error the model can retry.The journal path reuses the existing
UpdateWorkflowStepquery and its authorizer; no schema changes.Tool-name collision warning
appendDynamicToolswarned "dynamic tool name collides with built-in tool, tool_name=workflow_report" on every step-chat turn: the step chat's dynamic tools column holds chatd's own placeholder for the name, and chatd injects the real server tool built from that same column. The built-in owning the name is the design, so the deliberate collision is now silent; collisions with any other built-in still warn.Tests
TestForkWorkflowReportJournal/RecoveredStepChildJournalsItsReport: restart marks the run interrupted, a report through the step chat's tool lands in the journal, andresume_run_idcompletes the run off the journaled value without sending the child a new prompt. Fails without the fix (the resume re-runs the child instead).ReportOnEndedRunFails: a late report on a completed run errors and does not overwrite the journaled value.ReportWithoutJournalRowFails: a step child whose run row is gone gets a clear error.TestForkWorkflowReportCollision: the step chat's own collision stays silent; an unrelated collision still warns.Validation
go build ./coderd/...,go vet,gofmtclean.