Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(daemon): let an installed version stand as its whole code identity - #2569

Open
thymikee wants to merge 1 commit into
mainfrom
t3code/fix-2458-quality-refactor
Open

fix(daemon): let an installed version stand as its whole code identity#2569
thymikee wants to merge 1 commit into
mainfrom
t3code/fix-2458-quality-refactor

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Two installs of one published version signed their identical bytes differently: the fingerprint is size:mtime, and an installer stamps a fresh mtime on every file. The second client read code-signature mismatch, replaced a daemon already running exactly its code, and dropped the live session on it.

An installed tree's version already fixes its bytes, so it now answers with no fingerprint and the version alone decides reuse. A source checkout — where code does move under an unchanged version — keeps the check, and keeps its worktree-scoped state directory. The installed/source predicate moves next to the project-root walk it shares (@agent-device/host-kit/version), and the takeover ladder moves beside the answer it consumes.

Behavior seen by users: $B devices no longer prints Replacing daemon ... code-signature mismatch when a same-version install started the daemon. website/docs/docs/security-trust.md states the residual limit (hand-patched node_modules, a registry serving one version twice).

Touched files: 9 (+288/-53), one command family.

Validation

Commit 5fef822379.

  • pnpm check:quick, check:layering, check:production-exports, check:package pass; the new packaging assertion ran against a clean install: "Confirmed the installed tree carries no daemon source".
  • pnpm gate vitest-related <changed files>: 539 files / 4224 tests pass.
  • Two clean installs of one packed version, dist mtimes shifted: the second client reused pid and reported nothing on stderr. A source-checkout client against the same --state-dir still prints code-signature mismatch and takes over.
  • Regression proof: dropping the installed guard fails 4 tests; the naive info.codeSignature !== await ... compare fails the Same published version installed twice replaces the daemon and drops the live session #2458 reuse test.

Unresolved: mutation-model fails locally at merge-base ab3d11e069 too (gestures.test.ts no longer reaches scroll-edge-state) — advisory-only per #1457, workflow path-filtered away from this diff.

Two installs of one published version signed their identical bytes
differently, because the fingerprint is size:mtime and an installer stamps a
fresh mtime on every file. The second client therefore read "code-signature
mismatch" and replaced a daemon that already ran exactly its code, dropping
the live session on it (#2458).

An installed tree's version already fixes its bytes, so it now answers with
no fingerprint and the version alone decides reuse. A source checkout, where
code does move under an unchanged version, keeps the check. The predicate
that tells the two trees apart moves beside the project-root walk it shares,
and the takeover ladder moves beside the answer it consumes so the order
lives in one place.

The packaging gate proves the premise against a clean install: the published
tree ships no src/daemon.ts.

Closes #2458
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstack.github.io/agent-device/pr-preview/pr-2569/

Built to branch gh-pages at 2026-09-13 18:49 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.52 MB 4.52 MB +151 B
Package (unpacked) 4.52 MB 4.52 MB +151 B
Package (download) 1.33 MB 1.33 MB +80 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.2 ms 22.1 ms -1.1 ms
CLI --help 64.0 ms 60.1 ms -3.9 ms

@thymikee

Copy link
Copy Markdown
Member Author

The signature bypass at daemon-launch-spec.ts:113 only checks the client. With an explicit shared --state-dir, a modified source checkout can start a daemon under the published version, and an installed client now reuses that modified code. #2458 scopes the bypass to both sides being installed. Record the daemon’s code origin or equivalent package identity and bypass fingerprints only for two matching installed versions; add the source-daemon → installed-client case. Checks are green, but this remains a code blocker at 5fef822.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant