Skip to content

fix(codex): keep status summaries out of intermediate messages - #2041

Open
techotaku39 wants to merge 1 commit into
tiann:mainfrom
techotaku39:fix/notify-summary-final-only
Open

techotaku39 wants to merge 1 commit into
tiann:mainfrom
techotaku39:fix/notify-summary-final-only

Conversation

@techotaku39

Copy link
Copy Markdown
Contributor

Summary

Codex can emit AGENT_NOTIFY_SUMMARY in progress messages while the turn continues, causing multiple status rows before the final answer.

  • Clarify the shared summary instruction to request exactly one footer in the final answer, excluding commentary, progress updates, and messages before tool calls.
  • Remove valid trailing summary footers from explicit commentary and partial_answer messages during live app-server and transcript conversion, preserving progress prose.
  • Suppress footer-only intermediate messages before Hub storage, notification composition, and work-graph ingestion.
  • Add regression coverage for live/history projection, duplicate events, footer-only messages, and preservation of final answers, unknown phases, malformed footers, and literal examples.

Validation

  • bun typecheck — passed.
  • bun run build — passed.
  • bun run --cwd cli test -- src/codex/utils/appServerEventConverter.test.ts src/codex/utils/codexEventConverter.test.ts src/codex/shared/projection.test.ts src/modules/common/sessionSummaryInstruction.test.ts — 141 passed. The initial regression run failed on the previous implementation.
  • bun run --cwd web test -- src/components/AssistantChat/messages/NotifySummaryText.test.tsx src/components/AssistantChat/messages/assistantCopyText.test.ts — 16 passed.
  • pwsh -NoProfile -File .\scripts\Invoke-HapiTaskPlaywright.ps1 -Name fix-notify-summary-final-only -Suite Root terminal-wrap-fidelity.spec.ts — 2 passed.
  • Read-only replay of 157 source-matched messages from five real sessions through the baseline and fixed projections — all 91 intermediate footers removed, all 66 final footers preserved, progress prose hashes unchanged, and live/history outputs equivalent.
  • Task-local Playwright comparison against an isolated Hub — 8 passed, covering stored messages, work-graph records, desktop/mobile rendering, and reload behavior. Included an unfinished turn and three normal final-answer controls. Original sessions were not resumed and recorded commands were not executed.
  • Isolated native Codex CLI 0.162.1 acceptance — passed with both a deterministic model fixture and GPT-6.1 Sol. The real-model run executed two harmless PowerShell commands successfully and emitted a footer only in the final answer.
  • git diff --check — passed.

Limitations

Messages with missing or unknown phases retain existing behavior. Already stored Hub messages are not rewritten. The updated instruction takes effect when injected into new or resumed sessions.

Related Issues

Fixes #2037

AI Disclosure

Implemented and tested with OpenAI Codex using GPT-6.1 Sol.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review mode: initial

Requirement — Pass

Keeping status summaries in final answers addresses the reported premature status rows and misleading intermediate completion states.

Evidence

  • Issue #2037 documents commentary footers followed by further tool activity and a final-answer footer.
  • At the base commit, cli/src/modules/common/sessionSummaryInstruction.ts:52 requests a footer after every response; web/src/components/AssistantChat/messages/NotifySummaryText.tsx:136 checks message completion without distinguishing final answers.

Approach — Pass

Clarifying the instruction and filtering explicitly intermediate messages during conversion addresses both generation and downstream ingestion without changing the wire contract.

Evidence

  • cli/src/modules/common/sessionSummaryInstruction.ts:52 restricts emission to the final answer.
  • cli/src/codex/utils/assistantText.ts:5 reuses the existing footer parser only for commentary and partial_answer phases.
  • cli/src/codex/utils/appServerEventConverter.ts:1007 and cli/src/codex/utils/codexEventConverter.ts:506 apply filtering before message emission; shared projection uses the app-server converter for both live events and history.

Code — Reviewed

Reviewed the entire fixed-head merge-base diff and relevant surrounding conversion, deduplication, replay, and parsing code. No actionable defects found. Missing or unknown phases and already stored messages retain their documented behavior.

No reportable code issues found.

Testing

Not run (automation; PR code execution is prohibited).

  • Added regression coverage exercises intermediate footer removal, footer-only suppression, final-answer preservation, duplicate events, and live/history equivalence.
  • Observed CI: integration and windows-codex-mcp succeeded; test and pr-review remained in progress.
  • The PR reports passing typecheck, build, focused tests, replay, and acceptance checks. These were not independently executed; review remained read-only.

HAPI Bot

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(codex): AGENT_NOTIFY_SUMMARY appears in progress messages before the turn ends

1 participant