Repository navigation
fix: recover automations from deleted accounts with configured keys - #205592
Conversation
Co-authored-by: daniel-lxs <[email protected]>
Worked on by: - @daniel-lxs Co-authored-by: daniel-lxs <[email protected]> OpenClaw-Publication: 6c8fb229-2d87-4e9b-9db8-68f0e7f410d9
|
🦞👀 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. What this changesThis PR lets explicit model edits release deleted automation-account bindings onto configured keys and supplies recovery commands that work online. Example: An automation bound to deleted account openai:retired is edited to openai/gpt-4.1 with OPENAI_API_KEY configured.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides focused recovery for a deleted-account failure that current main still retains; source review found no discrete correctness defect. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway validates automation edits, the credential owner establishes account availability, the route planner selects authentication, and the scheduler persists the resulting binding for subsequent inference. flowchart TD
A[Automation model edit] --> B[Gateway admission]
B --> C[Credential lifetime owner]
C --> D[Authentication route planner]
D --> E[Scheduler job persistence]
E --> F[Manual or scheduled inference]
Technical reviewBest possible solution: Retain the narrow explicit recovery path through the existing credential, route-planning, and scheduler mutation owners. Do we have a high-confidence way to reproduce the issue? The linked report describes real scheduled failures, and current-main source independently shows plain-model edits retaining the retired binding that same-provider execution requires; this review executed no target code. Is this the best way to solve the issue? The implementation fixes the edit boundary using existing owners, preserves intentional account continuity, and introduces no competing persistence path or new option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1bc412fb7478. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +51, Tests +69, Docs +10. Total +130 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (1 earlier review cycle)
Reviewed November 25, 2026, 6:18 PM ET / 23:18 UTC (Revision 2). |
Co-authored-by: daniel-lxs <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #205579
What Problem This Solves
After an automation's saved inference account is removed, editing it to a plain model reports success but leaves the deleted account bound. The next run fails even when a fresh job on that model works with the configured API key. The recovery message also recommends an account-listing command that refuses to run while the Gateway is online.
User Impact
An explicit plain-model edit can recover a deleted-account job onto an environment or provider-config key without recreating the job. Available accounts remain bound, including personal accounts. Unrelated edits and clearing the model override do not release the binding.
Recovery refuses another stored account or a missing credential instead of silently switching accounts or accepting a broken edit. Choosing a stored account still requires
model@profile, and same-provider recovery cannot change the recorded runtime. Both account-error messages now point toopenclaw gateway call models.authStatus. The deleted-account error also showsopenclaw automations edit <jobId> --model <provider/model>for recovery onto an environment or provider-config key.Why This Change Was Made
I kept the intentional account continuity introduced by #172590 and scoped recovery to an explicit edit after account removal. I reused the credential authorization owner, the existing route planner and the existing binding-clear operation. There is no new setting, schema, migration or automatic fallback.
Compatibility:
CronStoredJob.inferenceBindingremains optional and its representation is unchanged. The existingsrc/cron/store/job-mutations.tsupdate path already deletes that field for an explicitly validatednullbinding, as used for native-login adoption. This change reuses that operation; it does not rewrite jobs on load or upgrade. The regression tests reopen the persisted job, and the separate Gateway run retained the existing job ID, schedule and history. I did not run an upgrade rehearsal.I also updated the account-recovery documentation.
Evidence
d8fc8b7a5390is described in Automations cannot recover from a deleted account using an existing static key #205579. I used that supplied reproduction rather than starting another Gateway.aecbf92d24e54dd24f3c93299209404f53f72367: all six failed for the expected behavior. The environment/config-key cases kept the deleted binding, the unsafe/no-credential edits incorrectly reported success, and both execution paths printed the offline-only hint.git diff --checkpassed.pr-simplifyauthor pass before final verification. The change reuses existing owners without a new recovery abstraction or test-only production seam. Delta against main: production +51 lines, tests +69 lines, docs +10 lines. The guidance change extends the existing error and its two execution-path regressions; the simplification pass required no extra helper or test scaffold.git diff --checkpassed again.Focused test command:
External runtime verification
The separately supplied runtime check passed on
aec99054cb5facross four isolated Gateways, usingOPENAI_API_KEYin some andmodels.providers.openai.apiKeyin others.On main, removing the bound account and making a plain-model edit left both the manual run and the next scheduled run failing on the deleted account. With the PR, both runs succeeded on the static key. The job ID, schedule and history were preserved; a valid binding survived a plain edit; explicitly selecting another shared account worked; and adopting a personal account was refused.
I did not run those Gateways myself. The runtime logic is unchanged from that verified commit; the final delta adds only the plain-model recovery example and its assertions.
Not verified: rendered final-head error capture or real-provider billing. Final-head CI is green for
c5b972de41ca526f0ec5844096b6240b73975a05, includingopenclaw/ci-gate, dependency review and security-sensitive review. ClawSweeper reviewed this exact head: ready for maintainer review, no findings and no before-merge items. Its remaining proof note asks for inspectable sanitized output from the separately run Gateways and a shipped-entry-point capture of the final diagnostic; those artifacts are not attached.Contributor credit: reported and requested by Dan Riccio.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by
🦞 Made with OpenClaw