codex icon indicating copy to clipboard operation
codex copied to clipboard

[Windows][VS Code] Distinct chats in multiple windows trigger hydration resume storm and active-writer conflicts

Open RebeccaCode opened this issue 2 months ago • 3 comments

Codex version

  • VS Code: 1.136.1 (x64)
  • Codex IDE extension: openai.chatgpt 26.825.51511
  • Bundled Codex CLI/app-server: codex-cli 0.151.0-alpha.7.2
  • OS: Windows 11 Home, 10.0.26200 (Build 26200)
  • Runtime: native Windows / PowerShell (not WSL)

Summary

Opening multiple VS Code windows on different workspaces, with a distinct Codex chat in each window, causes the extension to automatically hydrate/resume threads owned by other windows. The background resume enters a rapid follower retry loop and eventually produces thread-store conflict: ... already has an active writer errors.

This makes chats appear stuck, prevents queued follow-ups/steering from being delivered, and leaves the history list stale. The user does not open or resume the same chat in multiple windows.

Steps to reproduce

  1. Open VS Code window A on workspace A.
  2. Open the Codex sidebar and start local chat A.
  3. Leave window A and chat A open.
  4. Open VS Code window B on a different workspace B.
  5. Open the Codex sidebar and create a new local chat B. Do not select or resume chat A.
  6. Continue opening/using distinct chats in the two windows.

This is especially visible with four independent VS Code workspaces open concurrently, each using its own active Codex chat.

Expected behavior

Each VS Code window should operate its distinct active chat independently. Loading the shared history in another window should not acquire a writer for, or continuously resume, a thread owned by another window. History and thread ownership should remain synchronized across extension instances.

Actual behavior

The newly opened extension instance sees existing threads in shared history and attempts to resume them as followers. Threads remain in resuming and repeatedly emit maybe_resume_started. Other windows then fail to hydrate those threads because an active writer already exists. Queued follow-ups can fail instead of reaching the active chat.

In one captured VS Code log session:

  • One thread emitted 6,620 maybe_resume_started events.
  • A second distinct thread emitted 5,952 maybe_resume_started events.
  • 12 already has an active writer conflict messages were recorded.
  • Failures explicitly identified source=thread_hydration.
  • A queued follow-up explicitly failed because the thread already had an active writer.
  • No request-timeout pattern was present; authentication succeeded.

Sanitized representative excerpts:

maybe_resume_started conversationId=<redacted> documentVisibilityState=visible hostId=local previousResumeState=resuming previousStreamRole=follower

failed to initialize thread persistence: thread-store conflict: thread <redacted> already has an active writer

Request failed conversationId=<redacted> error={"code":-32600,"message":"thread <redacted> already has an active writer"} method=thread/resume source=thread_hydration

[queued-followups] Failed to send queued follow-up for conversationId=<redacted> reason="thread <redacted> already has an active writer"

Additional context

  • Separate workspace folders and separate newly created chats are used in every window.
  • The issue appears to be automatic history/thread hydration across extension instances, rather than the same chat being intentionally opened twice.
  • Fully exiting all VS Code/Codex processes temporarily releases the writers, but reopening multiple windows reproduces the behavior.
  • Related active-writer reports include #37403 and #39823, but those cover macOS Desktop/Remote Control and CLI/TUI session switching rather than distinct chats in multiple Windows VS Code windows.
  • Full logs are not attached publicly because they include local paths and session metadata, but sanitized diagnostics or a feedback session can be provided if needed.

RebeccaCode avatar Sep 03 '26 17:09 RebeccaCode

Independent reproduction on Windows, with a generated-image preview as the trigger.

Environment

  • VS Code: 1.136.1 (x64)
  • Codex IDE extension: openai.chatgpt 26.5901.22334
  • Windows: 10.0.19045.7184
  • Three VS Code windows, each opened on a different folder/project
  • Each window was using a different Codex conversation; the affected conversation was not manually opened in either of the other windows

Trigger and visible result

  1. Complete an image-generation turn in the target conversation.
  2. Click a generated image to open its image/canvas preview.
  3. Return to the Codex conversation.
  4. The task header and composer remain visible, but the complete transcript area is blank.
  5. Leaving and reopening the conversation does not restore the transcript. Sending from the blank view provides no visible confirmation.

This also overlaps with #38133, but the extension logs expose the multi-window hydration/ownership conflict described in this issue.

Sanitized diagnostics

Immediately after the target webview became inactive, the other two VS Code extension hosts received these broadcasts:

Received broadcast but no handler is configured method=query-cache-invalidate
Received broadcast but no handler is configured method=thread-queued-followups-changed

