Changing a provider instance's settings doesn't reach its live sessions #19025
What happened#
To work around #16132 and #17445, we switched four managed Codex instances to setupMode: "existing", each with a shadowHomePath that holds its own codex login. T3 picked up the change. It rebuilt each instance, linked the shadow homes, and took the model list from the new logins: the Fast service tier, which the managed provider removes, appeared again. New turns on those instances still went to the old managed app-servers and failed with the managed token error until the sessions were released.
Diagnosis#
ProviderInstanceRegistry applies a config change by closing the instance's scope and building it again. Live provider sessions belong to ProviderSessionManager's own scope, so they survive the rebuild.
Outside the manager, only two things release sessions: ProviderAuthService, on sign-in and sign-out, and the ACP actions in ws.ts, through closeInstance. Inside it, a session ends when the adapter's event stream ends, at shutdown, or after 30 idle minutes, and every reuse resets that timer (open → touchActivity).
So a changed setup mode, home path, shadow home, binary path or launch arguments reaches running sessions only after a restart or 30 quiet minutes. We observed this with the setup mode and home paths; the other fields follow from the same code path.
A fix would release an instance's sessions when the registry rebuilds it for a config change, for example with closeInstance once running turns finish. The next turn would then start a runtime from the new config.
Steps to reproduce#
- Run a turn on a Codex instance so that its shared app-server is running.
- Change that instance's settings, for example
shadowHomePath,homePathor launch arguments. - Start another turn on the instance. It runs on the old app-server process with the old settings, as
psshows.
Version#
0.0.46-nightly.20261011.2980 (ed0f7b908). The relevant files are unchanged on main.
Environment#
macOS 27.2 arm64, Node 24.21.0 (Electron), Codex 0.162.1.
Evidence#
- Settings were changed at 10:59:55Z.
- Within the next two minutes, test turns on three of the instances failed with
401 token_expiredfromhttps://api.openai.com/v1/responses, the endpoint only the managed runtime uses. - The fourth instance's old app-server had exited earlier: we had killed it while investigating. Its turn failed with
Codex App Server process exited with code 0(see #17045). psstill showed the threecodex app-server -c model_provider="openai_token_sharing" ...processes, whoseCODEX_HOMEpointed at the old managed shadow homes.
Related issues#
- #16132 and #16849: credential renewal. Its triage notes that toggling the provider doesn't release the session; this report covers settings changes.
- #17045: a dead app-server isn't released.
- #17445: long runs outlive the token.
Fix applied or workaround#
None was needed on the machine beyond the settings change. To apply such a change at once, restart T3. Otherwise, avoid starting turns on the instance for 30 minutes.
Filed by#
Claude Opus 5.5 in Claude Code (running inside T3 Code), following the t3 triage playbook.
juliusmarminge added labelsaccepted
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
Reproduced the launch-arguments variant on Linux x86_64, Node 24.21.0, Codex 0.163.0, using the real web dev server and an API-proxy-backed Codex instance at b5a226e49c. This was the cached
origin/main; fetching newer main timed out.- Sent “Reply only OK. Do not use tools.” and received
OK. - Saved
-c issue19025_marker="after"under Settings → Providers → Codex → Launch arguments. Confirmed the isolated server's settings file contained that value. - Sent a follow-up and received
OKagain. The same app-server processes remained alive, without the new argument:
PID 1142320: node …/bin/codex app-server PID 1142391: …/bin/codex app-server saved launchArgs: -c issue19025_marker="after"No duplicate found among 948 open issues scanned in 19 pages. This is an ordinary session-lifecycle bug; the report describes no exploitable vulnerability.
The managed-to-existing subscription-login transition and macOS/Electron remain unverified here. No fix was written: changing session retirement also changes MCP credential revocation through
ProviderSessionManager.releaseEntry, requiring maintainer handling under this triage flow's sensitive-surface stop.- Sent “Reply only OK. Do not use tools.” and received
Reproduced again on fetched main 8acbefefc5, Linux x86_64, Node 24.21.0, Codex 0.163.0, using the real web dev server with isolated state.
A Codex turn returned
OK. I saved-c issue19025_marker="after"in Settings → Providers → Codex → Launch arguments, confirmed it in the isolated settings file, and sent a follow-up that also returnedOK. Both app-server PIDs remained unchanged and lacked the saved argument. Runtime transcript.No duplicate or existing fix found across 927 open issues and 1,394 open PRs. The previous sensitive-surface triage stop no longer applies under the revised brief; this remains an ordinary session-lifecycle bug.
Same bug on the Claude driver, with environment variables, on v0.1.6.
Setup: desktop app (Linux, server 0.1.6), a second Claude instance ("Claude CPA") pointed at a local API proxy with
ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKENin the instance's environment, plus a customhomePath.What happened: the token was saved with a stray trailing
', so turns failed withClaude API authentication failed.and 10 provider retries. After correcting the token and base URL in Settings, the next message in the same thread failed the same way. A new thread worked right away.Evidence:
server.updateSettingsat 22:03:49.41Z; the registry rebuilt the instance at 22:03:49.427Z (ProviderInstanceRegistry.buildEntry→makeClaudeEnvironment), and the settings file has the corrected values.- The user interrupted the running turn (22:03:53.97Z) and sent a new message (22:03:55.45Z,
ProviderSessionManager.holdThreadLoaded→ClaudeAdapterV2.startTurn). - The
claude --output-format stream-json ...process for that turn started at 22:03:54Z, after the save, but/proc/<pid>/environstill had the oldANTHROPIC_BASE_URL(with trailing space) and the old 65-character token. The proxy answers 401 to the old token and 200 to the new one.
So this goes beyond long-lived processes being reused:
ProviderSessionManager.open(ProviderSessionManager.ts:2137-2156at v0.1.6) returns the existing session entry, and that runtime spawns new Claude processes with the environment captured when the session first opened. Environment variables are one more field affected, alongside the home path, shadow home and launch args already listed.Workaround: start a new thread, or restart the app / leave the thread idle for 30 minutes.
Triage by Claude Code (Opus 5.5) via
t3 triage.Adding an Antigravity (ACP) data point for this issue (observed on T3 Code Desktop
0.1.10, macOS arm64; the cached-runtimeopenpath inProviderSessionManager.tsand theAntigravityAuthfinalizer ownership are still present atv0.1.11andmain@ e6d5210).On Antigravity, stale cached sessions after a provider instance rebuild don't just keep old config — subsequent turns fail with
Provider turn failed.:- Following a
server.updateSettingscall andantigravityprovider instance rebuild, an active ACP prompt ended witherrorTag=Interrupt(~19.5s in). - Three follow-up turns across two existing Antigravity threads (one that was mid-turn, one that was idle) skipped
AcpAdapterV2.openSession, logged no newsession/promptin the provider event logs, and failed immediately (SQLite records 3, 6, and 3 ms from provider-turn start to completion) with{"class":"provider_error","message":"Provider turn failed.","code":null}. - Two brand-new Antigravity threads opened afterward completed prompts normally, ruling out provider-wide auth/quota issues.
- The logs and source (
AntigravityAuth.ts:693-703,AntigravityDriver.ts:592-599,AntigravityAdapterV2.ts:150-162,AcpSessionRuntime.ts:1330-1341atv0.1.11) are consistent with the retired instance'sAntigravityAuthfinalizer (stopOwnedProcesses) closing live ACP runtimes, leaving cached sessions reusing closed runtimes (source-inferredensureConnectederror; the idle thread's closure is inferred and its session was marked stopped ~30 minutes after its last retry). Even if a cached adapter attempted a restart, its retiredAntigravityAuthcontroller already hasoperation = "closed", so the session must be released and reopened on the rebuilt instance.
Note on #35012: Checking adapter revision on a later
openlooks like it could let idle Antigravity sessions recover on the next turn if ACP resume succeeds (worth adding an Antigravity/ACP test case since current tests use a test double and Replay). However, #35012 leaves the active-prompt teardown viastopOwnedProcessesduring rebuild unchanged.- Following a
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Confirmed on
main: this is a bug.ProviderInstanceRegistrydocuments config changes as hot-reloaded ("tears down the affected instance's scope and rebuilds — that's the entire hot-reload story"). ButProviderSessionManagernever subscribes to the registry'sstreamChanges, so sessions it already holds keep their old runtime. Only the 30-minute idle release (DEFAULT_IDLE_TIMEOUT_MS, which every reuse resets) or a restart clears them. The only callers ofcloseInstanceare the ACP actions inws.ts, andProviderAuthServicereleases sessions only on sign-in/out.So restarting isn't the intended way to apply settings. It's just the current workaround: restart T3 Code after changing
setupMode, home or shadow-home paths, binary path, or launch args.Likely fix: when the registry rebuilds an instance because its config changed, have the session manager release that instance's sessions (
closeInstance), after letting in-flight turns finish, so the next turn starts from the new config. This is separate from the credential-renewal issues #16132/#16849 and from #17045's dead-process case, but it should be checked alongside them.