Skip to content

fix: explain update refusals when an agent database is in use - #152976

Merged
fuller-stack-dev merged 8 commits into
mainfrom
openclaw/doctor-lease-refusal-152914-1501
Sep 21, 2026
Merged

fuller-stack-dev merged 8 commits into
mainfrom
openclaw/doctor-lease-refusal-152914-1501

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Related: #152914

What Problem This Solves

An update refused because an agent database is in use loses its useful refusal reason in the public failure report.

User Impact

Operators receive a fixed explanation and retry guidance instead of a generic Doctor failure. Unsafe maintenance still refuses, private lease details remain redacted, and existing resource release and service restoration behavior is preserved.

This PR fixes refusal reporting. It does not claim to diagnose or resolve the original macOS incident in #152914.

Why This Change Was Made

Classify the real typed lease refusal at Doctor admission, carry the safe fact through the existing Doctor result and update finalization path, and allow only the exact public code and guidance through redaction. External-service preflight can only refuse; an empty or failed observation cannot authorize repairs and still requires both coordinators and the held-owner check.

Current-main integration preserves awaited coordinator acquisition and the existing service owner. A macOS test expectation now matches the canonical service policy: a loaded launchd job is not offline merely because it is disabled.

Evidence

  • Production candidate b234aa53d5c15b78c97197414569243592ad1212: 209 focused tests passed across Doctor flow, maintenance settlement/installation, public identifiers, and redaction.
  • Fresh independent review of the final production/test delta is scoped-clean at P0–P2.
  • Two genuine built-CLI lease-refusal cases passed (external preflight and held-owner admission): exit 1, exact safe typed IPC fact, unchanged config/state database hashes, and active lease retained. The child used only disposable synthetic state; no native service or live Gateway was changed.
  • Full local build and both changed-file static-check runs passed (types, lint, formatting, unused-export scans and repository guards).
  • CI run 35572588091 exposed an inherited Codex elicitation test race: it inspected a prompt after answer waiting started but before delivery. Follow-up 6a4dd2f84901a987d97a3c1867789a0e38cadb30 adds one wait on actual prompt delivery; all pending/answer assertions remain. Its 26 targeted tests and independent P0–P2 review passed. No production/package inputs changed, so the prior build and built-CLI proof remain applicable. The resulting exact-head CI run 35573749019 completed successfully. Dependency and security-sensitive reviews also passed.

Compatibility and bounded acceptance

No schema, migration, backfill, retention, protocol field, or database write-admission change is introduced. The existing Doctor failure-fact contract is reused. The lease reader opens the existing database read-only, never repairs its schema or deletes stale rows, and the held-owner assertion still checks it before repairs.

Historical published 2026.9.4-driver evidence established actual candidate-child refusal, unchanged synthetic state and config, and continued service availability. That older parent does not support typed failureFacts; its nonzero/stderr result is not typed-parent evidence. Historical rollback-verification timeout (52,991 ms) and backup-retention exit 1 (84,668 ms) remain unresolved in the broader updater investigation, not established regressions introduced by this reporting delta. This PR does not claim end-to-end update recovery, no-loss, global descriptor history, or native-service acceptance from source tests.

The landing assessment scopes those broader investigations separately. Resulting-source review, affected real-state flow tests, built-CLI refusal/IPC proof, unchanged main-owned restoration code, and exact-head CI establish the bounded reporting change; no live operator Gateway or retained investigation fixture is used.

@clawsweeper

clawsweeper Bot commented Sep 19, 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 commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 19, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 19, 2026 15:07
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 6a4dd2f84901a987d97a3c1867789a0e38cadb30
  • Maintainer: @fuller-stack-dev
  • Repository role: maintain

These security sensitive changes were made:

  • src/logging/diagnostic-support-redaction.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.

@fuller-stack-dev fuller-stack-dev self-assigned this Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 4:11 AM ET / 08:11 UTC (Revision 11).

ClawSweeper review

What this changes

The PR gives busy agent-database refusals a specific, privacy-safe update explanation, adds early diagnostic detection, and strengthens refusal and test-synchronization coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful reporting fix absent from current main. No introduced correctness or security defect was found; the previous generic migration-proof blocker is unsupported by the actual diff.

Priority: P2
Reviewed head: 6a4dd2f84901a987d97a3c1867789a0e38cadb30

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable reporting fix with meaningful boundary coverage, recorded CLI observations, and successful exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor gate does not apply to this MEMBER-authored PR. Its body nevertheless records built-CLI proof of both changed refusal paths, safe IPC output, and unchanged synthetic state; no material authority transfer requires an additional proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor gate does not apply to this MEMBER-authored PR. Its body nevertheless records built-CLI proof of both changed refusal paths, safe IPC output, and unchanged synthetic state; no material authority transfer requires an additional proof gate.
Evidence reviewed 11 items Introduced scope and proof continuity: Reviewed the pinned merge-base-to-head delta. The final commit adds only a wait for actual elicitation prompt delivery; production inputs are unchanged from the recorded built-CLI proof candidate. The supplied stale test merge was not used to infer removal of main behavior.
Diagnostic observation preserves admission: The external preflight can only refuse. Empty or failed observations do not grant authority: maintenance still acquires both coordinators and performs the held-owner lease assertion before repair. Typed lease errors become fixed diagnostic facts; unrelated failures retain their existing classification.
No persisted-model change: The extracted reader retains the existing read-only database opening, schema-read admission, stale-process predicate, and handle cleanup. It neither changes schema nor deletes lease rows. The previous review's generic migration requirement therefore does not apply to this delta.
Findings None None.
Security None None.

How this fits together

