Skip to content

fix: backport Doctor and Claude reply repairs to 2026.9.9 - #166524

Merged
RomneyDa merged 5 commits into
release/2026.9.9from
backport/release-2026.9.9-doctor-claude-fixes
Oct 7, 2026
Merged

RomneyDa merged 5 commits into
release/2026.9.9from
backport/release-2026.9.9-doctor-claude-fixes

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes Doctor/update failures and stalled Claude CLI replies on the frozen 2026.9.9 release candidate.

User Impact

Doctor keeps other active Doctors' native commands intact, reads current admission policy without repeatedly opening the full database fleet, and resumes archive migration progress while honoring interruption. Claude CLI background agents running Bash no longer leave the parent reply hanging.

No release version, dependency, schema, configuration, or publication change. Existing update backup, rollback, and managed-Gateway restoration ownership remain intact.

Why This Change Was Made

Maintainer-approved backports of #164868, #163369, #165837, and #165596, preserving upstream author credit and source commit provenance.

The Doctor custody failure was observed in stable full release validation. Archive conflict resolution preserves the release branch's flat migration plan, plugin-install-index prelude, and legacy recovery paths; the Claude fixture retains the release's ordinary foreground-error scenario. The only additional backport repairs the inherited WhatsApp test race found while validating this PR; its owning source fix landed on main first.

Evidence

  • Base: ccb390b0776973fa8b5b7589d12975f9f89c4ac9 on release/2026.9.9.
  • Focused proof passed: 166 tests across 12 files, with --maxWorkers=1, 229.20s total wall including compilation. Infrastructure: 100 tests / 8 files, 172.60s; Doctor commands: 18 tests / 3 files, 26.90s; Claude subprocess boundary: 48 tests / 1 file, 18.43s. Existing regressions retained; no extra tests added for the backport. CI cost will be recorded when its exact-head run finishes.
  • Added fixture-only backport proof: 18/18 existing WhatsApp cases passed on release head 9653cd960d4c8af6616489eb20d2dec239511c13; 92.10s wrapper wall, repaired case 111ms. Wrong shard-selection attempts found no tests and are not passing evidence. The delta is patch-identical to the independently reviewed, CI-green and ClawSweeper-clean source fix. Original 166-test production proof remains valid.
  • Fresh independent Codex P1 review passed with no findings against the pinned release base. Review scope was the changed files; unchanged integration contracts were checked by the maintainer and focused executable proof.
  • git diff --check, changed-file formatting, core production types, plugin production types, and plugin test types passed. Core test types and changed-file type-aware core/plugin lint also passed.
  • Exact-head CI found one inherited root failure: the unchanged WhatsApp serialized-reply shutdown case timed out after 120 seconds, matching the original release validation. A peer shard was fail-fast cancelled after its tests passed; aggregate CI red is downstream. Current main has byte-identical test source. Forced late durable admission reproduced its fake-clock ordering bug; the owning main fix waits for the existing debounce milestone and preserves all assertions. It landed on main as 1f576e4a4a210394aac7f82774d0afc6cabe7a2e and was cherry-picked here with an identical patch (test-only; production unchanged).
  • Exact-head CI passed 194/194 jobs, with the CI gate successful. The inherited fixture failure above is repaired; the original failure remains recorded rather than relabeled as a passing run.
  • Published-updater compatibility proof passed with C=Q=9653cd960d4c8af6616489eb20d2dec239511c13, source=ref, and update-first-hop-compat-2026.9.8. The targeted job took 55m47s. Inspected uploaded lane evidence shows the installed published 2026.9.8 updater completing the first hop: candidate Doctor 16.101s, installed Doctor 22.011s, Gateway verification 4.890s, exit 0. Candidate-build equality, managed-service PID replacement, active service, and zero transaction residue assertions passed. Subsequent hops and the missing-plugin-load-path flow passed; update and standalone Doctor preserved configuration bytes, and admission retained pending lifecycle/profile artifacts. The existing systemd fixture manages real Gateway processes; this is not native-host systemd proof. Durable completion is supported by successful terminal output and the shipped updater completion contract; raw SQLite rows and first-hop JSON/service snapshots were not uploaded, so no independent row-export claim is made. This diagnostic evidence closes the combined candidate compatibility gap, but does not replace full stable qualification.
  • Earlier local package preparation stopped at its 15-minute bound before updater execution; declaration generation dominated and no passing claim was made. A short-SHA hosted assertion submission was cancelled before product execution; the successful replacement asserted the full SHA. A monitor-only native relay failure did not cancel or rerun the hosted job.
  • Fresh ClawSweeper review found no code/security defect; its only blocker was incomplete updater compatibility evidence at review time. A fresh review is requested with the completed evidence above.
  • This is preparation only; release publication remains paused. The repaired candidate needs fresh stable-profile qualification with the existing owner-approved waiver.

