-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Auth/OpenAI: fresh token save can revert to stale expired profile under live gateway #53207
Copy link
Copy link
Closed
Labels
maintainerMaintainer-authored PRMaintainer-authored PR
Description
Bug
Saving a fresh OpenAI token through Configure or Onboard can appear to work, then revert back to a stale expired token while the gateway is still running.
Related: #45516
Root Cause
Locked auth-profile writes in src/agents/auth-profiles/store.ts reload from ensureAuthProfileStore(...), which prefers the runtime auth-store snapshot when one exists. That snapshot can be stale relative to disk.
This means a normal gateway-side auth write like usage/cooldown/last-good persistence can do this:
- CLI / Configure / Onboard writes a fresh credential to
auth-profiles.json - gateway later acquires the auth-store file lock
- locked write reloads the stale in-memory runtime snapshot instead of disk
- gateway saves that stale snapshot back to disk
- fresh token/order/config appears to "revert"
This is the same class of bug as #45516, but it also affects actual credential replacement instead of only auth order.
Repro shape
- Have a running gateway with an old OpenAI token loaded in memory
- Save a fresh OpenAI token via Configure / Onboard
- Trigger any gateway-side auth-store write (
markAuthProfileUsed, cooldown/failure persistence,lastGoodupdates, etc.) auth-profiles.jsoncan be rewritten with the stale token from runtime memory
Expected
Locked auth-store writers should reload from disk under the file lock, not from the runtime snapshot.
Scope
This can affect:
- Configure / Onboard token replacement
models auth order set- any other fresh auth-profile change that races a later gateway-side auth store save
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Give feedbackNo fields configured for issues without a type.