Both extension hosts then attempted to resume the target thread even though those windows had different workspaces and distinct active conversations:

maybe_resume_started conversationId=<target-thread>
  documentVisibilityState=visible
  hostId=local
  previousResumeState=needs_resume
  previousStreamRole=null
  routePath=/index.html

thread_stream_role_changed conversationId=<target-thread>
  previousRole=null role=owner

failed to initialize thread persistence:
  thread-store conflict: thread <target-thread> already has an active writer

Request failed conversationId=<target-thread>
  method=thread/resume
  source=thread_hydration
  message="thread <target-thread> already has an active writer"

Failed to execute queued message conversationId=<target-thread>
Failed to release queued message send lock conversationId=<target-thread>

One of those windows had previously resumed its own distinct thread successfully, with Git/workspace activity tied to a different project. A few minutes later the same extension host successfully resumed the target thread. This suggests that the selected thread/route or hydration event crossed VS Code window/workspace boundaries; it was not caused by the user opening the same chat twice.

The local rollout file for the affected conversation remained present, was about 108 MB, and continued updating after the UI became blank. This appears to be a hydration/rendering failure rather than transcript deletion.

Expected

  • Different VS Code windows and workspaces should keep their distinct active conversations isolated.
  • A background/hidden extension host should not claim owner or resume a thread selected in another window.
  • Opening a generated-image preview should not broadcast or transfer thread ownership.
  • If hydration fails, the UI should show a recoverable error instead of permanently rendering an empty transcript.

Fully exiting all VS Code processes releases the writer and temporarily restores access when reopening a single window.

jejucoding101 avatar Sep 05 '26 07:09 jejucoding101

Additional Windows reproduction with distinct workspaces

I reproduced the same failure pattern on Windows with three VS Code windows, each opened on a different project workspace and intended to run a different Codex conversation.

The workspaces are distinct. A task in one workspace may occasionally access a shared repository when a change legitimately spans components, but that filesystem overlap does not mean the conversations are the same thread and should not transfer thread ownership between windows.

Environment

  • Windows 11 Pro, build 26300
  • VS Code 1.143.1
  • OpenAI VS Code extension openai.chatgpt 26.930.31730
  • Native Windows; no Remote SSH, WSL, or container involved

Sanitized evidence

Local VS Code and Codex telemetry showed:

  • One app-server process owned the active conversation.
  • The other two per-window app-server processes explicitly issued thread/resume for that same thread.
  • For one conversation, two non-owner windows attempted thread/resume less than one second apart.
  • The pattern then occurred with a different conversation owned by another window.
  • During one visible failure burst, there were 15 distinct thread-store conflict: ... already has an active writer events within approximately 34 seconds, after duplicate log targets were deduplicated.
  • The composer displayed a failed submission with Retry while another copy appeared queued.
  • One submission eventually reached the owning process; the durable queue was empty afterward.

The user did not intentionally open the same conversation in all windows. The evidence indicates automatic cross-window resume/hydration of a thread owned by another extension instance.

Expected behavior

  • Different VS Code windows and different conversations should remain independent, even when tasks can access a common repository.
  • Background history hydration should be read-only and must not acquire the thread writer.
  • A writer conflict should not lose, duplicate, or strand the submitted prompt.
  • If ownership transfer is necessary, it should be explicit and coordinated with the current owner.

No project names, repository names, user paths, conversation identifiers, prompt contents, or raw logs are included.

viperp12 avatar Oct 26 '26 17:10 viperp12

Additional Windows VS Code reproduction — November 29, 2026

Codex extension versions 26.1117.41037 and 26.1120.50957 on Windows x64. Multiple VS Code windows were open.

Logs across windows show a successful resume of the same persistent thread in another window before the selected window's first active-writer conflict. Later that other window logged a successful automatic resume with documentVisibilityState=hidden, while competing windows logged writer conflicts. Four window logs reference the thread; captured logs contain 55 matching writer-conflict entries (log occurrences, not distinct incidents). The selected window resumed successfully after the other window's last recorded activity.

Subsequent read-only process-handle inspection identified one VS Code app-server holding both the thread-writer lock and canonical rollout handles. Other inspected clients did not expose those target handles.

This supports investigating hidden/background hydration and ownership handoff rather than assuming the desktop app is the conflicting writer. Historical OS lock ownership was not captured; timing correlation is not proof of the exact previous owner. Please prevent hidden resume from preempting the intended active window, expose useful owner diagnostics, and preserve legitimate running work. No process was killed or lock deleted. Private paths, exact thread IDs and raw logs omitted.

dyehya avatar Nov 29 '26 21:11 dyehya