Skip to content

fix(agent): dedup codex incomplete interims on visible content - #65063

Merged
teknium1 merged 1 commit into
mainfrom
fix/52711-codex-interim-dedup
Jul 15, 2026
Merged

fix(agent): dedup codex incomplete interims on visible content#65063
teknium1 merged 1 commit into
mainfrom
fix/52711-codex-interim-dedup

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Consecutive incomplete Codex interim messages with identical visible content are now deduplicated even when opaque provider state drifts between continuations — ending the duplicate "Working on it..." message storms (#52711).

Salvages the dedup half of #52716 (@liuhao1024) with authorship preserved.

Root cause: the interim dedup compared encrypted reasoning item ids and message item phases alongside visible text. Those opaque payloads legitimately change on every continuation, so the comparison never matched and every retry emitted another identical bubble.

Changes (@liuhao1024)

  • agent/conversation_loop.py: duplicate detection compares only what the user sees (content + reasoning); when a visible duplicate is found, the latest opaque payload (codex_reasoning_items, codex_message_items) is written onto the existing message in place, so continuation replay still carries fresh provider state without a new visible message

Salvage scope note

The original PR also made the 3-retry continuation cap cumulative per turn (never resetting on progress). That half is intentionally dropped: a legitimate long turn that alternates incomplete/progress several times would hard-fail at 3 cumulative attempts — a semantics change beyond the reported bug that risks breaking healthy long turns. The counter-reset-on-progress behavior on main is unchanged. If the alternating-bypass concern materializes in reports, it can be revisited as its own scoped change.

Validation

Scenario Before After
identical visible text, drifting opaque ids ×N N duplicate bubbles 1 bubble, opaque state refreshed in place
new visible progress text emitted emitted (unchanged)
retry-cap semantics reset on progress reset on progress (unchanged)

Infographic

codex-interim-dedup

Two consecutive incomplete assistant interims with identical visible
content (content + reasoning) are collapsed even when opaque provider
state (encrypted reasoning item ids, message item phases) drifts per
continuation — previously that drift defeated dedup and caused message
storms (#52711). The latest opaque payload is written onto the existing
message in place, so continuation replay still uses fresh provider
state.

Salvage note: the original PR also made the 3-retry continuation cap
cumulative per turn (no reset on progress). That half is intentionally
dropped — a legitimate long turn alternating incomplete/progress would
hard-fail at 3 cumulative, changing semantics beyond the reported bug.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API codex P2 Medium — degraded but workaround exists labels Jul 15, 2026
@teknium1
teknium1 merged commit 6a8e706 into main Jul 15, 2026
31 checks passed
@teknium1
teknium1 deleted the fix/52711-codex-interim-dedup branch July 15, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants