Repository navigation
fix: preserve account selection and recovery lifecycle ownership - #140973
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: blocked before merge. Reviewed September 7, 2026, 11:27 AM ET / 15:27 UTC. ClawSweeper reviewWhat this changesPreserves selected accounts and request context during recovery, coordinates native process cleanup, repairs Doctor sequencing, and updates plugin loading and regression fixtures. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains useful: current main still clears missing explicit account selections and lacks the coordinated restart capability. No blocking introduced defect was found. The prior mixed-version warning does not establish a supported upgrade regression. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw turns session requests and selected credentials into provider or CLI executions. Its recovery coordinators preserve conversation state, retire processes, and prepare compatible configuration and databases before subsequent work. flowchart TD
A[Session request and selected account] --> B[Account and model preparation]
B --> C[Provider or CLI execution]
C --> D[Recovery coordinator]
D --> E[Preserved conversation context]
D --> F[Process cleanup and replacement]
G[Doctor configuration and database checks] --> B
Before merge
Agent review detailsSecurityNone. PR surfaceSource +145, Tests +428, Docs +20, Other +1. Total +594 across 55 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep account intent, transcript continuity, and process retirement with their existing owners, using the documented host cleanup capability and Doctor compatibility checks. Do we have a high-confidence way to reproduce the issue? Yes, at source level: deleting an explicit stored account reaches main's override-clearing branch, and the supplied regressions exercise cleanup and retry ordering. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. The patch repairs existing lifecycle owners and reuses their cleanup, credential, and transcript contracts; the coordinated host capability avoids a second cleanup implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9d64ec1e5dc6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
1b4b2e2 to
f5528d7
Compare
Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by #140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state.
Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
f5528d7 to
f3fa986
Compare
|
Merged via squash.
|
…nclaw#140973) * fix: preserve runtime ownership across auth and recovery paths Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by openclaw#140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state. * test(doctor): assert manual recovery for unreadable state Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
Related: #140973 ## What Problem This Solves Model validation can reject an existing native Codex login as an unavailable `openai:default` profile when OpenClaw has no stored OAuth account. Automatic model discovery also loses the native login's OAuth mode. ## Why This Change Was Made Pass the requested provider, explicit or preferred profile, and config to the existing scoped credential-discovery owner. The regression fixture now lets model resolution perform the first scoped lookup. ## User Impact Eligible native logins work during model discovery without being imported into the managed auth store. Prepared selections, managed account ownership, missing-profile errors, and stored API keys retain their existing policy. ## Evidence On pinned main `21ad735be2f44143bcd2f53ec2ffa8c128e5ede2`, this public command rejects the selected native profile; the candidate accepts it: ```sh pnpm openclaw config set agents.defaults.model.primary '"openai/gpt-5.4@openai:default"' --strict-json --dry-run ``` The isolated fixture uses the OpenClaw model runtime, the OpenAI plugin, a synthetic future-dated native login, and real SQLite state. A configured external alias also validates. The candidate passes 36 focused tests; the cleaned regression suite fails on the original production owner for the two native-discovery cases. Supplementary real-resolver checks observe default and alias OAuth selection and preserve prepared, managed, missing-managed, API-key, and non-OpenAI results. Shared auth rows and native-file hashes remain unchanged, with no agent-local credential copy. External networking is blocked. The network observer distinguishes loader Unix sockets from external requests. This proves offline discovery and validation. It does not claim a real provider login, model turn, token refresh, browser login, or macOS Keychain execution. Prepared-mode and selected-auth-mode assertions are supplementary boundary proof because the public command does not expose those fields. Complete private raw captures are retained; published excerpts omit fixture paths and credential material. Independent source-blind CLI checks cover native default, automatic selection, alias, managed refusals, stored keys, and invalid model input. Hidden auth-mode and implementation assertions remain separately reviewed source/boundary evidence. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: openclaw#140973 ## What Problem This Solves Model validation can reject an existing native Codex login as an unavailable `openai:default` profile when OpenClaw has no stored OAuth account. Automatic model discovery also loses the native login's OAuth mode. ## Why This Change Was Made Pass the requested provider, explicit or preferred profile, and config to the existing scoped credential-discovery owner. The regression fixture now lets model resolution perform the first scoped lookup. ## User Impact Eligible native logins work during model discovery without being imported into the managed auth store. Prepared selections, managed account ownership, missing-profile errors, and stored API keys retain their existing policy. ## Evidence On pinned main `c128afa34681ce5fe7c965de464888ebe0b7240b`, this public command rejects the selected native profile; the candidate accepts it: ```sh pnpm openclaw config set agents.defaults.model.primary '"openai/gpt-5.4@openai:default"' --strict-json --dry-run ``` The isolated fixture uses the OpenClaw model runtime, the OpenAI plugin, a synthetic future-dated native login, and real SQLite state. A configured external alias also validates. The candidate passes 36 focused tests; the cleaned regression suite fails on the original production owner for the two native-discovery cases. Supplementary real-resolver checks observe default and alias OAuth selection and preserve prepared, managed, missing-managed, API-key, and non-OpenAI results. Shared auth rows and native-file hashes remain unchanged, with no agent-local credential copy. External networking is blocked. The network observer distinguishes loader Unix sockets from external requests. This proves offline discovery and validation. It does not claim a real provider login, model turn, token refresh, browser login, or macOS Keychain execution. Prepared-mode and selected-auth-mode assertions are supplementary boundary proof because the public command does not expose those fields. Complete private raw captures are retained; published excerpts omit fixture paths and credential material. Independent source-blind CLI checks cover native default, automatic selection, alias, managed refusals, stored keys, and invalid model input. Hidden auth-mode and implementation assertions remain separately reviewed source/boundary evidence. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes cases where removing an explicitly selected model account silently changed the account used for a turn, internal recovery lost the original request, native handoffs rejected requests during replacement, or Claude reused a process before host-owned cleanup finished. Doctor could also inspect retired model credentials before importing legacy credentials, preventing the repair it was meant to perform.
Release verification exposed these failures alongside stale fixtures for plugin runtime services, Gateway removal, compaction, and Windows compiler scheduling. This carries the reviewed repairs to main independently of release preparation.
Why This Change Was Made
Keep ownership with the existing account-selection, session, process, plugin, and Doctor coordinators. Preserve explicit account selection through admission, retain durable request context during model-only retries, await canonical CLI cleanup, retain relay listeners through their locator handoff, and run credential migration before model-route repair. Plugin runtime construction preserves supplied lazy service descriptors and the existing Gateway SDK aliases.
The fixture repairs exercise the correct owners and public outcomes. Windows compiler sequences run serially on Windows; explicit concurrent-owner coverage, source/config invalidation assertions, and every deadline remain intact. The static plugin-loader inventory also names the canonical injected resolver owner introduced by #140667. Main already contains the equivalent Discord and permission-refresh fixture repairs.
User Impact
Users receive actionable missing-account recovery, retain their requests and completed work during retries, and avoid premature process replacement or migration-order failures. Exhausted long usage windows select eligible fallback promptly while temporary throttles retain bounded backoff. Workshop learning preserves one-time request scope and grounds recovery lessons in observed results.
Evidence
Current head is
f3fa986f09596b06f3193f22e9a9a8c198fa3f6f(treed403e469c3562a9b5f4715439809516e43bffbfa), based on pinned main6b54af7fc30c0b0399f08d8afca9e3d53f9844a8. This refresh incorporates the landed CI prerequisite repairs #141092/#141085 (Mermaid fixture ownership), #141137 (planner discovery reuse and CLI fixture startup), and #141139/#141148 (Telegram fixture line budget). The combined prerequisite CI for #141137 succeeded in run 34114761822.The only conflict was the permission-refresh fixture, independently fixed on main by #141020. The resolution keeps main's complete fixture, canonical session-list call, dynamic roster state, and existing permission assertions; those two browser cases pass and the resolution review is clean. All remaining code/test patch content is identical to the previous reviewed head
f5528d796a36ca85f4b7ddf0f9d1ea92a9d10c67. The Doctor documentation paragraph differs only in blank-line placement. The earlier schema-result, owned-updater guard, and manual-recovery decisions remain intact.Proof retained from the earlier reviewed checkpoints:
1b4b2e2980884488caf376075d639fc3c0f50fbc, full changed-file checks, all typecheck lanes, lint, dead-code and runtime-cycle checks, private-QA build, and UI asset budgets passed. Independent aggregate and incremental P2 reviews were clean.The earlier CI at merge
6be599c5f47a4913efc7558eff870d564454e6a4failed on the inherited Mermaid mock, planner growth workload, and a real-Gateway widget timeout. The first two have the landed prerequisites above. The unchanged widget source passed all 31 exact-tree cases on both macOS and Linux, plus five source-blind behavior checks; no widget patch is included. Current-head CI run 34136755589 completed successfully atf3fa986f09596b06f3193f22e9a9a8c198fa3f6f; required checks are green before native preparation.Two initial local QA cases timed out because staged runtime sources caused each repository CLI child to rebuild. A clean checkpoint and canonical private-QA build resolved that preparation issue without changing source, assertions, or deadlines. These are synthetic subprocess/Gateway proofs; full release and live-provider qualification remain separate.