Skip to content

fix(doctor): name scheduled CLI jobs that need an explicit account - #195905

Merged
roboclaw-bot merged 5 commits into
mainfrom
roboclaw/qd-195887-cli-cron-diagnostics
Nov 9, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
roboclaw/qd-195887-cli-cron-diagnostics

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #195887

Related: #195879 owns the remaining gap where session-target run history hides the account refusal, along with its refusal/retry handling. This change leaves that work and the startup Codex runtime branch separate.

What Problem This Solves

Legacy scheduled CLI jobs that select a stored account receive no warning before their first refused run, while configured-key jobs receive a startup warning that Doctor cannot repair.

User Impact

Doctor and lint name each affected CLI job, runtime, model, selected profile, and exact adoption command. Startup provides the same guidance in a background scan that never blocks cron readiness or operations, with a five-second aggregate budget and one unchecked-job summary. Scheduled CLI jobs still require an explicit account choice; the suggested --model edit also sets the primary model. Claude CLI's explicit native-login alternative is included. Jobs on a selected configured key remain quiet.

Why This Change Was Made

A shared read-only auth preference uses the same matching default-model @profile and precedence as execution. Persistent session:<key> jobs retain their existing native resume identity despite configured expiry; detached runs keep their fresh-session policy. Startup uses the selected auth-source classification and inspects the initial inventory outside cron's operation queue. Account authority, scheduled refusal guards, and Doctor's model inheritance remain unchanged.

Evidence

  • Verified and fixed both QE2 findings: incompatible session pins now use the execution owner's compatibility decision without persisting repairs, and expiry/stop reaches the active diagnostic before its next session/catalog/auth preparation. Matching default @profile, pinned native-resume identity, and off-readiness startup behavior remain covered.
  • Red proof on the previous production head 900e84a9a5f77da745cb504eaacfd12c0ec09870: 1 Doctor regression failed / 17 passed, and 2 startup cutoff regressions failed / 1 passed. Fresh autoreview then found two additional false-warning paths; controls at 8740d60003cc reproduced both extra warnings in one startup test. Those findings are fixed: host routes reuse the filtered preference/store, and native-owned locked models stay outside host account diagnostics. The Codex exclusion condition is unchanged.
  • Final named-file run at 00b46383ee02bbb9ea138a397d61c6ff06101de7: 21 passed (18 Doctor, 3 CronService), --maxWorkers=1, bounded by timeout. Doctor 75.90s, CronService 41.66s including compilation; wrapper 120.28s. Only these two named test files ran locally.
  • Table-driven Doctor/lint controls cover stored-token warning, native silence, matching native/stored defaults, pinned native session, and incompatible persisted pin. Startup covers selected configured-key silence versus stored-profile references, locked-native silence, and both budget/stop using the deterministic scheduler and a held real session read. Load/list remain non-blocking; cutoff prevents later catalog preparation and late warnings. Initial jobs are checked once across repeated loads; persisted definitions/session facts stay unchanged. No real sleeps were added.
  • Touched-file oxlint/oxfmt, git diff --check, and normal hooks pass. pr-simplify removed duplicate preference consumption and redundant test setup. Whole PR: production +391 net lines, tests +199. Exact separate test allocation reduced 402 → 199 LF lines (203 fewer); shared scalar unchanged. The final three LF lines are the formatter-required wrap of the contextually typed fixture.
  • Final autoreview --mode branch --base 955d4a5a8f11cd5ba6a00c2c8c7dc45a228c8f9f --max-priority P2: scoped-clean, reviewed head 00b46383ee02bbb9ea138a397d61c6ff06101de7. All verified findings from the preceding review were fixed. Full diagnostic, execution/auth, pinned-session handoff, cron operation, scheduler, and async-work owners were included; no actionable P0–P2 findings. Default review budget unchanged.
  • CI typing repair at 8206a2190148ffbb14c3767d70caffde9172e4a1: the cutoff fixture now uses its existing CronStoredJob[] contract, fixing the inferred sessionTarget: string mismatch reported by check-test-types-core-5 at 00b46383ee02bbb9ea138a397d61c6ff06101de7. The complete parent-relative delta is the annotation/formatter wrap and exact allocation 196 → 199, with no cast, suppression, assertion or production change. Independent CLEAN review through P2 at the parent carries over to this type-only delta. The named startup file passes 3 tests / 11.96s (wrapper 13.63s), --maxWorkers=1; touched-file oxlint/oxfmt, diff checks and normal hooks pass. Full test-type compilation is deferred to exact-head CI.
  • Exact-head PR CI is the broad proof. Per the latest task order, only attachment to the pushed head is checked here; terminal CI results are not awaited.

Upgrade proof gap: The earlier isolated Testbox attempt exited 1 during legacy fixture setup, before current Doctor ran. The lease was confirmed stopped. A successful 2026.11.2-to-current real upgrade remains unproved; this is not an upgrade verdict. No inference or external delivery was attempted.

