Skip to content

bug(agents): OpenAI WS replay drops message-level phase when block has explicit textSignature — commentary leaks on history replay #61476

Closed

Description

@100yenadmin

Bug

After #59643 merged, replay conversion in src/agents/openai-ws-message-conversion.ts:356-398 can corrupt phase metadata on mixed messages.

Root cause

When replaying assistant history, if any text block has an explicit phase in its textSignature, then every other block without an explicit phase is forced to undefined instead of inheriting m.phase:

const blockPhase =
  parsedSignature?.phase ?? (hasExplicitBlockPhase ? undefined : assistantMessagePhase);

Once hasExplicitBlockPhase is true, untagged blocks stop inheriting the message phase. So a message with m.phase = "final_answer" plus one explicitly-tagged block and one untagged block gets replayed as two logical messages: one final_answer, one unphased.

On the return path, unphased text sets hasUnphasedAssistantText = true (:500-502), which prevents message.phase from being reconstructed (:575-579). This creates malformed/contradictory phase metadata.

Impact

Final-answer text can become partially unphased on replay, making downstream visibility/suppression logic inconsistent. This is especially problematic when the replayed context feeds a new turn where the model sees corrupted phase state.

Code location

  • src/agents/openai-ws-message-conversion.ts:356-398, 500-502, 575-579

Severity

P1 — affects replay fidelity and downstream phase-aware suppression.

Related

  • Parent fix: #59643

Activity

  1. 100yenadmin commented on Apr 5, 2026

    @100yenadmin
    ContributorAuthor

    Part of the post-#59643 adversarial review family. See #61474 for the full list. This one is especially relevant for the OpenAI Responses API replay path — mixed-phase assistant history gets corrupted during convertMessagesToInputItems, which affects subsequent model turns.

  2. changed the title [-]bug(agents): replay splitting drops message-level phase when any block has explicit textSignature phase[/-] [+]bug(agents): OpenAI WS replay drops message-level phase when block has explicit textSignature — commentary leaks on history replay[/+] on Apr 5, 2026
  3. added a commit that references this issue on Apr 6, 2026
    a58726e
  4. added a commit that references this issue on Apr 6, 2026
    866a0dc
  5. added a commit that references this issue on Apr 6, 2026
    bb9840a
  6. locked as resolved and limited conversation to collaborators on Apr 9, 2026
  7. added a commit that references this issue on Apr 28, 2026
    31cf4c1
  8. added a commit that references this issue on May 2, 2026
    6ed71e9
  9. added a commit that references this issue on May 24, 2026
    b702bac
  10. added a commit that references this issue on Aug 16, 2026
    a437b66
  11. added a commit that references this issue on Sep 29, 2026
    258680d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions