Skip to content

fix(doctor): avoid slow legacy ownership repair in source checkouts - #156238

Merged
steipete merged 1 commit into
mainfrom
codex/doctor-binding-native-round7
Sep 23, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/doctor-binding-native-round7

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes slow legacy channel ownership repair when Doctor or startup recovery runs from a source checkout.

User Impact

Source installations can repair legacy ownership without transforming the host runtime a second time. Existing migration decisions, backups, synchronous recovery, and the packaged JavaScript path remain unchanged; no configuration changes are required.

Why This Change Was Made

The lazy binding repair entry point always used the plugin source transformer, even when the runtime could load it natively. A CPU profile attributed 31.2 seconds to that load and 102 milliseconds to the repair itself. Reuse the existing native module loader and alias resolver, retaining the established transform fallback only when native loading is unsupported. Dependency or evaluation errors still propagate.

The applicability gate remains lazy. The real-reader regression protects the host module boundary while retaining the original ownership assertions; unit coverage checks unsupported loading and error propagation.

Evidence

  • The architecture regression failed with the original loader and passed with the candidate. The full automatic-startup file passed all 25 cases; 14 sibling/recovery/loader files passed 484 cases with one existing skip. Build and direct source/built Doctor checks passed, including explicit ownership, the narrower peer binding, and original backup bytes.
  • One matched same-base/same-machine comparison reduced the real-reader case from 34.330 seconds to 2.356 seconds. This is a single performance observation. The historical CI timeout did not reproduce, so this PR does not claim to establish or repair its exact cause.
  • Changed-test wall costs with --maxWorkers=1: legacy-config-compat.test.ts, 6 cases in 15.39 seconds; automatic-startup-config-repair.test.ts, 25 cases in 21.76 seconds. CI timing will be recorded when available.
  • Selected type, lint, formatting, and guard checks passed, including the final test cleanup correction. The refreshed automatic-startup file passed 25 cases in 24.21 seconds wall. CI and Security Review passed, and the required CI status succeeded.
  • The PR merged at 70cd657a0f95900ef32269de38bc7e7824c9d7ff before the final cohort and updater checks completed; both subsequently passed. The original five-group cohort preserved its ordering and two-plan/two-worker concurrency: 3,282 passed, eight existing skips, 491.277 seconds wall; the real-reader ownership case passed in 5.271 seconds. The four changed files and five bound loader/runtime/test-wrapper dependencies match the reviewed hashes at the merged commit.
  • Fresh installation, the real published 2026.9.4 updater → candidate 2026.9.5, and the candidate's unchanged-build already-current no-op all passed. Doctor exited 0 with a recorded recoverable loopback/node-hosting advisory in the service-free fixture; the update succeeded without activation. No version-skew warning occurred.
  • Two preparation failures preceded updater execution: a runtime-only build omitted package declarations, and the published 2026.9.5 baseline was too recent for the repository's seven-day release-age policy. The canonical full package build fixed preparation; the final cell reused that validated immutable tarball with policy-eligible 2026.9.4 (published September 11). No policy, harness assertion, or legacy-warning allowance changed.
  • Per-file CI timings were not exposed by the available workflow artifacts; the standalone wall measurements above are reported separately.
Source and built Doctor runtime proof

Linux/Node 24.19.0, pnpm 12.4.0. The source probe used the real config reader and automatic repair planner. The built probe ran pnpm openclaw doctor --fix --non-interactive against isolated synthetic legacy configuration. It asserted the repaired explicit roster, default-account ownership, preservation of the narrower peer binding, byte-for-byte original backup, and the exact native runtime path. The built trace contained only JavaScript binding-repair loads.

The retained output is from candidate tree e92759d92b6e49110331a9bdb22808e55785efe8; the final tree 4eec5a3f81ef6d106ac553f041595a8e6ef3199b only changes test-spy cleanup. Production file SHA-256 is unchanged: 614c55a011e5e38584c5166d78b05454a74043f020ae65220ad43861836ded7e.

