Repository navigation
feat: re-align wire protocol with command-code@1.88.2 - #69
Open
EthanBlazkowicz wants to merge 1 commit into
Open
EthanBlazkowicz wants to merge 1 commit into
EthanBlazkowicz wants to merge 1 commit into
Conversation
EthanBlazkowicz
marked this pull request as draft
October 30, 2026 16:41
EthanBlazkowicz
force-pushed
the
align-command-code-1.88.2
branch
from
October 30, 2026 16:44
710b46b to
5401652
Compare
EthanBlazkowicz
marked this pull request as ready for review
October 30, 2026 16:45
EthanBlazkowicz
force-pushed
the
align-command-code-1.88.2
branch
3 times, most recently
from
November 1, 2026 14:11
8db67aa to
eec8204
Compare
EthanBlazkowicz
force-pushed
the
align-command-code-1.88.2
branch
from
November 1, 2026 14:28
eec8204 to
f33098f
Compare
Re-verified every protocol surface the proxy emulates against command-code@1.88.2 (dist/cli.mjs, diffed against 1.53.1): - buildCommandAuthHeaders / buildCommandApiHeaders: unchanged (x-cli-surface is only sent in acp/rpc modes, not on this path) - /alpha/generate 9-key envelope + params, toWireMessages/System/ Tools/ThreadId/PermissionMode: byte-identical - stream event vocabulary unchanged; 1.88.2's new optional cache-write-tokens event is added to the silent lists so it no longer logs as an unknown event - fingerprint: salt, hashSignal, thumbmark seed, components, collectorVersion=1 all unchanged - lifecycle endpoint/eventType/metadata, buildServerConfig, default max_tokens (64e3), User-Agent: unchanged Mirrors 1.88.2's provider catalog refresh: the request is anonymous (a bare fetch, no Authorization/version headers) and conditional (accept: application/json plus if-none-match of the cached catalogVersion, with 304 meaning "reuse cache" and a cacheless 304 retried unconditionally), exactly as createModelCatalogManager fetches /provider/v1/models?view=client. Since the implemented dialect is the 1.88.2 dialect, reporting that version is truthful again - the drift warning clears instead of firing on every startup. README.md / README_zh.md updated accordingly; tests assert the catalog request shape, the conditional refresh with 304 cache reuse, and the exact reported version.
EthanBlazkowicz
force-pushed
the
align-command-code-1.88.2
branch
from
November 1, 2026 14:33
f33098f to
1165b3d
Compare
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.
Problem
Since the last alignment (
command-code@1.53.1), npm has moved to1.88.2, so every startup warns:The repo's stated rule is to report the protocol version actually implemented and never silently bump the claimed version, so this can only be resolved by re-reading the npm package and verifying the wire surface - not by changing the number.
What changed
Re-verified every protocol surface this proxy emulates against
command-code@1.88.2(dist/cli.mjs, diffed against1.53.1):Unchanged -
buildCommandAuthHeaders/buildCommandApiHeaders;/alpha/generate9-key envelope andparams;toWireMessages/toWireSystem/toWireTools/toWireThreadId/toWirePermissionMode; stream event vocabulary; device fingerprint (saltcommand-code:device-fingerprint:v1,hashSignal, thumbmark seed,components,collectorVersion: 1); lifecycle endpoint andcli_session_existsmetadata;buildServerConfig; defaultmax_tokens(64e3);User-Agent: cli.New in 1.88.2, off the emulated path -
x-cli-surfaceheader (only sent inacp/rpcsurfaces),/alpha/artifacts, expanded/alpha/sandbox/*,/provider/v1/systemone. The one new stream event,cache-write-tokens, is now in the silent lists so it does not log as unknown.Mirrored the new observable request - the provider catalog refresh now matches
createModelCatalogManager.fetchOnce: an anonymous bare fetch (noAuthorization, no version/environment headers, no fabricatedcliUA) that sendsaccept: application/jsonplusif-none-match: "<catalogVersion>"once a version is known, treats304as "reuse cache", and retries unconditionally if a 304 arrives with no cached catalog. Request URL is/provider/v1/models?view=client.Version -
CC_PROTOCOL_VERSIONis now1.88.2. Since the implemented dialect is the 1.88.2 dialect, the claim is truthful again and the drift warning clears.README.md/README_zh.mdversion references updated.Resulting behavior
Startup logs
CC CLI version in sync {"version":"1.88.2"}instead of the drift warning; generation/fingerprint/lifecycle requests keep the same header set, now withx-command-code-version: 1.88.2.Scope
6 files, +116/-28:
proxy.mjs(version constant, catalog refresh, silent lists),README.md,README_zh.md, and three test files. No client-facing API behavior changes.Linked issues
None - the drift warning is only visible in the startup log; no issue tracks it.
Test commands and results
Windows 11, Node v26.13.0, head
1165b3d:Regression coverage
view=clientviaURLSearchParamsequality,accept, and absence ofAuthorization/x-command-code-version/ fabricatedcliUA.config.json) must carryif-none-match: "\"catalog-2026-10-30.1\""; a mocked304must keep serving the cached list without a fallback warning.1.88.2asserted in the envelope test.cache-write-tokens; verified it fails without the silent-list fix.Adversarial review
Independent review agent (separate context; did not author the change). Round 1 reviewed
eec8204, findings and handling:fetchOnceis an anonymous barefetchwithaccept+ quotedif-none-match, 304-aware. Fixed:fetchModelsnow mirrors that; tests assert it.cache-write-tokenslogged as unknown. Added to all five silent lists; covered by the no-warning test (fails without the fix).includes('view=client')acceptsview=clients. Replaced withURLSearchParamsequality.Recheck of
f33098f: VERDICT: APPROVE - all findings closed; four non-blocking follow-ups raised. Handling:if-none-matchfrom its embeddedcatalogVersion- not adopted: this proxy has no embedded catalog to source a version from, and inventing one would be a fabricated value (worse fidelity than omitting it, per RFC 9110 conditional-request semantics). One-request-per-process difference only.Remaining limitations
/alpha/artifacts,/alpha/sandbox/*,/provider/v1/systemone) are not emulated - out of scope.x-cli-surfaceis deliberately not sent: the real CLI only sets it inacp/rpcmodes, which this proxy does not emulate.if-none-match), unlike the real CLI which always has an embedded version to send.Checklist
master(972828a, fetched and checked before push)Base commit:
972828a; tested head:1165b3d.