Skip to content

host-daemon-contract: wire schema changes merged without HOST_DAEMON_PROTOCOL_VERSION bumps; literal-only guard misses drift #8565

Backlog

Description

@ozekimasaki

What is wrong

HOST_DAEMON_PROTOCOL_VERSION (packages/host-daemon-contract/src/protocol.ts:1, currently 286) is the only wire-compatibility signal, and compatibility is exact-equality (HOST_DAEMON_COMPATIBLE_PROTOCOL_VERSIONS, protocol.ts:8-10; enforced in apps/server/src/internal/session.ts:196-218). AGENTS.md requires a bump for any change to server/daemon wire fields (type, requiredness, default, meaning). Five recent commits touching commands.ts changed wire shapes and merged with the version unchanged (verified with git show <commit>^:packages/host-daemon-contract/src/protocol.ts == git show <commit>:...):

Impact

An enrolled daemon reporting the same number with an older schema passes the version gate, then hard-fails zod parse on the changed fields. apps/host-daemon/src/protocol-self-update.ts:288 only self-updates when server.protocolVersion > HOST_DAEMON_PROTOCOL_VERSION, so this state never heals.

Why nothing catches it

packages/host-daemon-contract/test/contract.test.ts:1118 asserts toBe(286) — a hand-edited literal. Schema changes without a bump pass CI silently.

Proposed fix

  1. Bump to 287 once (invalidates every possibly-drifted ≤286 daemon; exact-match gate then triggers the existing self-update path).
  2. Add a checked-in wire baseline: { version, hash } where hash is a stable sha256 over z.toJSONSchema of every hostDaemonCommandRegistry entry (request + result), the settled/online RPC type lists, the ws resume schema, and wire constants (HOST_FILE_CHUNK_MAX_BYTES, HOST_ARTIFACT_MAX_BYTES, HOST_FIND_GIT_REPOS_*). A test recomputes and fails on drift; a regen script refuses to update the hash unless the version changed. Schema change without bump then fails CI mechanically.

Ruled out: no other test or workflow currently derives the version from the schemas; grep shows the only hardcoded 286 expectation is contract.test.ts:1118.

AGENT GENERATED

Activity

  1. added theissue type on Dec 2, 2026
  2. added
    host
    confirmed-repro
    on Dec 2, 2026
  3. bb-slop-cop commented on Dec 2, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Bug · Medium priority · Medium effort · host, confirmed-repro

    REPRODUCED (high confidence): Reproduction and root-cause report. In two clean checkouts, a one-line schema change made a previously valid RPC request fail validation at the same protocol version, while all 98 contract tests passed. The version assertion checks a number, not compatibility with the previous wire schema. No installed release pair was tested.

    No PR: Forcing an update changes the public protocol, and a lasting guard needs a decision about which wire changes it must detect.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reprohost

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions