Repository navigation
fix(agents): OpenAI WS replay — inherit message-level phase for untagged blocks when siblings have explicit textSignature - #61529
Conversation
Greptile SummaryThis PR removes the Confidence Score: 5/5Safe to merge; logic change is minimal and correct, regression test added, 94/94 tests pass. The only finding is a P2 stale test description — no logic, data integrity, or reliability issues remain. All P2 findings per scoring guidance keep confidence at 5. No files require special attention beyond the stale test label at line 708.
|
There was a problem hiding this comment.
Pull request overview
Fixes OpenAI WS replay conversion so untagged assistant text blocks inherit the message-level phase even when sibling blocks have an explicit textSignature.phase, preventing phase loss and downstream phase-aware suppression issues.
Changes:
- Update
convertMessagesToInputItems()to always usem.phaseas the fallback phase for untagged text blocks (removes thehasExplicitBlockPhaseguard). - Update/extend unit tests to cover mixed explicit/untagged blocks and the updated replay behavior.
- Add a new WS streaming regression test around late item-phase attribution (see comment).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/agents/openai-ws-message-conversion.ts | Removes explicit-block scan and makes untagged blocks inherit message-level phase during replay conversion. |
| src/agents/openai-ws-stream.test.ts | Updates replay expectations and adds regression tests for phase inheritance and late phase attribution. |
|
Related issues: This PR also relates to #61734 (commentary-phase text leaks into user-visible output with openai-codex/gpt-5.4), #25592 (text between tool calls leaks to messaging channels), and #48709 (Gemini 2.5 Pro textSignature bloat + think tags + mixed text/tool causes session failures). These share the same root cause around phase/textSignature handling during history replay. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 974e0573fb
ℹ️ 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".
…eplay splitting Fixes #61476 Untagged text blocks in mixed assistant messages were forced to undefined phase when any sibling had an explicit textSignature phase. Now they correctly inherit the message-level assistantMessagePhase, preventing commentary leaks during history replay. Removes the hasExplicitBlockPhase scan — untagged blocks always inherit m.phase. Blocks with explicit textSignature.phase still use their own. 94/94 tests pass. Regression test added for mixed explicit/untagged blocks.
|
Landed via temp rebase onto
Thanks @100yenadmin! |
What this fixes (plain English)
When replaying chat history that mixes phase-tagged and untagged text blocks, untagged blocks lost their phase label — causing internal commentary to leak into visible conversation output. This fix ensures untagged blocks correctly inherit their parent message's phase.
Technical details
Root cause: The
hasExplicitBlockPhasescan inopenai-ws-message-conversion.tswas intended to separate legacy unphased content from new phased content, but it overcorrected — it forcedundefinedphase on untagged blocks whenever any sibling block had an explicittextSignature.phase.Fix: Remove the
hasExplicitBlockPhasescan entirely. Untagged blocks now always inheritassistantMessagePhase(fromm.phase). Blocks with an explicittextSignature.phasestill use their own value.Files changed:
src/agents/openai-ws-message-conversion.ts— remove overcorrective phase scansrc/agents/openai-ws-stream.test.ts— regression test for mixed explicit/untagged blocks; corrected phase-buffering expectation for mid-stream deltasRelated
Test plan