Repository navigation
fix(tracing): keep initiating /goal objective as turn input when user messages arrive mid-turn - #113
Open
deepanshupal wants to merge 2 commits into
Open
deepanshupal wants to merge 2 commits into
deepanshupal wants to merge 2 commits into
Conversation
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.
Fixes #110.
Root cause
A turn started by
/goalreceives its objective as aresponse_itemuser message wrapping<codex_internal_context source="goal">, which becomesuserInputFallback. A user message sent while that turn is still running arrives asitem_completed/UserMessageand setsuserInput, andfinishTurn()prefersuserInputover the fallback - so the later in-flight message replaced the initiating goal as the root input.Behavior change (both sides)
user_messageoritem_completed/UserMessage) no longer displaces an input already captured from either channel, so a goal-started turn keeps its goal as the root input and later messages stay distinguishable instead of replacing it.<objective>text extracted from the<codex_internal_context source="goal">wrapper, rather than the raw internal wrapper.The deliberate "structured UserMessage rescues the prompt from an AGENTS.md-wrapped fallback" behavior is unchanged: in those cases the fallback is rejected (unset), so the gate does not engage, and that existing test suite passes unmodified.
Testing
New
parse-goal-attribution.test.tswith the issue's synthetic fixture, covering a goal-started turn with and without a subsequent progress message, plus a guard that the raw wrapper is never exposed as input. On pristine main the first two tests fail (input = "What is the progress?", and the raw wrapper respectively); with the fix all three pass.Full suite: 124/124 pass (
pnpm run build && vitest run; the 3 hook-command tests fail without a prior build on a fresh checkout, on pristine main too - they execute the bundled hook).tsc --noEmitclean,prettier --checkclean.