Doctor establishes exclusive maintenance access before repairing OpenClaw state. Its failure results pass through the updater into sanitized operator and public reports.

flowchart TD
  A[Update or Doctor request] --> B[External-service lease preflight]
  B -->|Active lease| E[Safe refusal fact]
  B -->|Otherwise| C[Acquire maintenance coordinators]
  C --> D[Check leases under ownership]
  D -->|Active lease| E
  D -->|Admitted| F[Existing Doctor repairs]
  E --> G[Updater result and sanitized report]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +70, Tests +402. Total +472 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 105 35 +70
Tests 6 418 16 +402
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 523 51 +472

Review metrics

Metric Value Why it matters
Production versus test growth Production +70 net lines; tests +402 net lines Production growth isolates refusal classification while reusing existing admission and reporting owners; most growth covers preservation and failure boundaries.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-agent-lease-refusal.ts, migration/backfill/repair: src/commands/doctor-maintenance.ts, migration/backfill/repair: src/state/openclaw-agent-db-lease.ts, unknown-data-model-change: src/commands/doctor-agent-lease-refusal.ts, unknown-data-model-change: src/commands/doctor-maintenance.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep lease refusal classification at Doctor admission and carry its fixed public explanation through the existing updater result and redaction owners.

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

Yes, source establishes the path: a live agent lease causes maintenance refusal, and current main's generic wrapping and public redaction discard the useful reason. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes. The patch reuses existing failure facts and preserves maintenance checks; a schema migration or a second admission mechanism is unnecessary.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This improves actionable update diagnostics for a bounded refusal case without establishing a new failure of update admission or recovery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor gate does not apply to this MEMBER-authored PR. Its body nevertheless records built-CLI proof of both changed refusal paths, safe IPC output, and unchanged synthetic state; no material authority transfer requires an additional proof gate.

Evidence

What I checked:

  • Introduced scope and proof continuity: Reviewed the pinned merge-base-to-head delta. The final commit adds only a wait for actual elicitation prompt delivery; production inputs are unchanged from the recorded built-CLI proof candidate. The supplied stale test merge was not used to infer removal of main behavior. (extensions/codex/src/app-server/user-input-bridge.elicitation.test.ts:155, 6a4dd2f84901)
  • Diagnostic observation preserves admission: The external preflight can only refuse. Empty or failed observations do not grant authority: maintenance still acquires both coordinators and performs the held-owner lease assertion before repair. Typed lease errors become fixed diagnostic facts; unrelated failures retain their existing classification. (src/commands/doctor-agent-lease-refusal.ts:22, 6a4dd2f84901)
  • No persisted-model change: The extracted reader retains the existing read-only database opening, schema-read admission, stale-process predicate, and handle cleanup. It neither changes schema nor deletes lease rows. The previous review's generic migration requirement therefore does not apply to this delta. (src/state/openclaw-agent-db-lease.ts:587, 6a4dd2f84901)
  • Public redaction remains narrowly bounded: Only the fixed lease guidance is added to the exact-text allowlist. Appended private text still falls back to the generic maintenance message; identifiers separately allow only the fixed public lease code. (src/logging/diagnostic-support-redaction.ts:485, 6a4dd2f84901)
  • Current main still needs the reporting fix: Current main rethrows the internal lease error and subsequently wraps it in generic maintenance prose, without the new typed lease fact. The existing Doctor-result and updater consumers already support carrying the proposed diagnostic through their current contract. (src/commands/doctor-maintenance.ts:608, b95d29c3b9ed)
  • Latest-release behavior: The v2026.9.5 public redactor retains only the generic maintenance prefix; the proposed lease-specific explanation is not present in this release boundary. (src/logging/diagnostic-support-redaction.ts:490, ec9c1a13db89)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-19T15:38:10.959Z sha b88654e :: blocked before merge. :: none
  • reviewed 2026-09-19T16:00:41.091Z sha b88654e :: blocked before merge. :: none
  • reviewed 2026-09-20T08:55:24.883Z sha b1ef050 :: blocked before merge. :: none
  • reviewed 2026-09-20T09:16:16.906Z sha b1ef050 :: blocked before merge. :: none
  • reviewed 2026-09-20T14:04:53.157Z sha 1d65627 :: blocked before merge. :: none
  • reviewed 2026-09-20T14:42:23.866Z sha 96b9980 :: blocked before merge. :: none
  • reviewed 2026-09-21T07:28:58.178Z sha b234aa5 :: blocked before merge. :: none
  • reviewed 2026-09-21T07:46:33.735Z sha 6a4dd2f :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 19, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/doctor-lease-refusal-152914-1501 branch from b88654e to b1ef050 Compare September 20, 2026 08:47
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 20, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 20, 2026
Apply the consent-only correction published in #147120 at 3f967cf, adapted to the exact current-main fixture. Preserve real runtime-path auditing and cover denied, approved, and noninteractive version-managed runtime consent. Production and package inputs are unchanged.
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 21, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 21, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 341a1e4 into main Sep 21, 2026
233 of 236 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/doctor-lease-refusal-152914-1501 branch September 21, 2026 08:13
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…aw#152976)

* fix: explain update refusals when an agent database is in use

* test: require safe typed lease refusals in Doctor flows

* fix: classify external agent leases before maintenance locks

* refactor: isolate Doctor agent-lease admission

* test(doctor): isolate installation consent runtime fixture

Apply the consent-only correction published in openclaw#147120 at 3f967cf, adapted to the exact current-main fixture. Preserve real runtime-path auditing and cover denied, approved, and noninteractive version-managed runtime consent. Production and package inputs are unchanged.

* test: wait for elicitation prompt delivery before inspecting it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations extensions: codex maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant