Repository navigation
fix(gemini): add ACP spec SSOT, 190K truncation alignment, agy 1.5.20 gate, K2/K4/status fixes & pin CRAGGemini 0.6.4 - #2475
Conversation
… gate, and K2/K4/status fixes
1. Changed files & core intent:
- Added `src/config/agy-acp-spec.json` (byte-identical to CRAGGemini `src/acp_spec.json`, SHA-256 `1dd063cb9519d20c3b28b281d2eca4be89e109a4f88bfe3ee6b688d8cf827631`), `scripts/sync-agy-acp-spec.mjs` (`--check` / `--sync-kernel` / `--from-kernel`), and `src/lib/gemini/agy-acp-spec.mjs` (`KIN_AGY_ACP_SPEC_PATH` + dynamic `acp_overrides` + live worker capability resolution).
- Wired `routing-config.mjs`, `prompt-normalizer.mjs`, and `gemini-convert.mjs` to the ACP spec SSOT; absorbed `45882715a` Gemini `functionResponse.{response,parts}` control-char hygiene (`sanitizeJsonControlCharsDeep`), K2 FIFO `unconsumedByName` `callId` rewrite, and account-scoped `continuationBinding` orphan exemption.
- Aligned 190K truncation (`prompt_overflow_policy: "truncate"` delegates >190KB to CRAGGemini while keeping a 4 MiB OOM guard; `reject` keeps exact limit) and added post-canonicalization admission check in `scheduler.mjs` (passing `routeModel` and `targetAccountId`).
- Fixed K4 hidden bugs: `parseGeminiSseFrame` preserves `rawPayload` and parses array-shaped Google RPC `details[].metadata.{retryable,failoverable}`; `scheduler.mjs` decouples worker `attemptRequestId` (`gem_<24hex>`) from client `requestId` with 128-char tail-safe `_a${attempts}` suffix; `error-policy.mjs` classifies `gemini_session_conflict` as `request_protocol` (`circuit: false`).
- Enforced/surfaced `min_agy_version = "1.5.20"` and `/status` capability pass-through across `scripts/gemini-host.py`, `scripts/gemini-maintenance.py`, and `src/lib/gemini/direct-client.mjs`; fixed `ControlHandler.send_json_error(..., validation_url=None)` `TypeError` in `scripts/gemini-host.py`; closed Gemini status SSOT gap by surfacing Rust `liveNodeState` `schedulable === false` (`permanent_unschedulable`) in `scheduler.mjs` `environmentRestriction` and `routes.mjs` `environmentView`.
2. Root cause & rejected alternatives:
- Root cause: hardcoded Gemini body allowlists/MIMEs/190KB hard-rejects drifted from CRAGGemini, client-reused `X-Request-Id` collided with in-flight slots (409), `parseGeminiSseFrame` dropped `rawPayload` and ignored array RPC `details[]`, `environmentRestriction` ignored Rust `permanent_unschedulable`, and `ControlHandler.send_json_error` lacked the `validation_url` keyword argument passed by `_send_infer_error`.
- Rejected alternatives: hard-blocking host startup on `agy < 1.5.20` (breaks rolling upgrades before `--agy-only`); keeping 190KB hard-400 on panel when kernel performs layered truncation; reintroducing legacy JS `unitCircuit` (violates `#2461` Rust SSOT).
3. Verification commands & real results:
- `node scripts/sync-agy-acp-spec.mjs --check --kernel-spec /mnt/x/antigravity-cli-proxy-wt-acp-spec-truncation/src/acp_spec.json` -> PASS (`sha256=1dd063cb9519d20c3b28b281d2eca4be89e109a4f88bfe3ee6b688d8cf827631`, `min_agy=1.5.20`, `keys=87`).
- `find src scripts -name '*.mjs' -print0 | xargs -0 -n1 node --check` -> PASS (0 errors).
- `npx biome check <14 modified .mjs files>` -> PASS (`Checked 14 files in 289ms. No fixes applied.`).
- `python3 -m py_compile scripts/gemini-host.py scripts/gemini-maintenance.py` -> PASS.
- `python3 test/unit/gemini-host-license-align.py && python3 test/unit/gemini-agy-patch.py && python3 test/unit/gemini-maintenance-runtime-files.py && python3 test/unit/gemini-host-native-smoke.py` -> PASS (all 4 suites OK).
- `node --test test/unit/gemini-convert.test.mjs test/unit/gemini-prompt-normalizer.test.mjs test/unit/gemini-scheduling-status.test.mjs test/unit/gemini-maintenance-install-contract.test.mjs` -> PASS (72/72).
- `KIN_SCHEDULER_BIN=/mnt/x/vm2api-wt-clean-1424x/bin/kin-scheduler npm run test:ci` -> PASS (13/13 isolated suites).
4. Broken-by-hand evidence:
- Temporarily removed `rawPayload: payload,` in `src/lib/protocol/gemini-convert.mjs` (`parseGeminiSseFrame`) -> ran `node --test --test-name-pattern="ACP 190K truncation alignment" test/unit/gemini-convert.test.mjs` -> FAILED (`AssertionError: assert.ok(parsedSse.rawPayload)` at `test/unit/gemini-convert.test.mjs:2808`, exit code 1) -> restored -> re-ran -> PASS (1/1).
5. Unverified / follow-up items:
- Live end-to-end verification against a signed CRAGGemini `0.6.4+` payload + `ph24` deployment is deferred until kernel payload release and PR review.
- Pre-existing legacy `unitCircuit` assertions in non-CI suites (`gemini-session-conflict.test.mjs:215`, `gemini-foundation.test.mjs:903/949`, `gemini-host.test.mjs:1154/1214`) stem from `origin/dev` `#2461` removing JS `unitCircuit` and were intentionally left untouched outside scope.
…yload.json 1. Changed files & core intent: - Updated `deploy/payload.json` `geminiDefaultLinuxAmd64` to pin `payload-2026.12.01-gemini-0.6.4` (`craggemini`, `craggemini.payload.enc`, `libagy_bridge.so`, `crag-license-public.pem`, `manifest.json`) with zero key rotation (`crag-license-public.pem` SHA-256 unchanged: `f6e3ef3a50fd49abd4ce3519db512af74fc438b47b1bbec83f6602ebe4b3930a`). 2. Root cause & rejected alternatives: - Root cause: `payload-2026.12.01-gemini-0.6.3` contained `split_acp_prompt_parts` which was silently tail-truncated by `agy 1.5.20`; CRAGGemini `0.6.4` (PR dofastted/antigravity-cli-proxy#36) replaces it with `acp_spec.json` SSOT, `agy >= 1.5.20` compatibility reporting, and layered overflow + head/tail UTF-8 truncation. - Rejected alternatives: overwriting published prerelease `0.6.3` (violates immutable release rule) or rotating production signing keys. 3. Verification commands & real results: - `gh release view payload-2026.12.01-gemini-0.6.4 --repo dofastted/vm2api` -> 5/5 asset sizes & SHA-256 digests match `deploy/payload.json` verbatim. - `python3 scripts/fetch-default-gemini.py --manifest deploy/payload.json --dest <0700 tmpdir> --reuse-agy ...` -> PASS (`Verified Gemini payload 0.6.4`, exit 0). - `node scripts/sync-agy-acp-spec.mjs --check --kernel-spec /mnt/x/antigravity-cli-proxy-wt-acp-spec-truncation/src/acp_spec.json` -> PASS (`sha256=1dd063cb9519d20c3b28b281d2eca4be89e109a4f88bfe3ee6b688d8cf827631`). - `find src scripts -name '*.mjs' -print0 | xargs -0 -n1 node --check` + `npx biome check` (14 files) + `python3 -m py_compile` + 4 Python suites + 4 Gemini JS suites (72/72) + `npm run test:ci` (13/13) -> ALL PASS. 4. Broken-by-hand evidence: - Prior commit `0a5ab73eb` verified `parseGeminiSseFrame` `rawPayload` hand-break (FAIL -> restore -> PASS); `fetch-default-gemini.py` live download verifies exact size + SHA-256 + Ed25519 signature of every pinned 0.6.4 asset. 5. Unverified / follow-up items: - `ph24` production rollout and live traffic verification follow PR merge.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: d640c4af-d44a-4c9a-9221-4fc7056a8e99) |
…emini-0.6.4) ## 变更摘要 - 改前:`deploy/payload.json` 指向 `payload-2026.12.01-gemini-0.6.4`(合入 `antigravity-cli-proxy#36` 评审 F1–F5 修复前的构建)。 - 改后:将 `geminiDefaultLinuxAmd64` 升级钉选至已合入 `dofastted/antigravity-cli-proxy#36`(`13a270e05`,含 #35 评审 F1–F5 修复 + `agy >= 1.5.20` 门禁 + 分层截断)的新续发载荷 `payload-2026.12.02-gemini-0.6.4`(零密钥轮换,公钥 `f6e3ef3a...` 不变)。 - 未改 / 延后:不改 `CHANGELOG.md`,不触碰其他载荷字段;线上 `ph24` 灰度在合入发版后执行。 ## 验收记录(Run) - 环境与基线:WSL2 Linux + Windows git,`fix/gemini-acp-spec-truncation`(基于 `origin/dev` `c83c12b3b`) - 已跑命令与结果: - `python3 scripts/fetch-default-gemini.py --manifest deploy/payload.json --dest <0700 tmpdir> --reuse-agy ...`: PASS (`Verified Gemini payload 0.6.4`,5/5 资产远端下载与 SHA-256 一致) - `node scripts/sync-agy-acp-spec.mjs --check --kernel-spec ...`: PASS (`sha256=1dd063cb...`, `min_agy=1.5.20`, `keys=87`) - `node --test test/unit/install-payload.test.mjs test/unit/gemini-maintenance-install-contract.test.mjs`: PASS (18/18) ## 回退与手破验证(Broken by hand) - 将临时 `payload.json` 中 `manifest.json` sha256 末位由 `0` 改为 `1` -> `fetch-default-gemini.py` FAIL (`SHA-256 does not match the pin`) -> 还原后 PASS。 ## 真实使用(Real use) - 实测从 GitHub Release `payload-2026.12.02-gemini-0.6.4` 公开 URL 拉取全部 5 项资产并完成验签与官方 `agy` 补丁;未在 `ph24`/Docker/KVM/custom-os 实机运行。 ## 未运行项(Not run) - `ph24` 实机灰度、Docker/KVM/custom-os 槽位运行实测与 ARM64 构建(均未运行,待合入发版后执行)。
|
已更新
|
评审结果(只读评审,评审时 head
|
…in/dev - M2: merge origin/dev (including #2473) cleanly across 5 files; deduplicate sanitizeJsonControlCharsDeep, normalizeIrToolMatchKey FIFO, and keep #2475 unique ACP spec SSOT, agy 1.5.20 gate, K4 SSE array metadata, decoupled worker request IDs, and payload-2026.12.02-gemini-0.6.4 pin - M3: expose permanent_unschedulable & permanent_reason from liveNodeState() so environmentRestriction only flags genuine permanent_unschedulable (not env_not_ready or operator schedulable_false); add counterexample tests - M1: guard getattr(self, 'payload', None) in Host.installed_agy_version() for gemini-host-shards.py and align #2436 reject-policy admission tests in gemini-request-log.test.mjs / gemini-convert.test.mjs / gemini-session-conflict.test.mjs - m5: tighten loadAgyAcpSpecFromFile() semver, limits, and allowed_body_keys checks
Summary
Supersedes #2453 (which pinned
payload-2026.12.01-gemini-0.6.3containing the withdrawnsplit_acp_prompt_partsmulti-block workaround). Pairs with CRAGGemini kernel PR dofastted/antigravity-cli-proxy#36 and continuation prereleasepayload-2026.12.01-gemini-0.6.4.Key Changes
src/config/agy-acp-spec.json(byte-identical to CRAGGeminisrc/acp_spec.json, SHA-2561dd063cb9519d20c3b28b281d2eca4be89e109a4f88bfe3ee6b688d8cf827631),scripts/sync-agy-acp-spec.mjs(--check/--sync-kernel/--from-kernel), andsrc/lib/gemini/agy-acp-spec.mjs(KIN_AGY_ACP_SPEC_PATH+routing.gemini.acp_overrides+ live workerprotocolCapabilitiesprecedence).routing-config.mjs,prompt-normalizer.mjs, andgemini-convert.mjsto the SSOT (expanding decodable inline text MIMEs to 22application/*exact types +application/*+{json,xml,yaml}while strictly rejectingimage/svg+xmland binary media).prompt_overflow_policy: "truncate"delegates>190KBuser turns to CRAGGemini0.6.4layered overflow + UTF-8 head/tail truncation while enforcing a 4 MiB OOM guard; explicitrejectpreserves the exact 190KB boundary.scheduler.mjs(passingrouteModel,targetAccountId, and live worker policy) so folded<system-reminder>and decoded inline text attachments are covered.45882715a: GeminifunctionResponse.{response,parts}control-char cleanup (sanitizeJsonControlCharsDeep), K2 FIFOunconsumedByNamecallIdrewrite, and account-scopedcontinuationBindingorphan exemption (continuationBinding.accountId === targetAccountId).gemini-convert.mjs:parseGeminiSseFramepreservesrawPayloadacross all error branches andgeminiErrorControlFieldsparses array-shaped Google RPCdetails[].metadata.{retryable,failoverable,worker_code}(unblockingcancelled -> 499and metadata propagation).scheduler.mjs: decouples worker-facingattemptRequestId(gem_<24hex>) from client-suppliedrequestId(X-Request-Id) with tail-preserving 128-char_a${attempts}suffix to eliminate client-retry HTTP 409 collisions;error-policy.mjsclassifiesgemini_session_conflictasrequest_protocol(circuit: false).agy >= 1.5.20Gate, Capability Pass-through & Status SSOTscripts/gemini-host.py:MIN_AGY_VERSION = "1.5.20",_resolve_infer_target/status8-field capability pass-through +installed_agy_version()fallback warning, and fixedControlHandler.send_json_error(..., validation_url=None)TypeError.scripts/gemini-maintenance.py: addedagy_versionhealth check (gemini_maintenance_agy_below_minwarning when< 1.5.20).src/lib/gemini/direct-client.mjs: normalized & exposed the 8 ACP/version capability fields (normalizeTargetCapabilities,resolveTargetAcpCapabilities).src/lib/gemini/scheduler.mjs&routes.mjs: projected RustliveNodeStateschedulable === false(permanent_unschedulable) cleanly intoenvironmentRestrictionandenvironmentViewwith zero legacy JSunitCircuit.0.6.4Payload Pindeploy/payload.jsongeminiDefaultLinuxAmd64topayload-2026.12.01-gemini-0.6.4(zero key rotation;crag-license-public.pemSHA-256 unchangedf6e3ef3a…).Cross-References
Verification
node scripts/sync-agy-acp-spec.mjs --check --kernel-spec /mnt/x/antigravity-cli-proxy-wt-acp-spec-truncation/src/acp_spec.json— PASS (sha256=1dd063cb9519d20c3b28b281d2eca4be89e109a4f88bfe3ee6b688d8cf827631)python3 scripts/fetch-default-gemini.py --manifest deploy/payload.json --dest <0700 tmpdir> --reuse-agy ...— PASS (Verified Gemini payload 0.6.4, 5/5 assets match GitHub prerelease)find src scripts -name '*.mjs' -print0 | xargs -0 -n1 node --check— PASSnpx biome check(14 modified.mjsfiles) — PASSpython3 -m py_compile scripts/gemini-host.py scripts/gemini-maintenance.py— PASSgemini-host-license-align.py,gemini-agy-patch.py,gemini-maintenance-runtime-files.py,gemini-host-native-smoke.py) — ALL PASSgemini-convert,gemini-prompt-normalizer,gemini-scheduling-status,gemini-maintenance-install-contract) — 72/72 PASSnpm run test:ci— 13/13 PASSNote
High Risk
Touches Gemini request canonicalization, admission limits, tool-ID pairing, scheduling/unschedulable state, and pinned CRAGGemini binaries—errors could break inference, failover, or routing for production Gemini traffic.
Overview
Introduces a Gemini ACP protocol SSOT (
src/config/agy-acp-spec.json+ sync script + runtime loader) and wires prompt canonicalization, admission, and panelrouting.gemini.acp_overridesto it—replacing hardcoded body allowlists/MIME rules and supporting worker + routing overrides.Prompt overflow now defaults to
truncate(delegates >190KB to CRAGGemini 0.6.4, still caps at 4 MiB); explicitrejectkeeps the 190KB gate, with a post-canonicalization admission pass after folded reminders/inline text decode. Tool-call ID behavior stops injecting syntheticcall_auto_*, reserves exact IDs in parallel batches, and tightens orphantool_resulthandling (FIFO same-name rewrite, account-scopedcontinuationBinding).K4-style reliability fixes: worker
attemptRequestIdis decoupled from clientX-Request-Id(avoids 409 collisions); SSE errors retainrawPayloadand parse Google RPC metadata; host/maintenance enforce agy ≥ 1.5.20 with/statusACP capability passthrough andvalidation_urlon JSON errors; scheduler/panel surface Rustpermanent_unschedulable. Pinspayload-2026.12.02-gemini-0.6.4indeploy/payload.json.Reviewed by Cursor Bugbot for commit d4e3880. Configure here.