Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Codex reconnect shows an abandoned fragment instead of the completed answer #19349

Closednone23(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Observed in a retained Codex conversation on October 14, 2026. This sequence was reconstructed from actual logs; a deterministic network reproducer has not yet been built.

  1. Start a Codex turn in T3 Code.
  2. Codex starts a final_answer message, A, and streams a short fragment without a paragraph boundary.
  3. The upstream Codex connection resets before A completes. No item/completed arrives for A.
  4. Codex automatically reconnects and starts a different final_answer message, B, in the same turn.
  5. B receives item/completed with the full answer, followed by a successful turn/completed.
  6. Inspect the settled reply in T3. The abandoned fragment appears as the final reply; the full answer is folded away.

No steering message or user interruption occurred during the affected turn. The reset was between Codex and its upstream service, not an observed disconnect of the T3 client from its server.

Expected behavior

After Codex successfully recovers, the complete replacement answer remains visible as the final reply. Flushing earlier buffered text must not promote an abandoned fragment after that answer.

Actual behavior

The visible reply was only I’d fix, making the answer appear cut off. Codex had successfully produced a complete 2,285-character replacement, and T3 had received and saved that exact text.

T3 subsequently flushed the old seven-character fragment and assigned it a later transcript position. The client selected that later fragment as the final reply and folded away the full answer. The full response was retained in the database.

Impact

Minor bug or occasional failure

A successfully completed turn appears to have lost its answer, prompting the user to ask the agent to repeat it. This report documents one confirmed connection-reset occurrence; its frequency is unknown.

Version or commit

Affected T3 installation: 0.0.46-custom.20261013.f9f892cf28.

Source inspection: 30d1010443d92d7c17f9d773639375a4c6de77bc. The incident has not been reproduced on the latest main commit.

Environment

  • Linux server in a remote work environment.
  • Provider: native Codex app-server, codex-cli 0.162.1.
  • Model: gpt-6.1-sol, reasoning effort xhigh, confirmed from the affected turn.
  • Client browser/desktop version and server Node version were not captured for this report.

Logs or stack traces

Condensed chronology from the actual provider and Codex logs. Times are UTC on October 14, 2026; message IDs are replaced with A and B.

07:08:40.273  item/started A, phase=final_answer
              A receives text: "I’d fix"
07:08:40.406  Codex responses_retry warning:
              stream disconnected before completion: WebSocket protocol error:
              Connection reset without closing handshake
              Retry 1/5 scheduled.
07:08:41.132  Codex upstream WebSocket reconnected
07:08:48.096  item/started B, phase=final_answer
07:09:00.385  item/completed B, full answer: 2,285 characters
07:09:00.457  turn/completed, status=completed

No item/completed for A.
Native rollout contains the full B answer and no completed A answer.
T3's saved B text exactly matches the native full answer.

Persisted T3 order:
  ordinal 1000068: B, full answer, 2,285 characters
  ordinal 1000069: A, abandoned fragment, 7 characters

T3's app-server notification log contained no retry-error notification for this reset. The transport failure and retry were identified in Codex's own runtime log.

The provider log, Codex runtime log, native rollout, and T3 database were inspected read-only. Full logs and conversation content are omitted to keep this report focused and avoid publishing private workspace data.

Investigation

Source inspection explains the saved order:

  • makeAssistantStreamingFilter can withhold a short unfinished paragraph, so its arrival does not yet create a saved turn item.
  • flushTurn emits remaining buffered text as completed. The Codex adapter invokes it at turn finalization, after B has completed.
  • TurnItemPositionStore.allocate assigns positions on first storage, allowing A's late flush to place it after B.
  • Web deriveTerminalAssistantMessageIds selects the last assistant message for a run. Mobile has the same positional selection pattern, but was not separately reproduced.

Workaround

The user requested the answer again and received a complete response. The original full answer was also recovered from the saved transcript during investigation. No code or database changes have been applied.

  1. Note

    Grok responding on behalf of Julius.

    Thanks for the detailed trace. This is the same bug as #18652. In both cases a held, unfinished assistant draft only gets written when the turn ends, so it takes a position after the real answer and the UI treats it as the final reply. #18652 hit it through a steer and you hit it through Codex's upstream reconnect, but the server path is the same.

    The open fix, #19023, reserves a position the first time any held assistant or reasoning draft streams, whatever cut it off, so it should cover the reconnect case too. Closing this as a duplicate so it's tracked in one place. If it still happens once #19023 lands, please comment on #18652.

  2. juliusmarminge added labelsduplicate

  3. juliusmarminge closed this

Sign in to join this conversation.