Skip to content

fix(server): update commands match a global styal install - #837

Merged
incognitojam merged 1 commit into
mainfrom
fix/update-commands-match-styal-install
Oct 15, 2026
Merged

incognitojam merged 1 commit into
mainfrom
fix/update-commands-match-styal-install

Conversation

@incognitojam

Copy link
Copy Markdown
Owner

A styal server installed with npm i -g @styal/cli and started from a terminal was given npx @styal/cli@<version> serve as its update command. That runs the new version once but leaves the installed styal command on the old version, so the update notice comes back on the next launch.

This ports upstream's installation detection from pingdotgg#15539 to styal's npm identity. That upstream commit is already recorded on main without its changes, because its detection only recognized T3 Code's t3 package.

  • The server proves a global install from the lib/node_modules/@styal/cli layout:
    • <prefix>/bin/styal must resolve to the running launcher.
    • A running platform executable (@styal/cli-<platform>/styal) must match the launcher's version and its optional dependency.
  • The server reports the result, or an npx, pnpm dlx or bunx start, in the optional serverInstallation environment capability.
  • For a foreground server, the update instructions in chat, Connections settings and the auto-balance banner now copy:
    • for a proven global install: npm install --global --prefix '<prefix>' @styal/cli@<version>, followed by a note to restart styal;
    • for a runner start: serve through the same runner;
    • for anything unproven, including Windows: the existing npx @styal/cli@<version> serve, with a note that it doesn't update an installed styal command.
  • The one-time service migration command is unchanged. Mobile has no manual-command surface.
  • The update docs and the server-update-guidance ledger entry are updated.

Update dialog for a global install under a prefix containing a space

Validation

  • Installed the published @styal/cli into a scratch prefix with npm install --global --prefix. Ran this branch's detection against the installed launcher, the global bin and the @styal/cli-linux-x64/styal executable. It reported {"kind":"npm-global","prefix":"<scratch prefix>"}. The legacy dist/bin.mjs entry correctly reported nothing.
  • In a real web client, the server's version was set older than the client's and its installation reported as a global install under /opt/node tools; both were set with a temporary local override that isn't part of this change. The Connections update dialog showed the screenshot above. The prefix was quoted correctly, and Copy is labelled "Copy update command". The screenshot uses a synthetic environment name.
  • Focused tests pass, 67 across 5 files. They cover:
    • detection ownership: runner caches; a global bin symlink that is present, missing or unrelated; a native version mismatch; win32; local and standalone installs;
    • descriptor publishing;
    • contract decoding;
    • command formatting, including that the service migration command ignores the installation.
  • Contracts, server and web typecheck pass.

These cases behave the same as upstream:

  • A root-owned global prefix gets a command that needs sudo.
  • Leading or trailing whitespace in a prefix is trimmed by the contract.

Written by an agent (Claude Code, claude-opus-5-5).

A foreground styal server installed with `npm i -g @styal/cli` was told to run `npx @styal/cli@<version> serve`. That runs the new version once but leaves the installed `styal` command old, so the update notice returns on the next launch.

Port upstream's installation detection onto the fork's npm identity. The server now proves a global install from the `lib/node_modules/@styal/cli` layout: the prefix's `bin/styal` must resolve to the running launcher, and a running platform executable must match the launcher's version and optional dependency. It advertises the result in the optional `serverInstallation` capability, along with npx, pnpm dlx, and bunx starts. The web update instructions for a foreground server now copy `npm install --global --prefix '<prefix>' @styal/cli@<version>` for a proven global install, and `serve` through the same runner otherwise. The service migration command is unchanged.

Fork-Feature: server-update-guidance
Co-authored-by: maria <maria@kuuro.net>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Upstream divergence

Both sides are compared with upstream at the in-order tip 06e627448b. Excludes .repos/ and pnpm-lock.yaml.

Measure Base This PR Change
Upstream files the fork changes 1,373 1,373 0
Lines changed in them 64,222 64,046 −176
Upstream files the fork removes 41 41 0
Fork-only files 435 435 0
Fork-only lines 74,641 74,646 +5
Upstream files whose difference changes (13)
File Change Now differs by
apps/server/src/cli/invocation.test.ts −100 92 lines
apps/server/src/cli/invocation.ts −48 44 lines
apps/server/src/environment/ServerEnvironment.test.ts −37 11 lines
apps/web/src/versionSkew.test.ts +27 92 lines
packages/contracts/src/environment.test.ts −16 8 lines
apps/web/src/components/ServerUpdateAction.tsx +15 329 lines
docs/user/updating.md +11 81 lines
packages/contracts/src/environment.ts −9 12 lines
apps/web/src/versionSkew.ts −7 53 lines
apps/web/src/components/settings/ConnectionsSettings.tsx −5 122 lines
apps/server/src/environment/ServerEnvironment.ts −3 14 lines
apps/web/src/components/ChatView.tsx −3 775 lines
apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx −1 3 lines

@github-actions

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 4.9 KiB −40 B (−0.8%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB −40 B (−3.3%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.8 KiB −41 B (−0.2%) 29.3 KiB ✅
Codex Live turn messages 2 1 −1 (−50.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: 2c68e22 · PR result: b3653e5 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@incognitojam
incognitojam merged commit dff3317 into main Oct 15, 2026
26 checks passed
@incognitojam
incognitojam deleted the fix/update-commands-match-styal-install branch October 15, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant