Repository navigation
fix(doctor): classify command-payload cron jobs as non-tool-bearing in the scheduled authority check - #166384
Conversation
Reuse cron's tool-runtime classifier so retained account policies on command jobs do not produce an unrepairable Doctor warning. Preserve dormant policy and keep checks for agent turns and condition scripts. Update the recovery hint to the current automation CLI and authenticated recreation path. Fixes #166242. Supersedes #166260. Thanks to @jayzhou2309 for the original patch and @davidchyi-beep for the report. Co-authored-by: Jay Zhou <[email protected]>
|
🦞👀 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 October 6, 2026, 10:01 PM ET / October 7, 2026, 02:01 UTC. ClawSweeper reviewWhat this changesDoctor reuses cron’s tool-runtime classification to stop authority warnings for command jobs without condition scripts, preserves their stored restrictions, and updates recovery guidance. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused fix: current main and the latest release still produce the false warning. No introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherDoctor inspects stored automation jobs and reports authority problems to operators. Cron’s shared classifier determines which jobs use agent tools, while the scheduler retains ownership of execution permissions. flowchart TD
A[Stored automation jobs] --> B[Doctor inspection]
B --> C[Shared tool-runtime classifier]
C --> D[Uses agent tools]
C --> E[Tool-free command]
D --> F[Validate scheduled authority]
F --> G[Operator diagnostics]
E --> H[Preserve dormant restriction]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -8, Tests +39, Docs +4. Total +35 across 5 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use one shared tool-runtime classifier for Doctor and cron while retaining dormant account ceilings and existing execution checks. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main and v2026.9.8 report any retained policy on a command job without a condition script as invalid. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Reusing cron’s existing classifier removes competing diagnostic logic without rewriting permissions or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ae568e850a6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…n the scheduled authority check (openclaw#166384) Closes openclaw#166242 Supersedes openclaw#166260 Reported by @davidchyi-beep. Co-authored-by: Jay Zhou <[email protected]>
Closes #166242
Supersedes #166260
What Problem This Solves
Fixes: Doctor repeatedly reports invalid scheduled authority for a command cron job that retains an account policy, then suggests a tool-cap edit that cannot clear the warning.
User Impact
Command jobs without a condition script no longer receive an agent-tool authority warning. Agent turns, script payloads, and command jobs with condition scripts still receive the existing checks. Stored account restrictions and execution permissions remain unchanged; no migration, schema change, or new option is required during updates.
Why This Change Was Made
Doctor had its own tool-runtime classifier and treated any retained policy on a tool-free job as invalid. It now uses
cronJobUsesToolRuntime, the same classifier used by cron reconciliation. A retained account policy stays dormant until the job uses tools again. The repair hint for genuinely tool-bearing jobs now names authenticated recreation or an explicit tool-cap replacement from a trusted operator shell usingopenclaw automations edit.Thanks to @davidchyi-beep for the detailed report and @jayzhou2309 for the original patch and regression direction. This replacement removes the duplicate classifier instead of adding a Doctor-only dormant-policy exception.
Evidence
invalidScheduledToolPolicyJobs: ["Command"]; restoring the candidate passes 12/12. It also verifies that agent turns and command jobs with condition scripts still warn when authority is missing, and that the dormant account policy is preserved.node scripts/check-changed.mjspassed completely, including production types, all 27 test-type graphs, lint, and guards. Final line-cap, formatting, andgit diff --checkchecks passed.Commands used (all with an isolated
OPENCLAW_STATE_DIR):Single-file cost, using the repository wrapper equivalent of
pnpm test src/commands/doctor/cron/scheduled-tool-policy-migration.test.ts --maxWorkers=1: 12/12 passed in 128.24s wall time, including 91.6s of shared worker preparation; Vitest reported 99% transform time and the new regression took 3ms. CI timing is pending at authoring handoff.Pre-existing integration costs were recorded without changing those suites:
doctor/cron/index.test.ts177.34s summed case time;doctor-config-flow.cron-owners.test.ts320.80s (maximum case 38.01s);doctor/cron/legacy-repair.test.ts163.50s (maximum case 30.40s);cron/store.readonly-worker.test.ts71.80s;cron/isolated-agent/run.tools-allow.test.ts83.89s, including 60.74s for the first accountless-legacy case. These exercise the existing full Doctor/store and isolated-agent fixtures.P1 Codex autoreview was attempted but could not start: its isolation preflight rejected the temporary-directory location even with
TMPDIR,TMP, andTEMPunset. No review verdict was produced; maintainer review of this head is still needed.Production: +13/-21 lines. Tests: +40/-1 lines. Docs: +4/-0 lines. Auto-merge remains off.
Co-authored-by: Jay Zhou [email protected]