Skip to content

fix(update): keep argument-error launcher fix at format 4 - #208734

Merged
obviyus merged 1 commit into
mainfrom
fix/launcher-format-4
Nov 30, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/launcher-format-4

Conversation

@obviyus

@obviyus obviyus commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Keeps fix: exit once when gateway run rejects an argument after an update #208068's openclaw.usage-error message, exit-once behavior, and argument-error exit code 1; removes only the launcher format increase (5 → 4).
  • Restores the existing format-4 refresh regression and protects installed format 5 and higher. Production: +1/-1 (net 0); tests: +4/-4 (net 0).
  • Current main already moved the documentation to docs/install/updating/implementation-background.md and removed the format-specific wording; no further documentation change is needed.

Checks

  • Passed on mbp-m5 (vitest-source): ~/.local/bin/ocx test src/update/launcher.test.ts src/update/frozen-contract.test.ts — 2 files, 20 tests. src/update/frozen-contract.test.ts is unchanged.
  • The launcher regression verifies that different installed format-4 bytes are replaced by a format-4 writer, while a format-5 launcher is preserved. Thus an older format-4 release can restore its launcher after downgrade, without a format lock.
  • Historical source before fix: exit once when gateway run rejects an argument after an update #208068 ignores unknown IPC message types, so the new usage-error message does not change an older launcher's behavior.
  • CI: passed, including openclaw/ci-gate, changed Node tests, lint/types, and Docker seed E2E.
  • Package Acceptance update-restart-auth: passed (23m05s) at head cdc9a5a246ece97ae87047355a696e454d69bd74, with published_upgrade_survivor_baseline=openclaw@latest.
  • The Package Acceptance parent is red only because of the unrelated npm 12 install.sh package-budget gate (main: installed package tree over the 47,500-entry budget (47,745), 2,255 entries from the shipped-updater cap #208295): 47,555 entries against a 47,500 budget; size 585.3 MiB is below its 900 MiB budget.

Accepted edge

  • A main/dev installation that wrote a format-5 launcher since 2026-11-29 13:00Z keeps that launcher until it is replaced.
  • No built-in command overwrites an existing higher-format launcher: updates use the guarded writer (src/update/run.ts:459, src/update/launcher.ts:275), service installation selects the existing launcher, and Doctor only repairs an exact legacy hash.
  • Manual repair for this unreleased main/dev window: use a trusted checkout containing this fix with its development dependencies installed. Run as the installation owner and explicitly set OPENCLAW_STATE_DIR to the affected installation's state directory (including when it normally uses a profile). Unset OPENCLAW_CONTAINER when operating on the host Gateway. Stop it with openclaw gateway stop, then run the following from that checkout; finally run openclaw gateway start. Keep the backup until startup succeeds. This directly invokes the real writer rather than relying on an update that might be an already-current no-op.
node --import tsx --input-type=module -e '
import fs from "node:fs/promises";
import path from "node:path";
import { resolvePrefix } from "./src/update/store.ts";
import { writeLauncher } from "./src/update/launcher.ts";
const prefix = resolvePrefix();
const launcher = path.join(prefix, "openclaw-launcher.mjs");
await fs.rename(launcher, launcher + ".format-5.bak");
await writeLauncher(prefix);
'
  • resolvePrefix selects the installation's git-install directory (src/update/store.ts:41-42); moving the file aside makes the read return ENOENT (src/update/launcher.ts:268-273), so the real writer emits fresh format-4 bytes (src/update/launcher.ts:275-284). Verified in an isolated real writer run on Studio after mbp-m5 became unreachable: format 5 was initially preserved; the move-aside/writer sequence created format 4 with container routing and left the backup unchanged. No Gateway or live installation was changed.

- Keep #208068 behavior without preventing older format-4 writers from refreshing the launcher.
@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Pull request received.

ClawSweeper review complete

ClawSweeper finished reviewing this revision.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 30, 2026
@clawsweeper

clawsweeper Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR restores launcher format 4 while retaining argument-error handling and preserving installed launchers with higher formats.

Example: An installation later returns to an older format-4 writer.

  • Before: A format-5 launcher cannot be refreshed by that writer.
  • After: A launcher newly written as format 4 can be refreshed; already-installed format-5 launchers remain preserved.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is minimal and source-supported, with confidence limited by incomplete runtime acceptance for the changed format behavior.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is exempt from contributor proof gating; the reported focused tests exercise launcher writing, while inspected screenshots from the earlier PR prove argument-error handling rather than this format correction, and current acceptance remains incomplete.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Returning to an older format-4 release leaves its launcher writer unable to refresh a format-5 executable.
Reason: The collaborator-authored direction restores existing refresh behavior with a minimal change and explicitly accepts the limitation for installations already on format 5.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it makes a focused compatibility repair without changing the argument-error fix, and source review found no introduced defect.

Reviewed head: cdc9a5a246ece97ae87047355a696e454d69bd74

Before merge

None.

Findings

None.

Agent review details

How this fits together

The update owner writes a resident launcher that starts the selected Gateway release, handles trial recovery, and exchanges lifecycle messages with its child.

flowchart TD
  A[OpenClaw update] --> B[Launcher writer]
  B --> C[Installed launcher]
  C --> D[Selected Gateway release]
  D --> E[Lifecycle IPC]
  E --> C
  C --> F[Trial recovery]
Loading

Technical review

Best possible solution:

Keep the minimal format-4 correction and existing higher-format preservation without adding another launcher replacement path.

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

Source establishes that an older format-4 writer refuses an installed format-5 launcher; no fresh reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Restoring the marker is the smallest complete repair because the IPC addition is backward compatible and the existing writer already supports same-format refresh.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Launcher format marker changes intended behavior with a stated reason (516166c: The earlier argument-error repair raised the launcher format while adding usage-error IPC and terminal handling of confirmed argument refusals.)
  • Same-format refresh and higher-format preservation keeps the original intent (test(update): verify newer launcher formats stay intact #204753: The regression protects newer launcher bytes through both writers; subsequent same-format refresh behavior permits compatible launcher repairs without a format increase.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Pinned change: The introduced production change only lowers LAUNCHER_FORMAT from 5 to 4; the remaining hunks adjust the existing refresh and preservation regression. (src/update/launcher.ts:10, cdc9a5a246ec)
  • Existing writer owns replacement: writeLauncher replaces different bytes at an equal or lower format and preserves higher formats, so restoring format 4 removes the unnecessary barrier for older format-4 writers. (src/update/launcher.ts:275, cdc9a5a246ec)
  • Distinct compatibility checks retained: The adjusted regression checks format-4 refresh, unchanged-file preservation, and byte-for-byte preservation of format 5 and a larger valid integer through both launcher writers. (src/update/launcher.test.ts:520, cdc9a5a246ec)
  • Current main still writes format 5: The fetched main revision retains LAUNCHER_FORMAT = 5, so this compatibility change is not already implemented there. (src/update/launcher.ts:10, 6442e281211b)
  • Earlier IPC remains compatible: Source preceding fix: exit once when gateway run rejects an argument after an update #208068 ignores messages other than ready and trial; the additive usage-error message therefore does not require an incompatible wire-format transition. (src/update/launcher.ts, 6442e281211b)
  • Accepted installed-format edge: The collaborator-authored PR explicitly accepts preserving existing format-5 installations and explains that update, service installation, and Doctor provide no verified command to rewrite them; the resident writer, legacy writer, and exact-hash Doctor repair support that limitation. (cdc9a5a246ec)

PR surface

Source 0, Tests 0. Total 0 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 4 4 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 5 0

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The executable format marker controls replacement across releases; preserving already-installed format-5 launchers is an explicitly accepted compatibility limitation.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • merge-risk: 🚨 compatibility: The executable format marker controls replacement across releases; preserving already-installed format-5 launchers is an explicitly accepted compatibility limitation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ 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.

Reviewed November 29, 2026, 9:54 PM ET / November 30, 2026, 02:54 UTC.

@obviyus

obviyus commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Rejected review finding: P1 — a format-5 launcher written between #208068 and #208271 retains the pre-#208271 implementation, so OPENCLAW_CONTAINER=remote openclaw gateway run can still enter a host trial on those installs.

This is the explicitly accepted main/dev edge. No release tag contains #208068 (516166cf75); only unreleased main/dev builds wrote format 5. AGENTS.md does not treat main/beta/nightly code as a shipped compatibility contract. Adding a format-5 exception would add compatibility code for this unreleased window rather than restore the requested format number.

Manual repair (also recorded in the PR body): stop the affected host Gateway, move its launcher to a backup, invoke the real writeLauncher from a trusted fixed checkout, then start the Gateway. Use the installation owner and explicitly set OPENCLAW_STATE_DIR to that installation's state directory; unset OPENCLAW_CONTAINER for the host stop/start commands. Development dependencies must be installed in the checkout.

openclaw gateway stop
# From the trusted checkout containing this PR:
node --import tsx --input-type=module -e '
import fs from "node:fs/promises";
import path from "node:path";
import { resolvePrefix } from "./src/update/store.ts";
import { writeLauncher } from "./src/update/launcher.ts";
const prefix = resolvePrefix();
const launcher = path.join(prefix, "openclaw-launcher.mjs");
await fs.rename(launcher, launcher + ".format-5.bak");
await writeLauncher(prefix);
'
openclaw gateway start

Keep the backup until startup succeeds. There is no built-in force-overwrite command: updates call the guarded writer at src/update/run.ts:459; an already-current update can return before reaching it. resolvePrefix selects git-install at src/update/store.ts:41-42; after the move, ENOENT is handled at src/update/launcher.ts:268-273 and fresh bytes are written at src/update/launcher.ts:275-284.

Verification: an isolated real writer run confirmed format 5 was preserved before the move; moving it aside and calling writeLauncher created format 4 with container routing and left the backup unchanged. No production/test code changes.

@obviyus

obviyus commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Rejected review findings:

@obviyus
obviyus merged commit b69d632 into main Nov 30, 2026
191 of 193 checks passed
@obviyus
obviyus deleted the fix/launcher-format-4 branch November 30, 2026 03:34
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
…08734)

## Summary
- Keeps openclaw#208068's `openclaw.usage-error` message, exit-once behavior, and argument-error exit code 1; removes only the launcher format increase (5 → 4).
- Restores the existing format-4 refresh regression and protects installed format 5 and higher. Production: +1/-1 (net 0); tests: +4/-4 (net 0).
- Current main already moved the documentation to `docs/install/updating/implementation-background.md` and removed the format-specific wording; no further documentation change is needed.

## Checks
- Passed on mbp-m5 (vitest-source): `~/.local/bin/ocx test src/update/launcher.test.ts src/update/frozen-contract.test.ts` — 2 files, 20 tests. `src/update/frozen-contract.test.ts` is unchanged.
- The launcher regression verifies that different installed format-4 bytes are replaced by a format-4 writer, while a format-5 launcher is preserved. Thus an older format-4 release can restore its launcher after downgrade, without a format lock.
- Historical source before openclaw#208068 ignores unknown IPC message types, so the new usage-error message does not change an older launcher's behavior.
- [CI](https://github.com/openclaw/openclaw/actions/runs/46342048808): **passed**, including `openclaw/ci-gate`, changed Node tests, lint/types, and Docker seed E2E.
- Package Acceptance [`update-restart-auth`](https://github.com/openclaw/openclaw/actions/runs/46342048363/job/141602120900): **passed** (23m05s) at head `cdc9a5a246ece97ae87047355a696e454d69bd74`, with `published_upgrade_survivor_baseline=openclaw@latest`.
- The [Package Acceptance parent](https://github.com/openclaw/openclaw/actions/runs/46342048363) is red only because of the unrelated npm 12 install.sh package-budget gate (openclaw#208295): 47,555 entries against a 47,500 budget; size 585.3 MiB is below its 900 MiB budget.

## Accepted edge
- A main/dev installation that wrote a format-5 launcher since 2026-11-29 13:00Z keeps that launcher until it is replaced.
- No built-in command overwrites an existing higher-format launcher: updates use the guarded writer (`src/update/run.ts:459`, `src/update/launcher.ts:275`), service installation selects the existing launcher, and Doctor only repairs an exact legacy hash.
- Manual repair for this unreleased main/dev window: use a trusted checkout containing this fix with its development dependencies installed. Run as the installation owner and explicitly set `OPENCLAW_STATE_DIR` to the affected installation's state directory (including when it normally uses a profile). Unset `OPENCLAW_CONTAINER` when operating on the host Gateway. Stop it with `openclaw gateway stop`, then run the following from that checkout; finally run `openclaw gateway start`. Keep the backup until startup succeeds. This directly invokes the real writer rather than relying on an update that might be an already-current no-op.

```sh
node --import tsx --input-type=module -e '
import fs from "node:fs/promises";
import path from "node:path";
import { resolvePrefix } from "./src/update/store.ts";
import { writeLauncher } from "./src/update/launcher.ts";
const prefix = resolvePrefix();
const launcher = path.join(prefix, "openclaw-launcher.mjs");
await fs.rename(launcher, launcher + ".format-5.bak");
await writeLauncher(prefix);
'
```

- `resolvePrefix` selects the installation's `git-install` directory (`src/update/store.ts:41-42`); moving the file aside makes the read return ENOENT (`src/update/launcher.ts:268-273`), so the real writer emits fresh format-4 bytes (`src/update/launcher.ts:275-284`). Verified in an isolated real writer run on Studio after mbp-m5 became unreachable: format 5 was initially preserved; the move-aside/writer sequence created format 4 with container routing and left the backup unchanged. No Gateway or live installation was changed.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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.

1 participant