Skip to content

fix(update): service definition refresh skipped when the config snapshot is large - #170373

Merged
RomneyDa merged 2 commits into
mainfrom
fix/170331-config-reader-frame
Oct 14, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/170331-config-reader-frame

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Closes #170331

What Problem This Solves

Fixes: openclaw update warns candidate-config-read-failed: reader process exited with code 1 without a result and leaves the Gateway service definition unrefreshed when the operator's config snapshot is larger than the reader pipe buffer (~64 KB on macOS, ~200 KB on Linux).

User Impact

User impact: updates with moderately large configs refresh the service definition again instead of warning and skipping it. When an optional read does fail, the warning now names the real next step: run openclaw gateway install --force with the same --profile or --dev option as the update. The old text was "Retry with the updated CLI", which pointed at the CLI that was already running.

Why This Change Was Made

The generated dist/io.runtime.js reader child touched process.stdout, which makes fd 1 non-blocking, and then wrote its result frame with fs.writeFileSync(1, …). Once the frame exceeded the pipe buffer, the write threw EAGAIN partway through. The catch then appended an error frame, and the parent could not parse either one. The worker now writes the single frame through the stream, which queues and flushes it before the process exits naturally. The worker never calls process.exit.

The recovery advice is part of the generated alias, which runs inside the older installed updater. That process cannot load the candidate's formatCliCommand, so the message names the profile selection instead of rendering a qualified command. --container doesn't apply because formatCliCommand never adds it to update commands.

Update behavior: the updater loads the candidate's alias after the package swap. This fix therefore takes effect for updates to a release containing it, including updates driven by beta.1 and beta.2.

Retained alias hash, without a fixture. The old template's body hash (13537ac9…) stays in isUpdateConfigRuntimeAlias so update-compat tracing still recognizes published releases. I checked it against the real npm tarballs (npm pack openclaw@<v>) by running the actual recognizer over each published dist/io.runtime.js:

Published release Recognized with the hash Without it
2026.10.2 yes yes (older hash)
2026.10.3 (current latest) yes no
2026.10.5-beta.2 yes no
2026.10.5-beta.3 (current beta) yes no

The hash is required: update:compat:check must trace the current latest and beta dist-tags. The earlier draft added a 123-line .txt copy of the beta.2 alias as a fixture. That file is removed; the table above replaces it.

Evidence

Real package boundary, before and after. Each package is installed from its tarball into an isolated prefix. Its dist/io.runtime.js is then imported the way an older updater imports it after replacement (OPENCLAW_UPDATE_IN_PROGRESS=1), using an isolated HOME/state and a valid 1,000,095-byte config, and readConfigFileSnapshot() is called:

== before (published 2026.10.5-beta.3), macOS Node 26.9
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 1 without a result. The existing service definition was left unchanged. Retry with the updated CLI.
== after (this branch, packed)
{"ok":true,"ms":3126,"valid":true,"rawBytes":1000095,"lastRunCommandChars":1000017}

== before (published 2026.10.5-beta.3), Linux Node 24.21 (Docker)
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 1 without a result. The existing service definition was left unchanged. Retry with the updated CLI.
== after (this branch, packed)
{"ok":true,"ms":1194,"valid":true,"rawBytes":1000095,"lastRunCommandChars":1000017}

The before output matches the reporter's beta.2 warning byte for byte.

Real update from a published beta updater, before and after. scripts/e2e/published-driver-update-docker.sh accepts only stable drivers, and stable drivers hand finalization to the fresh candidate driver, so they never do the failing read. I ran a proof-only copy of the cell, not committed, that changes three things:

  • It accepts a beta driver.
  • It pads the config with a schema-valid 3,200-entry custom provider catalog, leaving 1,341,665 bytes on disk right before the update.
  • It records the systemd unit before and after.

The beta-driver acceptance is the only harness change; the rest is the stock cell: managed user-systemd service, Doctor-seeded state, sessions, openclaw update --tag <tgz> --yes --json.

