Repository navigation
Tell GOA of a worker's turn in one line, with its real last message - #35
Merged
Merged
Conversation
A turn reached GOA twice, by routes that knew nothing of each other: its goa report, a tool call made before the turn ends, and its end, whose text was the transcript's last assistant message at that moment. Claude Code's transcript lags its Stop hook, so that could be an older message, even one from mid-turn. The text now comes from the agent's turn-end hook where it says it, and else from a transcript that holds the turn's end. A report made at work waits briefly for its turn's end to join it. Another turn keeps its own line, and a question or a failure is never merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
Owner
Author
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.
GOA got a worker's
goa reportline, then a "finished a turn" line with an older message, sometimes from mid-turn.Cause
Your reading was right, with one correction: the old message and the two lines are separate causes.
goaReportSeen(daemon/goa_tasks.go:400) tells at once.goa reportis a tool call made while the turn still runs, sogoaWorkerChanged(:289) tells again when the turn ends. Nothing joins them. The no-task path has the same split (daemon/goa_told.go:188,195), where the check for "that was its turn's end" only holds when both arrive in one update.goaResult(:456) took the transcript's last assistant message at that moment, with no check that the transcript had reached the turn's end.Measured on real Claude Code 2.1.318: in a turn that said INTERIM-ONE, ran a command and said FINAL-TWO, the Stop hook received
last_assistant_message: "FINAL-TWO", while its transcript had no readable rows at that moment or 1.5 seconds later. So the transcript does lag. That was one first-turn run.The session you named:
37a8b7c577f1is on the Mac. I read its recent chat through the app and it no longer shows that turn, so I couldn't confirm this on that exact case. The waiting queue only delays lines; it doesn't cause them.Case 5 of #30: not touched there. This is that fix.
Fix
last_assistant_messageis kept asSessionInfo.TurnTextand travels with session updates, so GOA on another host gets it too.Older daemons on another host send no
TurnText, and the fallback covers them.Codex's hook field isn't verified, as it isn't installed here; the fallback covers it too.A worker that ends a turn waiting on a background command: that message really is its last, so it stays, marked "may be mid-work" as before.
Tests
Report then end, end then report, transcript written late, queued while GOA is busy, two real turns, no task, a held report not lost, per-session hold. On enowxlabs:
daemonandcore/session.Not run: a real GOA with a real worker; Codex.
Merge order: this conflicts with #30 in
goaSeenandrpc_goa.go, both small: #30 moves the same lines intogoaWorkerSeen, where thegoaTurnStartedcall then belongs.Touches no
go.mod,version/orcloud/, so merging doesn't deploy the cloud.🤖 Generated with Claude Code