Skip to content

[Bug]: Cached provider sessions retain old configuration after adapter replacement #31249

Closed as duplicate

Description

@Kwan-Li

Area

apps/server — provider session reuse after registry replacement

Problem

ProviderSessionManager.open returns a cached runtime before looking up the current provider adapter. When settings rebuild that provider, reopening the same session therefore retains the old adapter configuration.

Claude captures its environment when constructing the adapter, so a subsequent child process launched by that cached runtime can retain an outdated credential. Restarting the server discards those cached runtimes.

Deterministic reproduction

Against public main commit 935818e422f9b58c46e14d70f4ef386fa3575105, a local regression test:

  1. Opens a session using a fixture adapter capturing an empty synthetic token.
  2. Replaces the adapter returned by the registry with one capturing saved-test-token.
  3. Opens the same provider-session ID, supplying the previous session and native thread ID.
  4. Checks which adapter was opened.

Expected adapter-open sequence: ["", "saved-test-token"].
Actual on unchanged production code: [""].

The test uses only in-memory fixture adapters and dummy values; no provider account or network request is required. The test and fix will be included in a follow-up PR.

Expected behavior

The next idle session open should use the replacement provider configuration while preserving native conversation continuity. Saving configuration should not interrupt active turns or pending background work.

Source references

Validation

vp test run apps/server/src/orchestration-v2/ProviderSessionManager.test.ts -t 'refreshes an idle session after provider credentials change'

Result before fix: the assertion above fails because the replacement adapter is never opened.

Related: #28098 reports provider configuration changes requiring restart. This report supplies a deterministic session-manager reproduction.

Activity

  1. juliusmarminge commented on Nov 15, 2026

    @juliusmarminge
    Member

    This is the same problem as #19025, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions