Skip to content

fix(update): candidate config read failure warning omits its reason - #169284

Merged
RomneyDa merged 4 commits into
openclaw:mainfrom
DonnieFi:docs/update-config-read-diagnostics-plan
Oct 12, 2026
Merged

RomneyDa merged 4 commits into
openclaw:mainfrom
DonnieFi:docs/update-config-read-diagnostics-plan

Conversation

@DonnieFi

@DonnieFi DonnieFi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #169261

What Problem This Solves

Fixes: when an update's compatibility config read fails after package replacement, candidate-config-read-failed gives no reason, so operators cannot tell what went wrong.

User Impact

User impact: the warning now includes a single-line reason of up to 500 characters: the reader's error message and code, a spawn failure, a timeout, a kill signal, oversized output, or a non-zero exit without a result. The reader's stderr is still never echoed, because config diagnostics go there. The fallback is unchanged: the existing service definition is left alone and the update continues.

Update behavior: the reader lives in the candidate's generated dist/io.runtime.js, which already-installed updaters import after package replacement. Updates from older updaters to this candidate therefore get the new reason without any change on their side. They only key on error.code, which is unchanged.

Why This Change Was Made

The reader child already sent { ok: false, message }, but the parent's finish() discarded it, and the async path reduced spawn errors to a boolean. The parent now reports the child's error or the exit facts. Whitespace and control characters (including ANSI escapes) are collapsed, and truncation adds …. Async timeouts are reported as timeouts rather than as a bare SIGKILL. The severity fix from #165539 is untouched.

Changing the generated alias body would have broken release provenance for the shipped 2026.10.5-beta.1 alias, which was recognized only by exact match. Its normalized hash is added to the historical list, with the real installed 2026.10.5-beta.1 io.runtime.js as the fixture. The 2026.9.8 provenance test is parametrized to cover both releases. Every release tag since 2026.9.5 maps to one of the three listed hashes: 9.5 and 9.6 to the first, 9.7 through 10.1 to the second, and 10.5-beta.1 to the new one.

Evidence

Real update proof: published updater × this candidate

Author run, full openclaw update with service activation, at head 7df13cb7722 (the generator is unchanged through 3b727508e4f). I ran the repository's published-driver Docker cell (scripts/e2e/published-driver-update-docker.sh) locally. It installs the published [email protected] updater, starts a managed Gateway through the systemd shim with synthetic durable and incognito sessions, runs openclaw update --tag <candidate.tgz> --yes --json, and then checks the run record, readyz, running version, and session data.

Uninjected first: published 2026.10.1 updated to this candidate (7df13cb7722, relabeled 2026.10.1 by the cell) and passed in 496 s. An earlier attempt on a host busy with three package builds failed: the service shim reported the previous Gateway as stopped and Doctor could not enter maintenance. A rerun in a fresh artifact directory passed, and hosted main CI passes the same lane. I did not investigate it further.