BINDING_SOURCE 0e79899fedc26ae9a90a196a8bc41b97fd39d7e5 tree e92759d92b6e49110331a9bdb22808e55785efe8
v24.19.0
12.4.0
BINDING_BUILT_PROOF {"passed":true,"elapsedMs":81545,"explicitOwners":["ops","main"],"preservedDefaultAccountOwner":"ops","preservedNarrowerPeerOwner":"main","originalBackupVerified":true,"expectedSourceRuntime":"/home/runner/_work/openclaw/openclaw/src/commands/doctor/shared/legacy-config-binding-repair.runtime.ts","sourceNativeLoadVerified":true,"expectedRuntime":"/home/runner/_work/openclaw/openclaw/dist/legacy-config-binding-repair.runtime.js","nativeLoadCount":11}
Published updater receipt

Provider: Blacksmith Testbox, run 35824888880. The delegated command completed with exit 0 in 162.695 seconds; the lease was then stopped and verified completed. Source tree: 4eec5a3f81ef6d106ac553f041595a8e6ef3199b. Candidate SHA-256: 341f873c49dff83c0174c92ce85b3d3ef7669e0c0033242731b377470cd108ff. The package's carrier commit identifies remote materialization of that exact tree.

{
  "passed": true,
  "baselineVersion": "2026.9.4",
  "candidateVersion": "2026.9.5",
  "candidateBuildId": "2026.9.5-a7daf4ed8523-2026-09-23T06-31-51.144Z",
  "appliedStatus": "ok",
  "appliedAfterBuildId": "2026.9.5-a7daf4ed8523-2026-09-23T06-31-51.144Z",
  "doctorExitCode": 0,
  "noopStatus": "skipped",
  "noopBuildId": "2026.9.5-a7daf4ed8523-2026-09-23T06-31-51.144Z"
}

The Doctor receipt recorded: core/doctor/node-hosting-preconditions: Gateway is only bound to loopback, followed by the existing recoverable update-time advisory. The full fixture checks included exact candidate identity after installation, an unchanged build on the second invocation, offline/service-free behavior, and original source cleanliness.

Load the lazy host binding repair through the existing native module loader
and alias resolver before the supported source-transform fallback. Preserve
synchronous recovery, applicability, migration results, and built JS loading;
propagate dependency and evaluation failures without loading a second graph.

Keep the real-reader ownership assertions and guard the host module boundary.
Cover unsupported native loading and error propagation through existing owners.

A matched same-base observation reduced the real-reader case from 34.330s to
2.356s. Historical CI timeout causality remains unproven. Independent P2 review,
source/built Doctor, focused/sibling tests and exact-tree formatting passed;
remaining ordered-cohort and published-updater proof are tracked before landing.
@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 23, 2026 05:52
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 23, 2026, 1:58 AM ET / 05:58 UTC.

ClawSweeper review

What this changes

Doctor’s legacy channel-ownership repair now tries the existing native module loader before source transformation, with regression coverage for lazy loading, fallback, and error propagation.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful, focused performance fix: current main and v2026.9.5 still force source transformation. No introduced correctness defect was found, but the runtime evidence and acknowledged upgrade validation are not yet complete.

Priority: P2
Reviewed head: 1486f410c76d8c41adf3b8f9e0e348dfc353688b

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and source review found no defect, but reported runtime results are not yet backed by inspectable evidence and required upgrade proof remains pending.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the body reports successful source/built Doctor repairs through the changed loader, but provides no inspectable runtime output and explicitly leaves the required published-updater-to-candidate check pending. Add a redacted terminal transcript or artifact showing repair results, retained peer bindings, backup bytes, and the upgrade outcome; terminal screenshots are also suitable. Remove private paths, endpoints, credentials, and other private details. Updating the PR body should trigger review; otherwise ask a maintainer for @clawsweeper re-review. No stored-data contract changes are introduced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the body reports successful source/built Doctor repairs through the changed loader, but provides no inspectable runtime output and explicitly leaves the required published-updater-to-candidate check pending. Add a redacted terminal transcript or artifact showing repair results, retained peer bindings, backup bytes, and the upgrade outcome; terminal screenshots are also suitable. Remove private paths, endpoints, credentials, and other private details. Updating the PR body should trigger review; otherwise ask a maintainer for @clawsweeper re-review. No stored-data contract changes are introduced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Introduced change and merge ownership: The pinned merge-base-to-head diff changes the loader and three test/support files. Raw test-merge parents match the supplied base followed by the exact PR head; its result contains the same four paths.
Still necessary on main: Fetched main still invokes the source transformer with tryNative:false whenever the source ownership runtime is needed.
Latest release check: The published v2026.9.5 source also forces transformation; this optimization is not present in that release.
Findings None None.
Security None None.

How this fits together

Doctor and startup recovery normalize legacy configuration before validation and saving. This loader brings in channel-ownership repair only when applicable, preserving the migration owner used by both paths.

flowchart TD
  A[Legacy configuration] --> B[Doctor or startup recovery]
  B --> C{Ownership repair applicable?}
  C -->|No| G[Validate migration result]
  C -->|Yes| D[Try native module loading]
  D -->|Unsupported| E[Source transformation]
  D -->|Loaded| F[Existing ownership repair]
  E --> F
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the body reports successful source/built Doctor repairs through the changed loader, but provides no inspectable runtime output and explicitly leaves the required published-updater-to-candidate check pending. Add a redacted terminal transcript or artifact showing repair results, retained peer bindings, backup bytes, and the upgrade outcome; terminal screenshots are also suitable. Remove private paths, endpoints, credentials, and other private details. Updating the PR body should trigger review; otherwise ask a maintainer for @clawsweeper re-review. No stored-data contract changes are introduced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Supply the runtime evidence and complete the published-updater check and acknowledged ordered-cohort follow-up before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +13, Tests +71. Total +84 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 19 6 +13
Tests 3 82 11 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 101 17 +84

Review metrics

Metric Value Why it matters
Observed repair-case duration 34.330s → 2.356s in one matched comparison The reported measurement supports the performance motivation but does not establish historical CI timeout causality.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/shared/legacy-config-compat.ts, unknown-data-model-change: src/commands/doctor/shared/legacy-config-compat.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one synchronous repair owner, using native loading where supported and the established transform fallback otherwise, with verified source, packaged, and upgrade behavior.

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

Yes, source inspection establishes that applicable multi-agent repairs on current main force transformation even when native loading is available; the precise slowdown was not independently executed here.

Is this the best way to solve the issue?

Yes, reusing the existing native loader and alias resolver is a narrow solution that preserves the repair owner and fallback contract; runtime and upgrade validation still need completion.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This reduces substantial Doctor/startup repair overhead for source installations without evidence of a current widespread outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the body reports successful source/built Doctor repairs through the changed loader, but provides no inspectable runtime output and explicitly leaves the required published-updater-to-candidate check pending. Add a redacted terminal transcript or artifact showing repair results, retained peer bindings, backup bytes, and the upgrade outcome; terminal screenshots are also suitable. Remove private paths, endpoints, credentials, and other private details. Updating the PR body should trigger review; otherwise ask a maintainer for @clawsweeper re-review. No stored-data contract changes are introduced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This reduces substantial Doctor/startup repair overhead for source installations without evidence of a current widespread outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the body reports successful source/built Doctor repairs through the changed loader, but provides no inspectable runtime output and explicitly leaves the required published-updater-to-candidate check pending. Add a redacted terminal transcript or artifact showing repair results, retained peer bindings, backup bytes, and the upgrade outcome; terminal screenshots are also suitable. Remove private paths, endpoints, credentials, and other private details. Updating the PR body should trigger review; otherwise ask a maintainer for @clawsweeper re-review. No stored-data contract changes are introduced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Introduced change and merge ownership: The pinned merge-base-to-head diff changes the loader and three test/support files. Raw test-merge parents match the supplied base followed by the exact PR head; its result contains the same four paths. (src/commands/doctor/shared/legacy-config-compat.ts:33, 1486f410c76d)
  • Still necessary on main: Fetched main still invokes the source transformer with tryNative:false whenever the source ownership runtime is needed. (src/commands/doctor/shared/legacy-config-compat.ts:28, 44d24c38bd8b)
  • Latest release check: The published v2026.9.5 source also forces transformation; this optimization is not present in that release. (src/commands/doctor/shared/legacy-config-compat.ts:27, ec9c1a13db89)
  • Existing loader contract: The shared native loader returns unsupported for recognized loading limitations, propagates dependency/evaluation failures, and restores temporary alias hooks. The patch preserves the built-JavaScript require path and existing applicability gate; no migration policy, stored format, plugin API, or authorization decision changes. (src/plugins/native-module-require.ts, 1486f410c76d)
  • Regression coverage: The existing real-reader ownership test now rejects transforming host-core modules while retaining ownership assertions. Two added unit cases cover unsupported-native fallback and failure propagation; test support retains existing Vitest mocks without adding a production seam. Tests were inspected, not executed in this read-only review. (src/commands/doctor/shared/automatic-startup-config-repair.test.ts:56, 1486f410c76d)
  • Captured proof and remaining coverage: The supplied body, preserved under sourceRevision ca0dace52bd1c8a0076485f455bc4c8634c88f76eaf056c42a83906ec581c8e0, reports source/built Doctor success, preserved peer bindings and backup bytes, and one 34.330s-to-2.356s comparison. The live REST body matched it. No execution transcript or linked runtime artifact accompanies those summaries; the published-updater cell and ordered cohort are explicitly pending. (1486f410c76d)