Cell (Docker, Linux) candidate-config-read-failed warnings Update result
Published 2026.10.5-beta.2 updater → published 2026.10.5-beta.3 7 (4 at activation, 3 after post-install Doctor) finished/succeeded, readyz 200, running version verified
Same beta.2 updater → this branch (5b960707702, relabeled 2026.10.5-beta.4) 4 (activation only), 0 after post-install Doctor finished/succeeded, readyz 200, running version verified
== before: beta.2 updater → published beta.3 (after post-install Doctor)
└  Doctor complete.
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 1 without a result. The existing service definition was left unchanged. Retry with the updated CLI.
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 1 without a result. The existing service definition was left unchanged. Retry with the updated CLI.
[update:warning:candidate-config-read-failed] Candidate config read failed: reader process exited with code 1 without a result. The existing service definition was left unchanged. Retry with the updated CLI.

== after: beta.2 updater → this branch (after post-install Doctor)
└  Doctor complete.
(no candidate-config-read warnings)

The before output matches the reporter's beta.2 → beta.3 log on Debian. An instrumented copy of published beta.3 logged one of those reads exiting 1 after only 146,176 bytes of its frame. That is the partial fs.writeFileSync(1, …) write.

What remains. All four warnings left in the after cell carry the old "Retry with the updated CLI" text, which this branch no longer emits. The installed beta.2 updater's own reader produces them during activation, and a candidate cannot change that code. The fixed alias's new wording never appears because none of its reads failed.

Unit. In both cells, the candidate's managed-service reconciliation still refreshed the unit afterward. The only diff was Environment=PATH, which gained the pnpm bin directories. In this harness the failed reads therefore cost warnings, not a stale unit. The reporter's unit with user drop-ins took the "left unchanged" path. This harness's systemctl shim reports service inspection as unavailable for a unit with drop-ins, so that path isn't reproduced here.

Correction to the earlier cells. The previous cells padded wizard.lastRunCommand, but the cell's seed openclaw doctor --fix rewrites that field. The instrumented reader returned only about 16 KB, so those runs never exercised a large frame. The catalog padding above survives Doctor.

Tests

  • pnpm test test/scripts/update-config-runtime-compat.test.ts --maxWorkers=1: 4 passed, 4s wall. Its large-frame regression fails before the fix with reader process exited with code 1 without a result.
  • pnpm test test/scripts/runtime-postbuild.test.ts --maxWorkers=1: 143 passed, 13s wall.
  • node scripts/check-changed.mjs -- <touched files>: everything passes except the dead-export scan. That scan flags unrelated ui/src/components/overlay-lifecycle.ts, overlay-registry.ts and ui/src/lib/tabs-controller.ts exports this PR doesn't touch. git diff --check is clean.

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S labels Oct 12, 2026
@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR streams complete config-reader responses and gives profile-aware recovery instructions when service refresh fails.

Example: A published beta.2 updater reads a candidate configuration containing a 3,200-entry provider catalog totaling 1,341,665 bytes.

  • Before: The beta.3 candidate produces three config-reader warnings after Doctor.
  • After: The packed PR candidate produces zero config-reader warnings after Doctor and completes the update successfully.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused root-cause repair with shipped-entry-point proof, useful regression coverage, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied terminal output exercises packed candidate config reads on macOS and Linux and the published beta.2 update CLI against head 5b96070 with a 1,341,665-byte config: post-Doctor reader warnings disappear and readiness/version verification succeeds; old-driver activation warnings remain, and the harness does not reproduce drop-in service preservation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updates with large config snapshots emit reader-failure warnings and can skip service-definition refresh.
Reason: The narrow transport repair restores the existing read contract, and maintainer authorship supplies direction approval.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused fix for large candidate-config responses that still fail on current main; no actionable correctness or security findings remain.

Priority: P2
Reviewed head: 5b960707702d451fc887747e4054bb57978c2274

Before merge

None.

Findings

None.

Agent review details

How this fits together

The generated candidate runtime alias receives config-read requests from installed updaters, executes them in fresh child processes, and returns framed snapshots to update and service-management callers.

flowchart LR
 A[Installed updater] --> B[Candidate runtime alias]
 B --> C[Fresh reader child]
 C --> D[Candidate config owner]
 D --> E[Framed stdout response]
 E --> B
 B --> F[Service reconciliation]
