fix: recreate live sessions on logout when it clears a provider or gateway override (#1278)

## What

ACP `logout` cleared `providerConfig` and the gateway credentials but
left live queries running. Provider and gateway routing is baked into
each query's env, so open sessions kept using the old route after
logout.

`logout` now recreates every live session through the same path as
`providers/disable` (`enqueueProviderUpdate`), but only when a provider
or gateway override was active. It waits for active turns, then resumes
each session under its id with native routing. This also runs when
`claude auth logout` fails, because the override is already cleared by
then.

A plain CLI-login logout does not touch live sessions: the running CLI
picks up the logout by itself.

## Behavior change

With an override active, `logout` now waits for running turns before it
returns, like `providers/disable`. Under `--hide-claude-auth`, a session
that cannot be recreated signed out is dropped, as with
`providers/disable`.
This commit is contained in:
Andrey Bragin
2026-10-08 17:50:23 +04:00
committed by GitHub
parent d43fec3fa3
commit 966be7abe6
4 changed files with 82 additions and 27 deletions

View File

@@ -16,6 +16,14 @@ npm run format # prettier --write
CI runs `format:check`, `lint`, `build` and `test:run`. Run `npm run check` before
opening a PR.
## Code comments
Keep comments straightforward, concise, and concrete. Say what the code does and
why, in plain terms: name the actual state, call, or failure involved instead of
alluding to it. Prefer a short concrete example over an abstract description.
Don't use vague phrases like "keeps it honest" or "the residual case" that make
the reader reconstruct the meaning.
## Pull requests
Squash merges use the PR title as the commit subject, and release-please parses it