Skip to content

fix(doctor): show progress while checks and repairs run - #178767

Merged
steipete merged 1 commit into
mainfrom
upd/l1732-progress
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/l1732-progress

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw doctor --fix can spend minutes checking or repairing state without showing which section is running.

Fixes #154636.

User Impact

Doctor prints each section as it starts and repeats its name with elapsed time every 10 seconds while work remains pending. Progress goes to stderr; JSON remains free of human progress output.

Why This Change Was Made

The existing Doctor heading owner now owns the phase timer. The contribution and repair runners report their existing boundaries, including check, repair, and validation. Startup, backup, migration, config, and final cleanup sections use the same output. The delayed config-preflight spinner and its obsolete prompt-cleanup callback are removed. Existing preparation stays in the startup owner, preserving operation order and keeping the flow within its line budget.

Supersedes #175719, thanks @MoerAI.

Evidence

  • The new regression failed on the unchanged base because stderr contained no phase line. Both human and JSON cases now pass, including the 10-second heartbeat and timer cleanup.

  • Production and touched-test TypeScript checks, touched-file oxlint/oxfmt, git diff --check, and madge passed (0 import cycles). The final independent Codex review reported no actionable P0–P2 findings.

  • Isolated live repair passed with exit 0:

    HOME="$PWD/.artifacts/progress/baseline-home" \
    OPENCLAW_HOME="$PWD/.artifacts/progress/baseline-home" \
    OPENCLAW_STATE_DIR="$PWD/.artifacts/progress/live-state" \
    OPENCLAW_CONFIG_PATH="$PWD/.artifacts/progress/live-state/openclaw.json" \
    OPENCLAW_GATEWAY_PORT=27632 OPENCLAW_SERVICE_REPAIR_POLICY=external \
    TMPDIR="$PWD/.artifacts/tmp" \
    pnpm openclaw --profile progress-proof doctor --fix --non-interactive

    This used synthetic config/state and emitted 150 stderr progress lines, including Doctor: contributions (10s elapsed), then reached Doctor complete.

  • The 109-file importing-consumer replay completed: 1,036 tests passed, 12 were already skipped, and one fixture failed. That fixture globally pretended to be Linux while using real macOS SQLite locks, making its own owner look foreign. It now uses the existing host-preserving service-platform test helper; its failed case and following case both passed on the focused rerun (2 passed, 37.7s test time). No ownership assertion was weakened. The packaged Doctor JSON E2E case passed.

  • Consumer command: node scripts/run-vitest.mjs <the 109 files selected with rg -l for the changed owner basenames> --maxWorkers=1, with isolated HOME/state and a private macOS TMPDIR/XDG_CACHE_HOME. The focused fixture rerun passed with the same strict ownership assertions.

  • Local setup evidence: the first runtime build took 7m22s; the replay build took 3m07s. These are preparation costs, not test times. SQLite staging rejected the group-writable external-volume ancestor during the first replay; the final replay uses an owned private temporary/cache directory while keeping the exported HOME and state isolated. An initial unchanged tooling run also encountered a native source-scanner SIGILL and an empty-selection assertion; a later pass is not claimed as a fix for those intermittent tooling failures.

  • Full check:changed/SQLite inventory was omitted under the lane's local gate budget; PR CI remains the broad check.

Production: +333/-220 (net +113); tests: +95/-11 (net +84); docs: +4. The added production lines provide the phase boundaries and timer; the superseded spinner and prompt-cleanup callback were removed.

Pre-existing slow integration proof

The tooling file took 129s; the infrastructure group took 1,034s and the Doctor command group 1,869s. These suites repeatedly run full Doctor, config-write, snapshot, and archive fixtures. No timeout or assertion was relaxed. Notable individual passing cases:

Existing case Time
Legacy composition: July upgrade with explicit local model 67.1s
Managed admission: archive verification 42.2s
Doctor config receipt: restored config 41.2s
Fleet preflight: relocated-copy quarantine 38.5s
Missing-state Doctor E2E 37.7s
Managed admission: clean stopped repair 37.0s
Billing route: package-swap run-id/result-channel deferral 31.0s / 30.6s
Managed admission: force repair 30.7s

