Repository navigation
feat(doctor): report automations that will lose access or pause - #182328
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesAdds a read-only Doctor report identifying automations affected by conversation availability and scheduled-run access rules. Example: Automation job-1 is linked to the removed conversation agent:main:dashboard:parent.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR adds useful upgrade diagnostics, and both prior findings are addressed; no remaining actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor reads stored automation definitions, parent session facts, profiles, and configuration, then uses the scheduler's existing execution-context builder to produce advisory terminal output. flowchart TD
A[Doctor command] --> B[Stored automation inventory]
B --> C[Read parent and requester facts]
C --> D[Scheduled execution context builder]
D --> E[Classify access changes]
E --> F[Cron diagnostic output]
Technical reviewBest possible solution: Keep the advisory report on the existing scheduler decision owners and land it through the normal CI gates. Do we have a high-confidence way to reproduce the issue? This is a diagnostic feature; source inspection confirms the report is absent from fetched main, and no target code was executed during this read-only review. Is this the best way to solve the issue? The collector and formatter form a coherent addition using existing inventory, decoding, worker-read, and scheduler decision owners; the simplification review found no unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f19519868239. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +514, Tests +434, Docs +2. Total +950 across 7 files. Added test files: 2. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 24, 2026, 3:46 AM ET / 07:46 UTC (Revision 2). |
…les through the state worker
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…claw#182328) * feat(doctor): report scheduled jobs that lose access or pause * fix(doctor): keep the scheduled-run review advisory when the store cannot be read * docs(automation): describe Doctor's scheduled-run access review * fix(doctor): review main-target jobs, exempt command jobs, read profiles through the state worker
What Problem This Solves
Scheduled jobs linked to the conversation that created them now run with that conversation's authority and pause when it is gone, but nothing tells an operator which of their existing automations will lose access, pause, or stay unbound before it happens.
User Impact
openclaw doctor(with or without--fix) now prints a read-only "Scheduled-run access review" under Cron. It lists:The review writes nothing and sends nothing. It does not repair anything; the chat-type backfill is separate follow-up work.
Why This Change Was Made
The review reuses the same pieces occurrence admission uses:
scheduledParentLinkOf,parentRowFactsFromEntry,assembleScheduledAdmissionFacts, the purebuildScheduledExecutionContext, andcompareScheduledDecisionsfrom the legacy projection. Doctor reads stored jobs with the existing read-only inventory (inspectCronJobsForDoctor), decodes them with the runtime row codec, and reads each named parent withreadSessionEntryReadOnlyInWorker.Owner checks that admission does through Gateway-resident state are done read-only here:
isConfiguredCommandOwner; a linked channel operator or an operator-source snapshot needs the running Gateway, so the review marks those losses "could not verify" rather than callingprepareCommandOwnerAuthority, which can write an authorization reference.Shared-file change:
assembleScheduledAdmissionFactstakes an optionalcreatorRoleSandboxthat the caller already evaluated. Admission does not pass it and keeps its current behavior.Accepted limits: the CLI backend is resolved from config (payload model or agent default, then
resolveCliRuntimeExecutionProvider), not from a per-run session override. The chat-type check looks only at the parent row itself; a parent that is a spawned child is skipped because memory lineage resolves its root elsewhere. There is noopenclaw automations bindcommand yet, so unbound jobs are told to recreate the automation from its conversation.Evidence
Current-head unit tests (
node scripts/run-vitest.mjs run src/commands/doctor/cron/execution-context-report.test.ts src/commands/doctor/cron/execution-context-check.test.ts): 20 passed (including linked main-target pause and command-payload exemption regressions). One or more cases per category: loss with lost fields, unverified loss, sandbox loss, no-loss owner; pause for removed, archived, missing worktree with path; unbound key-only and reset; runtime owner (only owner contexts on a CLI backend); missing chat type (root vs typed vs spawned parent); undecodable stored authority; collector profile and role rules, role sandbox, configured channel owner, archived parent read withreadConsistency: "latest", malformed rows skipped; linked main-target pauses included, a failing parent read listed without aborting the review.pnpm tsgo:core,pnpm tsgo:core:test, oxlint and oxfmt on changed files: clean.Upgrade proof from v2026.10.6 (Crabbox, AWS)
CRABBOX_AWS_REGION=us-east-1 CRABBOX_CAPACITY_REGIONS=us-east-1,us-east-2,us-west-2 crabbox run --provider aws --timing-json --ttl 90m --idle-timeout 45m --label 0d5.15-doctor-proof-2 --download /tmp/0d5.15-out.tgz=... --shell -- "bash proof-0d5.15/remote.sh"(local-only proof scripts, not committed)60b92158a97e4b5ffc1291cfe1cef2695d1e813aworking tree synced to the lease; remotesha256sumof the four changed source files matches the local head; the remote build rebuiltdistfrom that source (dist is stale: missing_build_stamp).aws, leasecbx_30739e0cce29(c7a.8xlarge, us-east-1), runrun_b62ef4d054fde236e5d6640230543ace: https://crabbox.openclaw.ai/portal/runs/run_b62ef4d054fde236e5d6640230543ace. Exit 0. Lease released (CRABBOX_AWS_REGION=us-east-1 crabbox stop --provider aws --id cbx_30739e0cce29→released lease=cbx_30739e0cce29).Steps on the lease:
npm install [email protected]; its Gateway, on a fresh isolated state dir, creates five conversations (live, archived, removed, reset, managed worktree) and eight automations: six linked bysessionKey(two to the live parent, one with aclaude-cli/...model), and two unlinked (one with aclaude-cli/...model). It then archives, deletes and resets the matching parents, and the worktree directory is removed after the Gateway stops.openclaw doctor --fix --non-interactive --yes(the normal upgrade step), then plainopenclaw doctor --non-interactivetwice. Per-table content hashes of the state and agent databases are taken around each plain run.Observed review (identical in all three runs):
Allowed vs refused cases:
unlinked(no parent, embedded) produces no finding, whileunlinked-cli(no parent, CLI backend, owner context) is listed as a runtime difference.linked-cliis a loss but not a runtime difference, because its context owner is false, which already matches today's CLI runs. The live-parent jobs were created over the Gateway token, so they record no creator profile; under the design's rule an unknown requester is not an owner, which is why both show the owner-only loss.Read-only: in both plain runs no cron, session or profile table changed. On the first plain run after
--fix, one agent-databaseschema_metarow was added (in the local reproduction its key ishistorical-transcript-directives-v1), which Doctor's transcript migration owns and completes on its first run after an upgrade (unrelated to this check). The second run changed no table at all. The same results reproduced in a local run of the same script.Current-head readiness
ClawSweeper reviewed
60b92158a97e4b5ffc1291cfe1cef2695d1e813a: Ready for maintainer review, no actionable findings. The main-target exclusion is removed: main-target jobs report unavailable-parent pauses but not detached-context access changes. Command payloads honor the scheduler's no-pause exemption. Profile reads use the existing state-read worker; the mock-exports and database-worker ratchets pass. The new AWS proof above retested the final production source; remote hashes match all four changed production files. Current checks: 80 successful, 83 skipped, 1 neutral; none failing or pending. No production source changed after that proof. Lease inspection now reportsstate: released,cleanupStatus: complete, andprovisioningResourceMayExist: false.Static replay over the operator's stored state (online backups, no writes to live data): 105 jobs, no
gain-unexpected. Labels (jobs can have multiple): 101 equal, 11 gain-intended, 3 retarget, 7 ownerEmbedded losses, 4 pauses. All four pauses name archived parents. All seven ownerEmbedded losses are marked owner-check unverified by the offline replay: their linked requester needs live Gateway authority, so these are conservative predictions rather than proof that the creator is not an owner. Private job names and conversation identifiers are retained only in local evidence, not published here. This is the replay script's scope (it excludes main-target jobs); new main-target behavior is covered by the focused regression.