steipete and others added 4 commits October 7, 2026 01:22
…164868)

Scope process settlement to the Doctor's native helper and receipt identities.
Report foreign custody without retiring its claims or weakening installation
replacement checks. Preserve mismatched receipt, alias, identity, and extinction
refusals, and cover the overlap with a real exited child and live peer command.

Refs https://github.com/openclaw/openclaw/actions/runs/37191626450.

(cherry picked from commit d47ee98)
…nt reader (#163369)

Doctor update-admission checks hashed the complete shared SQLite artifact family on every assertion (readCurrentOpenClawStateDatabaseContentVersion inside the admission reader), and lease writes invalidated the row cache, so repeated maintenance checks re-hashed archives inside small write transactions and prolonged the Gateway-offline window. The admission reader now holds an independent read-only connection within the schema-maintenance scope and admitted native-source lifetime, reads committed policy in one bounded snapshot per assertion, keeps lease/update admission, quarantine, schema and source-identity checks fresh, and closes before releasing source retention.

Closes #163365

Co-authored-by: victor-gurbani <[email protected]>
(cherry picked from commit 0eca3d0)
…nd honor interruption (#165837)

Refs #165789
Refs #164948

Reported by @A1fred-AI and @goncalonc.

(cherry picked from commit 3a085ea)
…nd agent runs Bash (#165596)

* fix(claude-cli): a background agent's own Bash no longer leaves the turn open

When a native background agent runs Bash itself, Claude Code reports that
command on the main stream: task_started with owned_by_subagent: true, then
a task_notification with no owner field, before the agent's own
notification. The runtime queued that notification, so the agent's
task-notification result consumed the Bash slot instead of the agent's. The
agent stayed pending, the turn never completed, and the run ended at the CLI
timeout and fell back to another model, which re-ran the prompt.

Tasks started with owned_by_subagent are now recorded and their
notifications dropped instead of queued: the subagent answers them, never
the parent turn. Measured on Claude Code 2.1.289 (Opus 5.5 and Opus 5).

* fix(anthropic): prove subagent Bash replies complete without a timeout

Keep subagent-owned notifications out of the parent completion queue. Simplify
single-use task predicates and remove the unused close-reason forwarding path.
Replace the background-agent fixture's file polling with a protocol response
barrier, and assert terminal output before waiting for iterator settlement so
regressions fail on the misplaced interim marker instead of a timeout.

Original fix by @adele-with-a-b; contributor ancestry is preserved.

---------

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 889611b)
@clawsweeper

clawsweeper Bot commented Oct 7, 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.

@RomneyDa
RomneyDa marked this pull request as ready for review October 7, 2026 08:27
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations extensions: anthropic size: XL labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 6:31 AM ET / 10:31 UTC (Revision 4).

ClawSweeper review

What this changes

Backports Doctor cleanup, admission reading, archive migration and interruption repairs, Claude CLI reply completion, and WhatsApp test synchronization to the 2026.9.9 release candidate.

Merge readiness

✅ Ready for maintainer review

The completed exact-head published-updater evidence resolves the prior compatibility blocker. No actionable code or security defect was found. This remains a useful backport to the frozen release branch even though the upstream repairs are already merged on main.

Priority: P1
Reviewed head: 9653cd960d4c8af6616489eb20d2dec239511c13

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent, validated backport with the prior compatibility gap resolved and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The captured maintainer diagnostics and independently verified exact-head job show the published 2026.9.8 updater exercising candidate Doctor and replacing a real Gateway process successfully. Source inspection confirms the harness checks build identity, service activity and residue. Existing archive formats and recovery metadata remain compatible, supported by failure/resume regressions and recorded configuration preservation. The systemd fixture is not native-host proof, and raw artifact retrieval was blocked for this reviewer; those limits do not reopen the resolved compatibility ask.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The captured maintainer diagnostics and independently verified exact-head job show the published 2026.9.8 updater exercising candidate Doctor and replacing a real Gateway process successfully. Source inspection confirms the harness checks build identity, service activity and residue. Existing archive formats and recovery metadata remain compatible, supported by failure/resume regressions and recorded configuration preservation. The systemd fixture is not native-host proof, and raw artifact retrieval was blocked for this reviewer; those limits do not reopen the resolved compatibility ask.
Evidence reviewed 9 items Pinned scope and review continuity: The introduced delta is ccb390b..9653cd9, targeting release/2026.9.9. The previous completed review examined this same head, reported no findings, and requested only completed published-updater compatibility evidence. The captured body sourceRevision is cd6d9cd0018b97b376dfcb642f4f00188f45209bc656ed2bf4ed2f3486e581a7.
Published-updater result independently verified: GitHub confirms run https://github.com/openclaw/openclaw/actions/runs/37597401464 and targeted job 112723426156 completed successfully on the exact reviewed head. The job ran from 09:25:29 to 10:21:16 UTC. Artifact 11475436859 is unexpired and bound to that run and head. The captured maintainer evidence records published 2026.9.8 updater execution, candidate Doctor 16.101s, installed Doctor 22.011s, Gateway verification 4.890s, exit zero, matching candidate build, changed Gateway PID, active service and no transaction residue.
Proof semantics and inspection limitation: The maintained first-hop harness invokes the installed updater, compares installed build bytes, requires managed-service PID replacement and active service, and rejects transaction residue. This supports the recorded result beyond a generic CI pass. The service-manager fixture controls real Gateway processes but does not prove native-host systemd behavior. Raw artifact download was blocked by this reviewer's network allowlist; artifact contents were not independently inspected, and no raw SQLite row-export claim is made.
Findings None None.
Security None None.

How this fits together

Doctor repairs installed configuration and stored conversation data while the updater manages Gateway shutdown and recovery. The Anthropic plugin separately turns Claude CLI subprocess notifications into completed agent replies.

flowchart TD
  A[Installed updater] --> B[Doctor maintenance]
  C[Existing SQLite state] --> B
  B --> D[Current ownership checks]
  D --> E[Archive repair and process cleanup]
  E --> F[Gateway recovery]
  G[Claude CLI notifications] --> H[Completed agent reply]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +362, Tests +764, Docs +16. Total +1142 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 12 703 341 +362
Tests 14 866 102 +764
Docs 2 16 0 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 28 1585 443 +1142

Review metrics

Metric Value Why it matters
Production versus test growth production +703/-341; tests/support +866/-102 Production growth includes the bounded independent reader and extracted migration runner; regression coverage protects distinct admission, custody, progress and interruption contracts.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/state-migrations.doctor.ts, unknown-data-model-change: src/infra/state-migrations.doctor.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep these repairs within the existing Doctor, storage and Anthropic owners, preserving the frozen release's recovery contracts and separate release qualification.

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

Yes: the pinned release-base mechanisms and upstream negative controls establish concrete custody, archive-pagination and Claude notification failures. This read-only review did not execute product code.

Is this the best way to solve the issue?

Yes: the backport reuses merged repairs at their existing owners, preserves release-specific orchestration and recovery, and now has completed published-driver compatibility evidence.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured maintainer diagnostics and independently verified exact-head job show the published 2026.9.8 updater exercising candidate Doctor and replacing a real Gateway process successfully. Source inspection confirms the harness checks build identity, service activity and residue. Existing archive formats and recovery metadata remain compatible, supported by failure/resume regressions and recorded configuration preservation. The systemd fixture is not native-host proof, and raw artifact retrieval was blocked for this reviewer; those limits do not reopen the resolved compatibility ask.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P1: The backport repairs Doctor/update failures and stalled Claude replies on the active release candidate.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The captured maintainer diagnostics and independently verified exact-head job show the published 2026.9.8 updater exercising candidate Doctor and replacing a real Gateway process successfully. Source inspection confirms the harness checks build identity, service activity and residue. Existing archive formats and recovery metadata remain compatible, supported by failure/resume regressions and recorded configuration preservation. The systemd fixture is not native-host proof, and raw artifact retrieval was blocked for this reviewer; those limits do not reopen the resolved compatibility ask.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured maintainer diagnostics and independently verified exact-head job show the published 2026.9.8 updater exercising candidate Doctor and replacing a real Gateway process successfully. Source inspection confirms the harness checks build identity, service activity and residue. Existing archive formats and recovery metadata remain compatible, supported by failure/resume regressions and recorded configuration preservation. The systemd fixture is not native-host proof, and raw artifact retrieval was blocked for this reviewer; those limits do not reopen the resolved compatibility ask.

Evidence

What I checked:

  • Pinned scope and review continuity: The introduced delta is ccb390b..9653cd9, targeting release/2026.9.9. The previous completed review examined this same head, reported no findings, and requested only completed published-updater compatibility evidence. The captured body sourceRevision is cd6d9cd0018b97b376dfcb642f4f00188f45209bc656ed2bf4ed2f3486e581a7. (9653cd960d4c)
  • Published-updater result independently verified: GitHub confirms run https://github.com/openclaw/openclaw/actions/runs/37597401464 and targeted job 112723426156 completed successfully on the exact reviewed head. The job ran from 09:25:29 to 10:21:16 UTC. Artifact 11475436859 is unexpired and bound to that run and head. The captured maintainer evidence records published 2026.9.8 updater execution, candidate Doctor 16.101s, installed Doctor 22.011s, Gateway verification 4.890s, exit zero, matching candidate build, changed Gateway PID, active service and no transaction residue. (9653cd960d4c)
  • Proof semantics and inspection limitation: The maintained first-hop harness invokes the installed updater, compares installed build bytes, requires managed-service PID replacement and active service, and rejects transaction residue. This supports the recorded result beyond a generic CI pass. The service-manager fixture controls real Gateway processes but does not prove native-host systemd behavior. Raw artifact download was blocked by this reviewer's network allowlist; artifact contents were not independently inspected, and no raw SQLite row-export claim is made. (scripts/e2e/lib/upgrade-survivor/update-first-hop-compat.sh:286, 9653cd960d4c)
  • Custody boundary and forbidden-owner coverage: Settlement skips foreign commands only when they are absent from this Doctor's receipt; mismatched receipt ownership, reservations, birth identities and aliases still refuse. The production-boundary regression uses an exited Doctor and a live peer process, verifies the peer remains alive with unchanged claims, and proves installation replacement remains blocked until the peer settles. Upstream provenance is fix(update): settle only this Doctor's commands in managed custody #164868. (src/infra/update-managed-command-custody.ts:184, 9653cd960d4c)
  • Fresh admission retains live checks: The independent reader is restricted to schema-maintenance scope and the retained native source lifetime. Every read rechecks admission, source identity and quarantine; policy rows use a bounded independent snapshot. Tests cover committed foreign policy, uncommitted writes, inherited discovery snapshots, replacement, quarantine and drainage. The unchanged Doctor caller reevaluates admission on each assertion. (src/state/openclaw-state-db-current-reader.ts:107, 9653cd960d4c)
  • Existing-state and archive compatibility: The archive repair retains existing tables, cursor serialization and publication recovery journal. It seeks complete composite keys, checks current maintenance authority inside write transactions, retains committed blobs before file publication, and commits publication metadata with cursor progress. Regression coverage verifies rollback, retained prefixes, resume, publication timestamps and interruption. The completed published-updater cell additionally records preserved configuration bytes and pending lifecycle/profile artifacts; no schema or configuration migration is introduced. (src/infra/state-migrations.transcript-directives-archives.ts:413, 9653cd960d4c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • victor-gurbani: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • adele-with-a-b: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (3 earlier review cycles)
  • reviewed 2026-10-07T08:37:23.603Z sha 1804cf5 :: needs changes before merge. :: none
  • reviewed 2026-10-07T08:45:41.039Z sha 1804cf5 :: blocked before merge. :: none
  • reviewed 2026-10-07T09:07:24.486Z sha 9653cd9 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: whatsapp-web Channel integration: whatsapp-web label Oct 7, 2026
@RomneyDa

RomneyDa commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

The only prior blocker is now resolved by completed exact-head published-updater compatibility evidence, recorded in the PR body. Package Acceptance run 37597401464 passed on C=Q 9653cd9; targeted first-hop job 112723426156 passed in 55m47s. Inspected artifact 11475436859 proves the installed published 2026.9.8 updater completed candidate Doctor, installed Doctor, managed Gateway replacement/verification, exact candidate build checks, and no transaction residue. Configuration and admission artifacts were preserved. Evidence limitations (systemd fixture, no raw SQLite row export) are explicitly recorded. Exact-head CI run 37597317084 passed all 194 jobs. No source or head changes since your review.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 7, 2026
@RomneyDa
RomneyDa merged commit ed472c0 into release/2026.9.9 Oct 7, 2026
305 of 307 checks passed
@RomneyDa
RomneyDa deleted the backport/release-2026.9.9-doctor-claude-fixes branch October 7, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web commands Command implementations docs Improvements or additions to documentation extensions: anthropic P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

4 participants