Update — Reproduced on upstream, root causes identified, and partial fix validated (Oct 13, 2026)
I conducted a deeper investigation of this issue against current upstream T3 Code, including automated regression tests and real Codex app-server experiments with two authenticated accounts.
The original issue is now reproducible at the orchestration/protocol level. It is not limited to model self-reported context loss, my original Ubuntu installation, or CLI shadow-home authentication.
1. Confirmed failure paths
The investigation identified several related problems:
A. Queued account switches can bypass native-continuation classification.
When a provider selection has already been persisted, the queued-run starter may skip the provider-switch plan because the queued selection matches thread.modelSelection, even though the active native thread belongs to a different provider instance.
This can incorrectly trigger a portable context handoff instead of restart_and_resume.
Location: Orchestrator.ts, queued-run dispatch.
B. Failed native resume silently replaces the native conversation.
When session.resumeThread fails, ProviderTurnStartService can fall back to a fresh native thread and inject full_thread_summary.
This explains how a seemingly continuous T3 conversation can actually lose its original provider-native continuity.
C. Native writer ownership can survive account switching.
ProviderSessionManager previously identified native threads to unload through persisted bindings, which may already have been rebound to the new provider instance.
Additionally, Codex's thread/unsubscribe does not immediately release the original native writer.
If the source Codex process is shared by another attached conversation, T3 cannot safely terminate that process to free the writer.
This is a separate remaining blocker to reliable account switching.
D. Additional lifecycle issues
The investigation also identified premature active-run detachment during selection changes, non-proactive sharing of the native writer-lock directory, and missing validation that thread/resume returns the requested native thread ID.
2. Reproduction and validation
The investigation used upstream commit:
98a6246d07624432a6e6d0ab4fb87bede90a49a6
Environment:
Codex CLI 0.162.1
Installed T3 nightly 0.0.46-nightly.20261012.3010
Two distinct managed ChatGPT OAuth accounts
Isolated T3 configuration, native homes, and disposable conversations
Results:
Verification | Result
-- | --
Selected regression cases on unmodified upstream | 9 failed, 2 passing controls
Same 11 cases after the patch | 11 passed
Total focused tests after patch | 430 passed
Server typecheck | Passed
Real managed OAuth model turns | 53 completed
Immediate A → B → A switching cycles | 3 successful
Queued B → A → B switching cycles | 3 successful
Portable handoffs during those six cycles | 0
Native thread identity during those cycles | Preserved
Long-thread restart recovery | Successful
Shared-process writer conflict | Still reproducible
Real protocol traces confirmed successful thread/resume operations returning the original native thread ID.
The unmodified-upstream regression failures and the patched results were tested separately.
3. Managed OAuth does not inherently fix this
Both managed OAuth accounts authenticated successfully and completed actual model turns.
However, a native active_writer failure was reproduced after authentication.
Managed OAuth changes credential management but uses the same native-continuation and orchestration infrastructure.
Therefore, migrating from CLI shadow-home accounts to managed OAuth alone is not a reliable fix for this issue.
4. Current patch status
A local, uncommitted patch now:
Correctly classifies queued switches against the active native thread owner.
Preserves active-run bindings until the run settles.
Retains the saved native thread reference when Codex resume fails.
Prevents silent replacement with a full-history handoff on Codex resume failure.
Tracks and releases the correct native writer when safe.
Validates native resume identity.
Proactively shares the writer-lock namespace across compatible homes.
The patch modifies five production files and five test files.
This is a partial fix, not a claim of complete resolution.
5. Remaining blocker: shared Codex app-server processes
The unresolved case is reproducible:
Conversation 1 and Conversation 2 use Account A.
Both are attached to the same Codex app-server process.
Conversation 2 remains attached, even if idle.
Switch Conversation 1 from A to B.
Codex rejects native resume because the source process still retains the original writer.
After the patch, T3 preserves the native thread ID and reports the failure explicitly rather than silently starting a replacement conversation.
A real disposable-server restart subsequently allowed Account B to resume the original 20-turn native conversation.
The installed Codex protocol does not expose a verified immediate, non-destructive per-thread writer-release operation. A complete fix may therefore require safer process ownership/isolation in T3 or additional upstream protocol support.
6. Next steps
I am separately investigating process isolation/pooling alternatives to resolve the remaining writer conflict without interrupting unrelated conversations.
The validated corrections appear suitable for upstream review independently of that larger architectural change.
I can provide the focused patch, regression tests, engineering report, and redacted protocol evidence for review.
I recommend keeping #16613 open until compatible account switching reliably preserves native continuity, including when multiple conversations share an app-server process.
Related: #8259, #11136, #4766.
Note: CLI shadow-authentication E2E and mixed CLI/managed switching were not fully validated inside T3. Live managed OAuth switching and independent native CLI protocol resumes were verified.