Repository navigation
fix(update): service definition refresh skipped when the config snapshot is large - #170373
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +33, Docs +2, Other +9. Total +44 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 13, 2026, 11:44 PM ET / October 14, 2026, 03:44 UTC (Revision 3). |
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
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.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…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.
…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)
…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]>
Closes #170331
What Problem This Solves
Fixes:
openclaw updatewarnscandidate-config-read-failed: reader process exited with code 1 without a resultand 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 --forcewith the same--profileor--devoption 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.jsreader child touchedprocess.stdout, which makes fd 1 non-blocking, and then wrote its result frame withfs.writeFileSync(1, …). Once the frame exceeded the pipe buffer, the write threwEAGAINpartway 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 callsprocess.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.--containerdoesn't apply becauseformatCliCommandnever 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 inisUpdateConfigRuntimeAliasso 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 publisheddist/io.runtime.js:latest)beta)The hash is required:
update:compat:checkmust trace the currentlatestandbetadist-tags. The earlier draft added a 123-line.txtcopy 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.jsis then imported the way an older updater imports it after replacement (OPENCLAW_UPDATE_IN_PROGRESS=1), using an isolatedHOME/state and a valid 1,000,095-byte config, andreadConfigFileSnapshot()is called: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.shaccepts 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: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.candidate-config-read-failedwarnings2026.10.5-beta.2updater → published2026.10.5-beta.35b960707702, relabeled2026.10.5-beta.4)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 seedopenclaw doctor --fixrewrites 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 withreader 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 unrelatedui/src/components/overlay-lifecycle.ts,overlay-registry.tsandui/src/lib/tabs-controller.tsexports this PR doesn't touch.git diff --checkis clean.