Repository navigation
Bump HOST_DAEMON_PROTOCOL_VERSION to 289 and guard wire schemas against unbumped drift - #8575
Open
lanjak wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
HOST_DAEMON_PROTOCOL_VERSION(protocol.ts#L1) is the only wire-compatibility gate between the server and enrolled host daemons, andcontract.test.tsonly asserted the hardcoded version literal (288). Wire schema and constant changes could therefore merge without bumpingHOST_DAEMON_PROTOCOL_VERSION, leaving enrolled daemons passing the version check and failing Zod validation without triggering self-update. Investigation report: https://get-bb.github.io/reports/issues/8565.htmlWhat changed
packages/host-daemon-contract/src/protocol.ts: bumpedHOST_DAEMON_PROTOCOL_VERSIONfrom288to289so any drifted<= 288daemons trigger self-update.packages/host-daemon-contract/test/wire-contract-hash.ts: addedWIRE_CONTRACT_BASELINE({ version: 289, hash }),createDefaultWireContractInput(), andcomputeWireContractHash()computing a deterministic SHA-256 over a recursively key-sorted JSON snapshot of:hostDaemonCommandRegistryentry (type,transport,retryable,flushEventsBeforeResult,envLane, requestschema,resultSchema),HOST_DAEMON_SETTLED_COMMAND_TYPESandHOST_DAEMON_ONLINE_RPC_COMMAND_TYPES,ZodTypeschemas fromsrc/index.ts,src/workspace.ts,serverMoveCommandSchemas,serverMoveResultSchemas,desktopBrowserCommandSchemas, anddesktopBrowserResultSchemas(usingz.toJSONSchema(..., { unrepresentable: "any", io: "input", override })with"x-zod-custom": truesoUint8Array/ custom schemas serialize safely and stay distinct fromz.unknown()),HOST_ARTIFACT_MAX_BYTES,HOST_FILE_CHUNK_MAX_BYTES,HOST_FIND_GIT_REPOS_*,HOST_DAEMON_TERMINAL_EXIT_RETENTION_MS, error codes, WS resume constants), excludingHOST_DAEMON_PROTOCOL_VERSIONitself.packages/host-daemon-contract/test/contract.test.ts: updated version assertions to289(288rejected), added the baseline drift guard assertingWIRE_CONTRACT_BASELINE.version === HOST_DAEMON_PROTOCOL_VERSIONandcomputeWireContractHash() === WIRE_CONTRACT_BASELINE.hash, and added mutation tests proving field, enum, and constant edits change the hash.AGENTS.mdalready specifies bumpingHOST_DAEMON_PROTOCOL_VERSIONon wire changes.Wire change:
HOST_DAEMON_PROTOCOL_VERSIONbumped288->289.node packages/plugin-sdk/scripts/check-npm-version-guard.mjspassed with noPLUGIN_SDK_VERSIONbump needed.Design choice: hash the full wire surface named in
AGENTS.md(session payloads, WebSocket messages, host RPC commands/results, and wire constants) insidecontract.test.tswith a checked-in{ version, hash }baseline and no separate--checkscript or generated module. Precedent:AGENTS.md(wire-bump rule and no generated/--checkmodules),packages/plugin-sdk/scripts/check-npm-version-guard.mjs(guarding the full effective surface rather than a narrow literal), andfba25ee0bc(plain Vitest drift test). Trade-off: additive optional fields also trip the hash, forcing an explicit decision to either bumpHOST_DAEMON_PROTOCOL_VERSIONor intentionally update the baseline alongside a compatibility test; pure semantic-only changes that leave schemas and constants identical cannot be caught by a schema hash. The alternative is comparing against the published npm package (likecheck-npm-version-guard.mjs) or hashing only breaking fields/registry entries. A maintainer can ask for a different choice in a comment or push commits to this branch.How you verified
Base commit:
origin/mainf5af70c9c5.origin/main)9de996be30)HOST_DAEMON_PROTOCOL_VERSIONcontract.test.tspasses silentlyHOST_FILE_CHUNK_MAX_BYTEScomputeWireContractHash()288isCompatibleHostDaemonProtocolVersion(288) === false)CI parity command:
pnpm exec turbo run typecheck test lint lint:type-aware --filter=@bb/host-daemon-contract --continuetypecheck,lint,lint:type-aware: 0 warnings, 0 errors.test: 6/7 files passed (99/100 tests, including 58/58 incontract.test.ts; onlypayload-size.test.tsfailed locally due to Node 26zlibgzip byte-count mismatch).node packages/plugin-sdk/scripts/check-npm-version-guard.mjs: passed.Fixes #8565