Reported by @brandonulrich

Work sessions

Linked for team reference; these sessions aren’t public.

Surface shared read-only CLI account diagnostics in Doctor, lint, and startup, and classify configured keys by selected auth source. Preserve scheduled account authority and native login ownership.

Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: L labels Nov 9, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds per-job CLI account recovery guidance to Doctor, lint, and startup while suppressing warnings for selected configured keys.

Example: The unbound job cli-inherited uses anthropic/claude-opus-4-6 through claude-cli with stored profile anthropic:default.

  • Before: Doctor and startup remain silent before the scheduled run refuses the missing account binding.
  • After: Diagnostics name the job and profile and suggest openclaw automations edit cli-inherited --model anthropic/claude-opus-4-6@anthropic:default.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and no discrete defect was found, but required upgrade compatibility proof remains incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Legacy scheduled CLI jobs fail without advance account-recovery guidance, while unrelated configured-key jobs receive ineffective Doctor advice.
Reason: The collaborator-authored direction repairs a demonstrated diagnostic contract without changing account policy; the linked issue's run-history expectation remains in the separate open PR.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it addresses a confirmed diagnostic gap on current main, preserves explicit account adoption, and introduces no definite code defect found in this review.

Priority: P1
Reviewed head: 03484ce65c2034d7df2a8e2474d4704af9d25a61

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Show fresh-state diagnostics and a 2026.11.2-to-candidate upgrade through the shipped Doctor, lint, and Gateway entry points with existing jobs, settings, and account choices preserved.
Agent review details

How this fits together

Doctor and Gateway startup inspect persisted automation definitions, session preferences, runtime routing, and credential selection to produce warnings; existing account owners retain adoption and execution authority.

flowchart TD
  A[Stored automation and session] --> B[Cron model and runtime selection]
  B --> C[Existing CLI account selector]
  C --> D[Shared read-only diagnostic]
  D --> E[Doctor and lint findings]
  D --> F[Gateway startup warning]
  B --> G[Existing scheduled execution guards]
Loading

Technical review

Best possible solution:

Use the existing selectors for accurate pre-run guidance while keeping adoption, native login, and scheduled execution authority with their current owners.

Do we have a high-confidence way to reproduce the issue?

Current-main skips, the stored-account CLI selector, scheduled refusal guards, and the reporter's release trace establish the failure path; this read-only review ran no target code.

Is this the best way to solve the issue?

The shared diagnostic is a focused repair using existing owners; run-history and retry behavior remain separately owned by #195879.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against be621d7b9ffa.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • RoboClaw: Raw commit d277de7 adds src/commands/doctor/cron/inference-binding-migration.ts:151 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d277de776de2; files: src/commands/doctor/cron/inference-binding-migration.ts)
  • Ayaan Zaidi: Raw commit 3114e87 adds src/commands/doctor/cron/inference-binding-migration.ts:331 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3114e87f42b3; files: src/commands/doctor/cron/inference-binding-migration.ts)

PR surface

Source +163, Tests +144, Docs +6, Other +2. Total +315 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 234 71 +163
Tests 2 217 73 +144
Docs 2 10 4 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 10 463 148 +315

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P1: The reported stable-release upgrade leaves existing scheduled CLI jobs failing while the advertised readiness checks omit their recovery instructions.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P1: The reported stable-release upgrade leaves existing scheduled CLI jobs failing while the advertised readiness checks omit their recovery instructions.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the installed-release upgrade scenario and publish redacted diagnostic output with before/after state-preservation results.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 9, 2026, 5:52 AM ET / 10:52 UTC.

Share matching default-profile preferences with execution, preserve pinned native sessions, and inspect the loaded inventory off the cron readiness path with one aggregate deadline.

Co-authored-by: steipete <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL and removed size: L labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 8206a2190148ffbb14c3767d70caffde9172e4a1
  • Maintainer: @roboclaw-bot
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/auth-profiles/selection-preference.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/session-override.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@roboclaw-bot
roboclaw-bot merged commit b9d66a0 into main Nov 9, 2026
137 of 138 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/qd-195887-cli-cron-diagnostics branch November 9, 2026 12:46
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…penclaw#195905)

After upgrading, legacy scheduled automations on a CLI runtime whose run would select a stored account were refused on first run, while Doctor, doctor --lint and the startup check stayed silent. Doctor/lint and startup now share the CLI account selector and name each such job with the exact `openclaw automations edit <id> --model <model>@<profile>` command; native-login jobs stay silent. Startup no longer warns for jobs whose selected source is a configured key, and its diagnostic runs off the cron readiness path with an aggregate time budget. Diagnostics only: no account adoption, and scheduled-account refusal guards are unchanged. Docs qualified.

Fixes openclaw#195887

Co-authored-by: steipete <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: XL

Projects

None yet

1 participant