These existing fixture costs are recorded for the separate testing-performance follow-up.

@clawsweeper

clawsweeper Bot commented Oct 20, 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 commands Command implementations size: L labels Oct 20, 2026
@steipete
steipete marked this pull request as ready for review October 20, 2026 20:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T20:50:06.503782Z b874b54 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b874b54eb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

root,
outro: showDoctorOutro,
});
const admission = await measure("doctor.maintenance-admission", () =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop progress updates before waiting at interactive prompts

In the default interactive openclaw doctor flow, this wrapper remains active while prepareDoctorInteractiveMaintenance waits for update and maintenance confirmations. If the operator takes more than 10 seconds, the interval writes raw lines to stderr over the active Clack prompt every 10 seconds, disrupting or corrupting the prompt display; the same problem occurs for workspace-alias and capability-consent prompts wrapped by the new progress scopes. Pause or end progress reporting before entering interactive prompt code.

Useful? React with 👍 / 👎.

@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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR adds section-start messages and 10-second elapsed-time updates to Doctor’s checks and repairs.

Example: A human-output Doctor contribution remains pending for 10 seconds.

  • Before: The contribution runs without identifying the pending work.
  • After: Stderr identifies the section and then prints an elapsed-time update.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-approved reporting with real non-interactive CLI evidence, but the verified interactive prompt regression blocks merge.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied isolated Doctor CLI run exercises non-interactive section output and a heartbeat through completion.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Long Doctor runs appear stalled because users cannot identify the pending checks or repairs.
Reason: The linked issue contains explicit maintainer approval for progress reporting, and this maintainer-authored PR keeps timeout and skip policies outside its scope.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: it addresses the maintainer-approved Doctor reporting gap that remains on main.

Priority: P2
Reviewed head: b874b54eb3f8b7c01110035752162a0fb14450fe

Before merge

  • Pause all active progress timers while interactive prompts await input (P2) - Running interactive openclaw doctor and leaving the maintenance confirmation unanswered for more than 10 seconds causes this scope’s interval to write raw progress lines into the active Clack prompt. Config-flow, capability-consent, workspace-alias, and contribution prompts can likewise remain enclosed by active progress scopes; removing the former workspace beforePrompt callback also removes its existing protection. Coordinate prompt entry and exit with the shared progress owner so all enclosing heartbeats pause during input, rather than stopping only an innermost timer. This confirms the existing concern at fix(doctor): show progress while checks and repairs run #178767 (comment).
  • Explain or restore the original intent of Workspace prompt coordination - 6e45510: The base explicitly calls progress.done before workspace confirmation; removing that coordination leaves the replacement and enclosing timers active.

Findings

  • [P2] Pause all active progress timers while interactive prompts await input — src/flows/doctor-health.ts:188-195

Provenance

  • Workspace prompt coordination changes intended behavior without addressing why it exists (6e45510: The base explicitly calls progress.done before workspace confirmation; removing that coordination leaves the replacement and enclosing timers active.)

Tests

  • Missing end-to-end proof: The supplied non-interactive CLI run does not cover leaving an interactive confirmation open across a heartbeat interval.
Agent review details

How this fits together

Doctor orchestrates maintenance admission, backups, config preparation, health checks, repairs, and cleanup; the change reports these existing boundaries to stderr while suppressing progress in JSON mode.

flowchart TD
  A[Doctor CLI] --> B[Maintenance and preparation]
  B --> C[Config flow]
  C --> D[Health contributions]
  D --> E[Check repair validation]
  B --> F[Doctor progress owner]
  C --> F
  D --> F
  E --> F
  F --> G[Human stderr]
Loading

Technical review

Best possible solution:

Coordinate the existing Doctor progress owner with interactive prompts so enclosing heartbeats pause during operator input and resume afterward.

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

Current-main source establishes the silent structured-check path, and the introduced wrappers establish heartbeat writes during pending confirmations; no target code was executed in this read-only review.

Is this the best way to solve the issue?

Reporting at the existing execution owners is a focused solution, provided progress yields the terminal to the existing prompt owner.

Full review comments:

  • [P2] Pause all active progress timers while interactive prompts await input — src/flows/doctor-health.ts:188-195
    Running interactive openclaw doctor and leaving the maintenance confirmation unanswered for more than 10 seconds causes this scope’s interval to write raw progress lines into the active Clack prompt. Config-flow, capability-consent, workspace-alias, and contribution prompts can likewise remain enclosed by active progress scopes; removing the former workspace beforePrompt callback also removes its existing protection. Coordinate prompt entry and exit with the shared progress owner so all enclosing heartbeats pause during input, rather than stopping only an innermost timer. This confirms the existing concern at fix(doctor): show progress while checks and repairs run #178767 (comment).
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Config-preflight progress changes intended behavior with a stated reason (66dc9d1: The earlier progress wrapper made long migrations visible and preserved machine-readable output.)
  • Ordered contribution and repair execution keeps the original intent (1ae0dfe: The contribution split preserved registry order, lazy boundaries, repair ownership, and config-write sequencing; the new reporting retains those execution contracts.)
  • Startup repair and original-capture contracts keeps the original intent (fix(doctor): preserve old schemas when retired state blocks repair #170051: Admission must precede mutation, and admitted schema preparation must precede deletion-journal recovery; the moved code and reporting wrappers preserve that order and existing authority forwarding.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/flows/doctor-health-contributions.availability.test.ts src/commands/doctor-prompter.test.ts --maxWorkers=1
  • pnpm test src/commands/doctor-workspace-alias.test.ts src/flows/doctor-health-contributions.cancellation.test.ts --maxWorkers=1
  • Exercise isolated interactive Doctor with a confirmation pending beyond 10 seconds, then answer and verify reporting resumes.
  • git diff --check

What I checked:

PR surface

Source +113, Tests +84, Docs +4. Total +201 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 333 220 +113
Tests 4 95 11 +84
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 432 231 +201

Review metrics

Metric Value Why it matters
Production versus test changes Production +333/-220; tests +95/-11 Growth supplies the shared timer and existing phase boundaries, with preparation moved into its startup owner and the superseded spinner removed.

Root-cause cluster

Relationship: same_root_cause
Canonical: #154636
Summary: This PR implements the canonical Doctor progress request and explicitly replaces the earlier contributor implementation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: Doctor’s silent work creates recoverable user confusion; the introduced prompt-display defect has a bounded interactive impact.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Doctor’s silent work creates recoverable user confusion; the introduced prompt-display defect has a bounded interactive impact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 October 20, 2026, 5:03 PM ET / 21:03 UTC.

@steipete
steipete merged commit c6f14b2 into main Oct 20, 2026
209 of 214 checks passed
@steipete
steipete deleted the upd/l1732-progress branch October 20, 2026 22:54
roboclaw-bot added a commit that referenced this pull request Oct 20, 2026
Repair the inherited check-lint-core-2 failure from #178767 without changing creator attribution. Bind the direct HealthCheck repair method to its check so it retains the pre-progress receiver. A new regression fails before this fix; 11 Doctor tests and type-aware lint pass. Independent P0-P2 review found no actionable issues.

Co-authored-by: VACInc <[email protected]>
roboclaw-bot added a commit that referenced this pull request Oct 20, 2026
Bind the captured repair method to its owning health check before the progress callback invokes it. Preserve arguments, asynchronous results and existing error handling. Add a receiver-dependent regression that fails before the repair. Resolves the inherited unbound-method CI error from #178767 without changing compaction behavior.

Co-authored-by: VACInc <[email protected]>
steipete added a commit that referenced this pull request Oct 20, 2026
The progress wrapper added in #178767 extracted HealthCheck.repair without its receiver. Bind it to the check and exercise a raw receiver-dependent check through the existing repair-flow table. Restores config carry and change output without changing progress, dry-run, or repair validation.
roboclaw-bot added a commit that referenced this pull request Oct 21, 2026
* feat: attribute delegated work to the initiating human

Co-authored-by: VACInc <[email protected]>

* fix: retain initiating creator for agent-created tasks

Apply opt-in causal creator attribution to operator-tool session creation without changing the selected execution identity or live authority checks. Prove creation, creator effects, and revocation through the authenticated Gateway.

Co-authored-by: VACInc <[email protected]>

* test: repair creator branch CI fixtures

Observe native receipts before waiting for retirement readiness, and assert agent-resolution context through the existing error message.

Co-authored-by: VACInc <[email protected]>

* test: await transcript indexing in PostgreSQL fixture

Queue the fixture transcript explicitly after broad synchronization so an in-flight memory-only watcher pass cannot leave the lexical transcript assertion racing the session debounce.

Co-authored-by: VACInc <[email protected]>

* fix: give initiating humans creator controls by default

Remove the unshipped Labs toggle and experimental config. Preserve execution authority and the original isolation identity while applying causal creator attribution to new delegated work. Exercise default behavior and capture authentic requester facts in guest boundary fixtures.

Co-authored-by: VACInc <[email protected]>

* fix(doctor): preserve repair method receiver during progress

Repair the inherited check-lint-core-2 failure from #178767 without changing creator attribution. Bind the direct HealthCheck repair method to its check so it retains the pre-progress receiver. A new regression fails before this fix; 11 Doctor tests and type-aware lint pass. Independent P0-P2 review found no actionable issues.

Co-authored-by: VACInc <[email protected]>

* test: distinguish causal creators in gateway fixtures

Supply authenticated request origins in human-initiated creation fixtures and retain agent attribution for autonomous cron calls without changing runtime permissions.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
)

Fixes openclaw#154636. Doctor now prints a stderr phase line as each check/repair section starts (through the existing heading owner) and an elapsed-time heartbeat every 10 seconds for long sections. Progress is off for JSON output and never touches stdout; timers are cleared on completion or failure. Supersedes openclaw#175719, thanks @MoerAI.

Co-authored-by: MoerAI <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
The progress wrapper added in openclaw#178767 extracted HealthCheck.repair without its receiver. Bind it to the check and exercise a raw receiver-dependent check through the existing repair-flow table. Restores config carry and change output without changing progress, dry-run, or repair validation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
* feat: attribute delegated work to the initiating human

Co-authored-by: VACInc <[email protected]>

* fix: retain initiating creator for agent-created tasks

Apply opt-in causal creator attribution to operator-tool session creation without changing the selected execution identity or live authority checks. Prove creation, creator effects, and revocation through the authenticated Gateway.

Co-authored-by: VACInc <[email protected]>

* test: repair creator branch CI fixtures

Observe native receipts before waiting for retirement readiness, and assert agent-resolution context through the existing error message.

Co-authored-by: VACInc <[email protected]>

* test: await transcript indexing in PostgreSQL fixture

Queue the fixture transcript explicitly after broad synchronization so an in-flight memory-only watcher pass cannot leave the lexical transcript assertion racing the session debounce.

Co-authored-by: VACInc <[email protected]>

* fix: give initiating humans creator controls by default

Remove the unshipped Labs toggle and experimental config. Preserve execution authority and the original isolation identity while applying causal creator attribution to new delegated work. Exercise default behavior and capture authentic requester facts in guest boundary fixtures.

Co-authored-by: VACInc <[email protected]>

* fix(doctor): preserve repair method receiver during progress

Repair the inherited check-lint-core-2 failure from openclaw#178767 without changing creator attribution. Bind the direct HealthCheck repair method to its check so it retains the pre-progress receiver. A new regression fails before this fix; 11 Doctor tests and type-aware lint pass. Independent P0-P2 review found no actionable issues.

Co-authored-by: VACInc <[email protected]>

* test: distinguish causal creators in gateway fixtures

Supply authenticated request origins in human-initiated creation fixtures and retain agent attribution for autonomous cron calls without changing runtime permissions.

Co-authored-by: VACInc <[email protected]>

---------

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

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: openclaw doctor --fix takes too long with no progress indication

1 participant