Repository navigation
fix(auth): preserve selected chat accounts when credentials disappear - #166985
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 2:59 AM ET / 06:59 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch preserves compatible, explicitly selected chat accounts during credential absence and prepares missing-account provider facts through the existing asynchronous auth-store owner. Example: A user sends a message with openai:account-b selected while only openai:account-a is available.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful: current main still clears missing shared-account selections. The prior synchronous-read finding is resolved, and this review found no actionable functional or security defect. Maintainer authorship also prevents automatic closure. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherReply preparation combines the chat's saved model and account selections with available credentials before authentication runs. The session policy decides whether to retain the account, while the auth store supplies recorded credential-provider facts. flowchart TD
A[Chat message] --> B[Reply model selection]
C[Saved account selection] --> B
B --> D[Worker-backed credential facts]
D --> E[Canonical session policy]
E --> F[Retain compatible explicit selection]
E --> G[Clear automatic or incompatible selection]
F --> H[Authentication and recovery]
G --> H
Technical reviewBest possible solution: Keep account-preservation decisions in the canonical session policy and consume worker-prepared credential facts before authentication handles recovery. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence path: select openai:account-b, remove its credentials while account-a remains, then run reply model selection; current main clears the selected pin. No runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes, the patch repairs the destructive caller using the existing preservation policy and worker-backed read owner, with focused concurrency guards and no new configuration or stored format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6fc16a80b9fb. Provenance checked
TestingProof path: unit tests only. Added test files: 3. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +96, Tests +197, Other -1. Total +292 across 10 files. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment History |
|
|
@clawsweeper status |
|
🦞👀
|
|
Merged via squash.
|
…openclaw#166985) * fix(auth): retain selected chat account while credentials are missing * fix(auth): prepare missing-profile providers off-thread * test(auth): preserve runtime mock exports * test(auth): brace conditional fixture setup
What Problem This Solves
Chats could lose an explicitly selected account when its credentials were temporarily missing, even while another account for the same provider remained available.
User Impact
Compatible explicit selections now survive temporary credential absence and restoration in the same session. Automatic selections, incompatible-provider pins, and confirmed credential removal retain their existing cleanup behavior.
Why This Change Was Made
Reply selection now uses the canonical session-auth preservation policy. It prepares missing-account provider facts through the existing worker-backed auth-store owner, preserving credential-source precedence without synchronous SQLite reads on the Gateway thread. After the await, operator authority and selection identity are rechecked; canonical snapshot checks protect any later clear.
This narrow successor replaces the closed #155849. The change has net +96 production lines, +197 test lines, and one removed mock-baseline entry across ten files. Production growth is limited to asynchronous provider preparation, required exports, prepared-fact policy input, and selection currentness.
Evidence
curlydiagnostic pass. The mock-baseline change removes one obsolete allowance.Review Follow-up
The synchronous-read finding is resolved through worker-owned provider preparation. Broader extraction of the already oversized auth store and chat tests is deferred to separate maintenance work to keep this fix within the requested narrow scope. Hosted line-cap diagnostics were warnings; no limit or baseline was raised. The separate full-config local lint refusal is retained and is not represented as a green full-lint result.
Observed single-worker native file durations: chat 6.376s/44 cases, policy 1.907s/12, worker 0.120s/22. The chat runner took 39.74s including setup. These are retained test costs, not benchmarks.
The successful CI run tested merge
e83190b2168773777340bd29110453b9f51f0513, whose actual parents are base8413457b09e654616de422f50ea2b5f3794ef53dand PR heade1c369527e98d58ee129a56c1eb396edcb6b56fb. Its tree isd49135f71d71c7bb787ce10b457a9ecb34dc775e.