[BUG] VS Code Codex thread hangs during web/tool search and UI loses recent messages

Open 💬 2 comments Opened Apr 1, 2026 by mazukabz
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What issue are you seeing?

In VS Code Codex, the thread hung while the assistant was doing web/tool search. After that, the UI appeared to lose the latest part of the conversation and only showed the beginning of the thread.

The session data was not fully lost: the missing turns were still present in the local session JSONL under ~/.codex/sessions/..., so this looks like a UI restore/reconnect/history rendering bug rather than total data loss.

I also hit a separate recurring compact error in the same environment:

Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

What steps can reproduce the bug?

  1. Use Codex in VS Code on macOS.
  2. Continue a long-running thread.
  3. Let Codex perform web/tool work for a while.
  4. The thread hangs.
  5. After the hang/reconnect, the UI no longer shows the latest messages, but the missing content still exists in ~/.codex/sessions/...jsonl.

What is the expected behavior?

The thread should recover cleanly after hangs/tool failures, and the UI should restore the full recent conversation instead of dropping the latest visible turns.

Additional information

  • Platform: macOS
  • Surface: VS Code Codex extension
  • Session evidence recovered from local session file
  • Related local artifacts:
  • ~/.codex/sessions/2026/04/01/rollout-2026-04-01T10-12-51-019d47e3-494a-7ae1-b05f-622c2cc8e853.jsonl
  • ~/Library/Logs/com.openai.codex/2026/04/01/

Notes

The local session file preserved assistant/user messages that the UI no longer displayed, which strongly suggests a restore/rendering/history-sync issue after the hang.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14812
  • #15349
  • #16255
  • #16278
  • #15727

Powered by Codex Action

Lotfree618 · 3 months ago

I’m seeing a very similar issue with the VS Code extension history rendering.

Environment:

  • VS Code extension: openai.chatgpt@26.519.32039

In my case, the same Codex thread is fully visible in codex CLI, including all turns, but the VS Code extension only shows the first user message after reopening the thread from history.

Additional observations:

  • The local Codex storage is not missing the conversation.
  • thread/read with includeTurns: true can read the full thread history.
  • The CLI and VS Code extension appear to use the same local Codex thread data.
  • This looks like a VS Code extension hydration/rendering issue rather than data loss.

From inspecting the installed VS Code extension bundle, the reopen path appears to call thread/read with includeTurns: false for metadata first, and full turn hydration seems to depend on a useTailHydration feature gate. When that hydration path is not enabled or does not run, the UI can reopen the thread with only cached/initial content.

The app-server API already has the pieces needed to avoid this:

  • thread/read supports includeTurns: true
  • thread/turns/list can page stored thread history
  • thread/resume supports initialTurnsPage

Docs: https://developers.openai.com/codex/app-server#threads

A possible fix would be for the VS Code extension to always hydrate recent turns when opening/resuming a stored local thread, either via thread/resume + initialTurnsPage, or via thread/turns/list with thread/read(includeTurns: true) as a fallback, instead of depending on a gated tail-hydration path.