Likely related people:

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

Rank-up moves

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

  • Attach redacted output from the reported source/built Doctor runs and complete the published-updater-to-candidate check.
  • Record the original ordered-cohort result or a bounded investigation outcome without claiming an unreproduced timeout was fixed.

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.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Sep 23, 2026
@steipete
steipete enabled auto-merge (squash) September 23, 2026 06:30
@steipete
steipete merged commit 70cd657 into main Sep 23, 2026
264 checks passed
@steipete
steipete deleted the codex/doctor-binding-native-round7 branch September 23, 2026 06:39
vincentkoc added a commit to ycmjbot-bot/openclaw that referenced this pull request Sep 23, 2026
* commit '3ab93b4ea59804b34d02a696382db16dc95189bb': (80 commits)
  fix(gateway): keep session refreshes moving during unrelated writes (openclaw#156286)
  chore(deps): update fs-safe to 0.18.2 (openclaw#156262)
  refactor(plugins): extract ClawHub plugin archives once (openclaw#156246)
  improve(llm-core): avoid unnecessary tool validation sets (openclaw#152066)
  fix(backup): verification accepts archives missing captured databases (openclaw#156211)
  fix: cancel Guest work when its original access is revoked (openclaw#156106)
  fix(test): classify drained legacy migration refusals
  fix(anthropic): finish Opus 5.5 defaults and thinking display (openclaw#156093)
  refactor(agents): share native harness tool execution (openclaw#154217)
  fix(ui): carry typed ownership through short-route resolution
  test(worktrees): accept additive gc result fields (openclaw#156127)
  test(tasks): close sqlite borrowers before registry reload (openclaw#156131)
  chore(autoreview): sync Astra high defaults (openclaw#156175)
  refactor(node-host): await prepared workspace storage (openclaw#149519)
  improve: speed up cold Node test planning (openclaw#156234)
  fix(doctor): avoid slow legacy ownership repair in source checkouts (openclaw#156238)
  improve: speed up native build artifact validation (openclaw#156219)
  fix(ui): preserve short-route resolution ownership
  fix(doctor): name retained session metadata conflicts (openclaw#156162)
  perf(tasks): bound creation selection to matching runs (openclaw#156183)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…penclaw#156238)

Load the lazy host binding repair through the existing native module loader
and alias resolver before the supported source-transform fallback. Preserve
synchronous recovery, applicability, migration results, and built JS loading;
propagate dependency and evaluation failures without loading a second graph.

Keep the real-reader ownership assertions and guard the host module boundary.
Cover unsupported native loading and error propagation through existing owners.

A matched same-base observation reduced the real-reader case from 34.330s to
2.356s. Historical CI timeout causality remains unproven. Independent P2 review,
source/built Doctor, focused/sibling tests and exact-tree formatting passed;
remaining ordered-cohort and published-updater proof are tracked before landing.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant