Skip to content

fix(parser): treat Codex /goal continuation context as system content#886

Open
mjacobs wants to merge 1 commit into
kenn-io:mainfrom
mjacobs:fix/codex-goal-continuation-context
Open

fix(parser): treat Codex /goal continuation context as system content#886
mjacobs wants to merge 1 commit into
kenn-io:mainfrom
mjacobs:fix/codex-goal-continuation-context

Conversation

@mjacobs

@mjacobs mjacobs commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Codex /goal sessions inject continuation context as role=user records so the model keeps working toward the active thread goal. agentsview parsed these as ordinary user turns, so long goal-oriented Codex sessions filled with synthetic "Continue working toward the active thread goal…" messages between real exchanges, and user_message_count was inflated (which also feeds single-turn/automated session classification).

This routes both envelope formats through the existing isCodexSystemMessage gate so they are dropped from the transcript, user counts, search, and analytics — the same way <environment_context>, <skill>, and other Codex internal envelopes are:

  • Current: <codex_internal_context source="goal">…</codex_internal_context>
  • Legacy: <goal_context>…</goal_context>

Detection is scoped to the structured wrapper (and the goal source for the modern form), so a real user message that merely quotes the goal sentence is preserved. The change is parser-level and pre-storage, so it applies identically to the full and incremental parse paths and both storage backends.

Where to look: internal/parser/codex.go (isCodexGoalContext plus the isCodexSystemMessage wiring).

Closes #868

Codex /goal sessions inject continuation context as role=user records
wrapped in <codex_internal_context source="goal"> (current) or
<goal_context> (legacy). These were parsed as ordinary user turns,
flooding long goal-oriented sessions with synthetic messages between
real exchanges and inflating user_message_count.

Route both wrappers through isCodexSystemMessage so they are dropped
from the transcript, user counts, search, and analytics like other
Codex internal envelopes. Detection is scoped to the structured
wrapper (and the goal source for the modern form) so a real user
message that quotes the goal text is preserved.

Closes kenn-io#868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Codex /goal continuation context renders as user messages in transcripts

1 participant