Loading

Technical review

Best possible solution:

Land the focused stream-write repair while preserving the existing framing, diagnostic isolation, and best-effort fallback.

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

Current-main source exposes the partial direct-write path, and supplied published-package traces reproduce the missing-frame failure with large snapshots; this read-only review executed no target code.

Is this the best way to solve the issue?

Using the existing stream writer fixes the producer's partial-write failure without changing the protocol or introducing another owner; the revised instruction resolves the earlier profile-recovery finding.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Candidate config-reader stdout transport changes intended behavior with a stated reason (5836021: Replace extra-descriptor transport with one framed stdout response supported by Node and Bun, keeping diagnostics separate.)
  • Failure diagnostics and recovery advice keeps the original intent (f67c8ff: Expose bounded reader failure reasons while withholding stderr and retaining the optional-read fallback.)
  • Historical alias recognition keeps the original intent (5d0afd0: Recognize exact historical generated aliases so compatibility tracing can follow published runtime contracts.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5836021 adds scripts/lib/update-config-runtime-compat.mts:73 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5836021e126c; files: scripts/lib/update-config-runtime-compat.mts)
  • Donnie Fiander: Raw commit f67c8ff adds scripts/lib/update-config-runtime-compat.mts:135 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f67c8ffc7287; files: scripts/lib/update-config-runtime-compat.mts)
  • Patrick Erichsen: Raw commit 78e8de2 adds scripts/lib/update-config-runtime-compat.mts:123 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 78e8de276bd2; files: scripts/lib/update-config-runtime-compat.mts)

PR surface

Tests +33, Docs +2, Other +9. Total +44 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 35 2 +33
Docs 1 4 2 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 1 13 4 +9
Total 3 52 8 +44

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Large-config updates can skip optional service refresh, but the demonstrated updates finish and the Gateway remains verified.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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 (2 earlier review cycles)
  • reviewed 2026-10-12T23:31:50.055Z sha ad914a0 :: needs changes before merge. :: [P2] Preserve the selected profile in the recovery instruction
  • reviewed 2026-10-14T02:02:01.148Z sha 5b96070 :: needs maintainer review before merge. :: none

Reviewed October 13, 2026, 11:44 PM ET / October 14, 2026, 03:44 UTC (Revision 3).

@RomneyDa
RomneyDa marked this pull request as ready for review October 13, 2026 04:28
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

Drop the beta.2 alias text fixture; the retained hash is verified against the
published 2026.10.3, 2026.10.5-beta.2, and 2026.10.5-beta.3 tarballs.
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 14, 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 14, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa enabled auto-merge (squash) October 14, 2026 12:26
@RomneyDa
RomneyDa merged commit 043614d into main Oct 14, 2026
128 checks passed
@RomneyDa
RomneyDa deleted the fix/170331-config-reader-frame branch October 14, 2026 12:28
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…hot is large (openclaw#170373)

* fix(update): flush large candidate config reader frames

Closes openclaw#170331

* fix(update): keep the profile in config reader recovery advice

Drop the beta.2 alias text fixture; the retained hash is verified against the
published 2026.10.3, 2026.10.5-beta.2, and 2026.10.5-beta.3 tarballs.
RomneyDa added a commit that referenced this pull request Oct 16, 2026
…hot is large (#170373)

* fix(update): flush large candidate config reader frames

Closes #170331

* fix(update): keep the profile in config reader recovery advice

Drop the beta.2 alias text fixture; the retained hash is verified against the
published 2026.10.3, 2026.10.5-beta.2, and 2026.10.5-beta.3 tarballs.

(cherry picked from commit 043614d)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…hot is large (openclaw#170373)

* fix(update): flush large candidate config reader frames

Closes openclaw#170331

* fix(update): keep the profile in config reader recovery advice

Drop the beta.2 alias text fixture; the retained hash is verified against the
published 2026.10.3, 2026.10.5-beta.2, and 2026.10.5-beta.3 tarballs.

(cherry picked from commit 043614d)
(cherry picked from commit 166c02d)
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: S 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.2 update candidate config read exits 1 and leaves the systemd unit unchanged

1 participant