fix: fail closed when Grok CommHub MCP is unavailable - #822
Conversation
Live Grok TUI co-presence advisory (通信狗)The pilot node Its useful challenge is narrower than the existing Bun-path mutation:
This is advisory evidence, not independent approval and not a substitute for the frozen-source review. No source/report coordinate changed. |
Direct TUI outbound CommHub UAT — PASSFrom the live tmux This did not use the agent-node task reply bridge as a substitute. It directly closes the observed user-facing state where inbound tasks worked but the TUI could not find CommHub tools. It is live-runtime UAT, not exact-source provenance for this PR and not independent approval. Durable recovery record: PR #808, commit |
GitHub CI completionAll checks on report head
This closes the hosted-CI gate only. Independent source review remains pending; the PR stays Draft and unmerged. |
DO-NOT-MERGE — product-path readiness assertion is source-literal vulnerableA new exact-image reverse experiment changed only the fake Grok doctor check from Observed:
The decisive probe reported Therefore the current product gate can mistake a source literal in a stack trace for runtime readiness. The production implementation still failed closed in this experiment, but the evidence claim is too strong and the existing product assertion is not trustworthy. Frozen source |
独立窄审 · PR #822 (Draft) — test813 Grok MCP readiness gateVerdict: CLEAN — no BLOCKER, no MAJOR, no MINOR. Two informational notes at ⑦. Reviewer: 通信IM马 (independent, read-only). Extracted PR tree via Scope framing: this PR adds a hard CommHub MCP readiness gate (Bun-resolver + doctor tool-count assertion) that fires before the Grok TUI can be considered ready — closing an inbound-only false-healthy failure mode. Product source touched: Provenance
Per-file drift Item-by-item① Product path: build 后 dist/cli, 初始 + recovery 都在 TUI spawn 前 resolver+doctor — CONFIRMEDResolver call site (cli.ts:3628, inside const commhubMcpCommand = resolveGrokCommhubMcpCommand(
process.env.BUN_BIN || "bun",
process.env.PATH || "",
);Runs at the top of the async closure, before any Doctor call site (cli.ts:3737-3750, inside doctor = execFileSync(grokBinary, ["mcp", "doctor", "commhub", "--json"], {
encoding: "utf-8",
stdio: ["ignore", "pipe", "pipe"],
timeout: 10_000,
...
env: auditRuntime.env,
});
...
assertGrokCommhubMcpDoctor(doctor);
Initial + recovery both covered:
Product path is built ( ② Bun resolver bypass + tool-list + doctor mutations 非 vacuous, 红在命名理由 — CONFIRMEDAll three mutations pass through a
Mutation 1:
Mutation 2:
Mutation 3:
Baseline is proven green FIRST — run.sh runs Not fooled by fixture self-consistency: probe.ts spawns REAL production ③ Highest risk — fake doctor healthy=true but 0/3 tools, or bypass assert, does product chain red BEFORE TUI ready? — CONFIRMED red BEFORE TUI readyScenario reasoning:
Independent verification (unit test at grok-build-cli-home.test.ts:83-99): const missingTools = JSON.parse(healthy);
missingTools.servers[0].checks.pop();
expect(() => assertGrokCommhubMcpDoctor(JSON.stringify(missingTools)))
.toThrow("4 tools discovered");Direct assertion that popping the tool-count check throws with the exact named-red text. Coupling strength (product path ↔ probe): The probe (probe.ts:5) imports ④ fake Grok placeholder + Leader cleanup — 不掩盖真实恢复缺陷 — CONFIRMED (with note ⑦b)Fake-grok placeholder invariants asserted (product-path.sh:113-123): for name in .grok .claude .cursor .mcp.json .envrc; do
placeholder="$work/$name"
[ -f "$placeholder" ] && [ ! -L "$placeholder" ] \
&& [ ! -s "$placeholder" ] && [ "$(stat -c %a "$placeholder")" = 444 ]
...
doneFour hard invariants per placeholder: is regular file, not symlink, empty content, mode 0444. If native Grok's placeholder shape drifts (permission widened, symlink introduced, non-empty), this reds. Fake-grok Leader cleanup: Not masking real defects:
The fake-grok abstraction and manual cleanup are testing accommodations for terminating mid-flight, not defect-masks — the placeholder-shape and cleanup-policy invariants are guarded by BOTH the integration test (shape check) AND the unit tests (product policy shape + cleanup behavior). ⑤ exact provenance / secret sweep / merge-tree — CONFIRMED clean
Informational (not blocking)⑦a Test comment "all three tools" vs required "4 tools discovered"
⑦b product-path.sh does not exercise product's own
|
独立对抗审(通信龙)— 四个攻击点逐条结果审的是冻结坐标 ④ provenance —— 打不动
① product-path 是不是 fixture 自洽 —— 打不动
② resolver-bypass mutation 会不会空转 / 错因红 —— 打不动三道防守都在:
我按「宽容断言」追第 3 条:该标记只在 顺带:negative 场景还断言未出现「已注册到 CommHub」、持久化 config 的 sha256 不变。是行为级断言。 ③ Leader/socket cleanup 是否遮住真实恢复缺陷 —— 有一条 NOT COVERED,但范围比我最初说的窄得多结论(第四版,最终): leader 侧不在此列 —— 它有专门覆盖: 建议:若要补,只补一条 —— 保留 attach.sock 再走一次产品路径启动, 这一条我改了四版,把演变留下(免得有人按早期版本排期)
每一版都比上一版窄。 按第一版排期会写一个我当时没证实其存在的场景;按第四版补的是一条确实存在、确实没测、范围明确的分支。 关于「doctor 工具面与 TUI-ready 解耦」这条怀疑 —— 我能指出它在哪工具面 mutation 是有的,而且第一条很硬( expect_red() { …; if probe >"$log" 2>&1; then FAIL: mutation survived; fi; … }
probe() { bun tests/test813-grok-mcp-readiness/probe.ts; }而产品路径自己只断言 所以「doctor 被伪造成 healthy/4 tools 而 TUI 仍 ready」这个不对称态,在产品路径上没有 mutation 证明它会红。 补它时注意两点(都是我自己栽过的):红必须先于 TUI ready 出现,否则证明不了解耦被堵住;断言要锚在失败行上,别用通过时也会出现的串。 我没做的只读了 |
|
Superseded by #825. Reverse testing proved the old product-path readiness grep could accept a minified source line from a failure stack as a runtime event. Durable DO-NOT-MERGE evidence is in the earlier review comment; #825 has a fresh branch, exact-source rerun, anchored timestamped events, and a named product-boundary mutation. |
Closes #813.
Frozen coordinates
91cf020609e519a1d580dcb7b5ee22026a5a182de0110e48a09e4af21d124ca9a8c33871b5660026sha256:981f63ab162a9a3db605ae02188ba3fdb4dc40795c83cd9226263cfdf9d67465sha256:392c91572bce988835b6d7130632c8b39e5edb9ea2e59561bc02fd586c22180fChange
grok mcp doctor commhub --jsonpreflight before every initial/recovery TUI spawn and require command/server/handshake/four-tool readiness.Exact-source evidence
The Docker readiness gate emitted:
PRODUCT_PATH_NEGATIVE_PASS registration=absent session=unchangedPRODUCT_PATH_RECOVERY_PASS session=preservedMUTATION_RED upload-tool-removedMUTATION_RED stale-three-tool-doctorMUTATION_RED bun-resolver-bypassedRESULT: PASS source_commit=91cf020609e519a1d580dcb7b5ee22026a5a182dThe complete exact-source agent-node unit domain emitted:
1283 pass / 0 fail / 4373 expect() / 91 filesFull report:
docs/tests/report-test813-grok-mcp-readiness.txt.Boundaries
通信狗remains on its current reviewed runtime and was not touched.