Fault injection: I made a copy of each candidate tgz whose alias target (dist/io.runtime-<hash>.mjs) starts with a guard. The guard runs only inside the reader child (OPENCLAW_CONFIG_READ_CHILD=1) and only when the parent is not update-migrated-finalize.worker.js. It writes synthetic-config-secret=proof-secret-value-0000 to stderr and exits 7. The content inventory hash is re-stamped so the package still passes admission. Each run triggered it exactly once, on the service-definition read during the restarting phase (the read from #169261). The finalize worker's other three reads ran normally.

Updater log line from each run (/tmp/openclaw/openclaw-2026-10-12.log, WARN):

Before (candidate 2026.10.5-beta.1, current alias):
[update:warning:candidate-config-read-failed] Candidate config read failed; the existing service definition was left unchanged. Retry with the updated CLI.

After (this candidate):
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 7 without a result. The existing service definition was left unchanged. Retry with the updated CLI.

Both injected runs:

  • Update continued: status: "ok". The recorded run is finished / succeeded, readyz returns 200, the running version is verified, the managed service PID was replaced, durable session history is intact, incognito content is gone, and the seeded credentials sidecar is byte-identical.
  • The reader's stderr is withheld: synthetic-config-secret has 0 hits in update stdout, update stderr, the OpenClaw logs, and every other cell artifact.
  • Service definition: after normalizing the temp install prefix and port, the unit after the injected update is byte-identical to the unit after an uninjected update. The only difference from the pre-update unit is the PATH line the managed reinstall writes on every update.
PASS published 2026.10.1 → candidate 2026.10.1 (7df13cb7722fc5f83e42af35d5f768ea0ed75980): finished, readyz=200, running version verified
{"status":"ok","before":"2026.10.1","after":"2026.10.1","run":{"phase":"finished","status":"succeeded"},"durationMs":524680}

I first tried injecting through a NODE_OPTIONS preload with both the published 2026.10.1 updater and 2026.10.1-beta.2 (the updater in #169261). Both updates passed, but the preload never reached the reader: only the first five updater processes loaded it, and later children started without it. That is why the guard lives in the candidate module.

Unit tests and maintainer verification

  • test/scripts/update-config-runtime-compat.test.ts runs the real generated alias in child processes:

    • The package-swap test now expects the actual reason: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<root>/node_modules/handoff-dependency/advanced.js' imported from <root>/dist/io.runtime-Candidate.mjs.
    • A new test has the reader write a synthetic secret to stderr and exit 7 for both the async and sync readers. It asserts reader process exited with code 7 without a result and that nothing reaches the parent's stderr.
  • Fails before the fix: both behavior tests fail against the original generator.

  • Passes after: test/scripts/update-config-runtime-compat.test.ts and test/scripts/runtime-postbuild.test.ts, 146/146. pnpm test test/scripts/update-config-runtime-compat.test.ts --maxWorkers=1 took 8 s wall; the new test takes about 170 ms.

  • node scripts/check-changed.mjs (scripts, test-root, docs, and tooling lanes) passed every step, including typecheck scripts, except one test-root type error in the new provenance test. After fixing it, pnpm tsgo:test:root passes in all four shards.

  • An independent read-only review confirmed Node 24.16 and Bun 1.4.2 report the same result shapes for timeout, buffer overflow, spawn failure, and signal. I applied its timeout, control-character, truncation-marker, and wording findings.

  • Published-driver × candidate cell (maintainer run, macOS, Node 26.9.0, isolated HOME/state). Driver: the published [email protected] npm package (its dist/io.runtime.js is byte-identical to the new fixture). The driver loads its updater module (gateway-service-probe-hosts, which reads candidate config after package replacement), then the candidate dist/io.runtime.js is written in place and the candidate's json5 dependency is made unavailable. "After" uses the alias generated by this PR's writeStableRootRuntimeAliases over the same beta.1 dist.

    === before (candidate io.runtime.js: shipped 2026.10.5-beta.1 alias)
    [update:warning:candidate-config-read-failed] Candidate config read failed; the existing service definition was left unchanged. Retry with the updated CLI.
    probe hosts (fallback config): ["127.0.0.1"]
    sync loadConfig error.code: candidate-config-read-failed
    === after (candidate io.runtime.js: generated by this PR at 7df13cb7722)
    [update:warning:candidate-config-read-failed] Candidate config read failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'json5' imported from <cell>/driver/node_modules/openclaw/dist/io.read-helpers-N5yCFyNL.mjs. The existing service definition was left unchanged. Retry with the updated CLI.
    probe hosts (fallback config): ["127.0.0.1"]
    sync loadConfig error.code: candidate-config-read-failed
    === success control (PR alias, config gateway.bind=lan, no injected failure)
    probe hosts: ["0.0.0.0"]
    sync loadConfig gateway.bind: lan
    

    The published driver still sees error.code === "candidate-config-read-failed" and falls back as before; only the message gains the reason. Not covered: a full openclaw update run with service activation.

  • Maintainer rerun on origin/main merged with this head: pnpm test test/scripts/update-config-runtime-compat.test.ts --maxWorkers=1 3/3 (6 s wall), pnpm test test/scripts/runtime-postbuild.test.ts --maxWorkers=1 143/143 (24 s wall); with the original generator restored, the two behavior tests fail. Changed-file lint is clean (remaining pnpm lint errors are max-lines in untouched files on current main). Autoreview (Codex, P0–P2): scoped-clean.

  • Heads dd227f9b3d8 and 3b727508e4f change only test/scripts/runtime-postbuild.test.ts. They add an explicit comparator for CI check-lint (require-array-sort-compare) and keep the extracted names typed as string[] for CI check-test-types-core-3 (TS18048). Generator code is unchanged since 7df13cb7722, so the cell above still applies. Locally, the CI changed-lint step passes, pnpm tsgo:test:root passes all four shards (55 s), and runtime-postbuild.test.ts passes 143/143.

  • Inherited CI failure: checks-node-compact-small-6 fails test/scripts/eager-import-closure.test.ts > resolves wrapper package exports and workspace aliases… (src/chat/sender-identity.ts, …). Scheduled main CI run 38193977980 at 9b5ac996870 fails the same assertion (job 114632680489). This PR does not touch those files.

Gaps:

  • Full openclaw update with service activation: covered by the real update proof above.
  • Why the reported Debian reader failed is still unknown; this makes the next occurrence explain itself.
  • Security tradeoff: raw reader errors (parse, include, or module errors) can include absolute paths or a short value fragment. Output goes only to the local updater terminal and is capped at 500 characters.

@clawsweeper

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds bounded failure reasons to candidate-config warnings and preserves recognition of the previously shipped runtime alias.

Example: The candidate reader cannot import the json5 dependency during an update.

  • Before: The warning says only that the candidate config read failed.
  • After: The warning identifies ERR_MODULE_NOT_FOUND and json5, while the published updater retains its existing fallback.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The real published-driver boundary proof is sufficient for this narrow diagnostic repair, and source review found no actionable defect; full service activation is outside the demonstrated coverage.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied isolated macOS published-driver × candidate cell exercises the production updater reader through real child processes, demonstrates the missing-dependency reason and unchanged fallback, and includes a successful-read control; later commits change only test typing and sorting.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators receive a generic candidate-config warning without the underlying reason.
Reason: The narrow diagnostic improvement addresses the demonstrated problem and preserves intentional fallback behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a diagnostic defect still present on current main, and the latest type correction leaves no actionable patch finding.

Priority: P2
Reviewed head: 3b727508e4f9681c2ddc6443394db696905c6e08

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied cell covers the changed diagnostic boundary, but does not claim a full update with service activation.
Agent review details

How this fits together

The postbuild generator produces the stable config alias consumed by installed updaters after package replacement; it sends reads to a fresh child process and returns config values or a coded warning.

flowchart TD
  A[Installed updater] --> B[Candidate stable config alias]
  B --> C[Fresh reader process]
  C --> D[Candidate config runtime]
  D --> E[Framed result]
  E --> B
  B --> F[Config value or bounded warning]
  F --> A
Loading

Technical review

Best possible solution:

Retain the existing compatibility reader and fallback while exposing bounded failure reasons to the operator.

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

Current-main source shows the discarded failure details, and the supplied published-driver trace demonstrates the before/after warning; no target code was executed during this review.

Is this the best way to solve the issue?

The repair belongs in the existing generated alias, preserves installed-updater compatibility, and avoids changing service-preparation policy.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Fresh-process reader and optional failure fallback keeps the original intent (a9fea70: Prevent installed updaters from mixing cached driver dependencies with the replaced candidate package.)
  • Framed stdout and withheld diagnostics keeps the original intent (5836021: Keep Node and Bun reader handoffs working without URL-query markers or extra pipe descriptors.)
  • Warning severity and historical alias recognition keeps the original intent (78e8de2: Report successful-update fallback as a warning and retain exact shipped alias provenance.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a9fea70 adds scripts/lib/update-config-runtime-compat.mts:46 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a9fea70fcba2; files: scripts/lib/update-config-runtime-compat.mts)
  • Patrick Erichsen: Raw commit 78e8de2 adds scripts/lib/update-config-runtime-compat.mts:141 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 78e8de276bd2; files: scripts/lib/update-config-runtime-compat.mts)

PR surface

Tests +157, Docs +1, Other +17. Total +175 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 202 45 +157
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 1 29 12 +17
Total 5 233 58 +175

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Useful diagnostics reduce investigation after an optional read failure without changing update success or service fallback.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-11T18:57:17.368Z sha 5d21f7f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T00:48:39.640Z sha 7df13cb :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T02:17:51.201Z sha 7df13cb :: needs changes before merge. :: none
  • reviewed 2026-10-12T02:32:56.165Z sha dd227f9 :: needs changes before merge. :: none

Reviewed October 11, 2026, 10:50 PM ET / October 12, 2026, 02:50 UTC (Revision 5).

@DonnieFi DonnieFi changed the title docs: plan candidate config reader failure diagnostics fix(update): candidate config read failure warning omits its reason Oct 12, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 12, 2026 02:12
@RomneyDa

Copy link
Copy Markdown
Member

@clawsweeper re-review

Added published-driver × candidate proof to the PR body (published [email protected] driver against this head's generated alias, injected missing candidate dependency, plus a success control). Head unchanged: 7df13cb7722.

@clawsweeper

clawsweeper Bot commented Oct 12, 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@RomneyDa

Copy link
Copy Markdown
Member

@clawsweeper re-review

Pushed dd227f9b3d8: it only fixes the PR-caused check-lint failure (require-array-sort-compare in test/scripts/runtime-postbuild.test.ts). The generator is unchanged.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M and removed size: XS labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa

Copy link
Copy Markdown
Member

@clawsweeper re-review

Pushed 3b727508e4f, a test-only type fix. check-test-types-core-3 flagged TS18048 on the comparator from the previous push. pnpm tsgo:test:root passes locally. The eager-import-closure failure is inherited from main: scheduled run 38193977980, job 114632680489.

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@RomneyDa

Copy link
Copy Markdown
Member

Admin-merging for the 2026.10.5-beta.2 release. The only red check is from an earlier attempt: test/scripts/eager-import-closure.test.ts, which this PR does not touch. It failed identically on the baseline and on scheduled main run 38193977980 (job 114632680489), and main fixed it in 2b66ae6. ClawSweeper review is complete with no open code findings.

@RomneyDa
RomneyDa merged commit f67c8ff into openclaw:main Oct 12, 2026
134 of 138 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…penclaw#169284)

* docs: plan candidate config reader failure diagnostics

* fix(update): report candidate config reader failure reasons

Closes openclaw#169261

* test(update): pass explicit comparator in alias provenance test

* test(update): keep alias provenance names typed as strings

---------

Co-authored-by: Dallin Romney <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 12, 2026
…169284)

* docs: plan candidate config reader failure diagnostics

* fix(update): report candidate config reader failure reasons

Closes #169261

* test(update): pass explicit comparator in alias provenance test

* test(update): keep alias provenance names typed as strings

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit f67c8ff)
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
…169284)

* docs: plan candidate config reader failure diagnostics

* fix(update): report candidate config reader failure reasons

Closes #169261

* test(update): pass explicit comparator in alias provenance test

* test(update): keep alias provenance names typed as strings

---------

Co-authored-by: Dallin Romney <[email protected]>
Backport note for 2026.10.3: clean pick. 10.2 and 10.3 ship the same alias generator as
2026.10.5-beta.1, so the added 49fbd875 historical hash also keeps the shipped 10.2
alias recognized once 10.3 emits the new reason-reporting body.

(cherry picked from commit f67c8ff)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…penclaw#169284)

* docs: plan candidate config reader failure diagnostics

* fix(update): report candidate config reader failure reasons

Closes openclaw#169261

* test(update): pass explicit comparator in alias provenance test

* test(update): keep alias provenance names typed as strings

---------

Co-authored-by: Dallin Romney <[email protected]>
(cherry picked from commit f67c8ff)
(cherry picked from commit 354806a)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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.

[Bug]: Beta update candidate config read fails after successful canary config validation

2 participants