diff --git a/src/web/diagnostics.ts b/src/web/diagnostics.ts index 139b26d2ba..554d463584 100644 --- a/src/web/diagnostics.ts +++ b/src/web/diagnostics.ts @@ -17,6 +17,15 @@ * `--- recent conflict-related log lines ---` (the exact signatures a * maintainer greps to adjudicate a native-compaction episode). * + * #4649: the #3611 coverage was dsh-only — a codex conflict report shipped + * zero log signatures and no client version (#4648), stalling triage on data + * the reporter had to dig out by hand. The conflict tail now also matches the + * codex compaction evidence chain (intercepted / not-intercepted / forge + * failed) plus the client-agnostic #2695 zombie reap verdict (#4688), and the + * versions section lists the process's recent observed client User-Agents + * (src/client-ua-registry) — for UA-carried clients like codex the UA IS the + * version string (`codex_cli_rs/`), seen on every request. + * * PUBLISH DISCIPLINE: the blob lands in a PUBLIC GitHub issue body (copied * verbatim AND embedded in the prefilled URL). Every byte passes redactForPublish * at the SINK (buildDiagnostics) — unconditional host masking + credential-shape @@ -157,6 +166,9 @@ function storageLogTail(lines: string[]): string[] { // (#3008/#2372, both openai and responses wires), the intercepted forge // (trigger form AND endpoint form share the prefix), and the forge failure // that passes through (src/server/prepare-responses.ts). +// #4688: the client-agnostic tail of the chain — the #2695 zombie reap verdict +// (the line a pure orphan-reap ledger lives on; without it such reports ship +// an empty evidence section even with the reap in the log pair). const CONFLICT_LOG_PATTERNS = [ "takeover gate refused", "dsh native compaction call identified", @@ -167,6 +179,7 @@ const CONFLICT_LOG_PATTERNS = [ "codex local auto-compaction detected", "codex compact intercepted", "codex compact forge failed", + "zombie fold reap", ]; function conflictLogTail(lines: string[]): string[] { diff --git a/tests/web-diagnostics-enrichment.test.ts b/tests/web-diagnostics-enrichment.test.ts index 6e4fa9f018..eb61e7420b 100644 --- a/tests/web-diagnostics-enrichment.test.ts +++ b/tests/web-diagnostics-enrichment.test.ts @@ -202,6 +202,31 @@ test("#3813 single-read: storage tail and conflict tail share one candidate set assert.equal(_candidateLogReadsForTest(), 2, "unknown topics must not touch the log at all"); }); +// #4688: a PURE orphan-reap ledger (no plugin events, no dsh/codex framing) +// shipped with an empty evidence section because neither reap verdict nor the +// OpenAI-lane codex detection was in CONFLICT_LOG_PATTERNS — the report's own +// log tail was blind to the very event it was reporting. Pin both signatures +// (and the unrelated-line exclusion) so orphan-reap reports carry their proof. +test("#4688 orphan-reap report carries the reap verdict and the OpenAI-lane codex detection", async (t) => { + const root = mkdtempSync(path.join(os.tmpdir(), "bili-diag-reap-")); + t.after(() => rmSync(root, { recursive: true, force: true })); + const stateHome = path.join(root, "state"); + mkdirSync(path.join(stateHome, "billion-context"), { recursive: true }); + const reapLine = "[ses_734d5481] zombie fold reap: removed 2 block(s) (b1, b2) from ACP state; blockContents retained, refs pruned to live ids (#2695)"; + const codexOpenaiLine = "[ses_codex_9] codex local auto-compaction detected (3/120 covered ids retained) — rebasing ACP state onto the compacted history (#2372/#4521)"; + writeFileSync(path.join(stateHome, "billion-context", "bili.log"), [ + "[acp-usage] round 4 input=120000 cached=100000 (cache hit 83%)", + reapLine, + codexOpenaiLine, + ].join("\n") + "\n"); + const env = { DSH_HOME: path.join(root, "none"), XDG_STATE_HOME: stateHome, XDG_CONFIG_HOME: root, XDG_DATA_HOME: root, XDG_CACHE_HOME: root }; + const blob = (await withEnv(env, () => buildDiagnostics("conflict-banner"))).blob; + assert.ok(blob.includes("zombie fold reap"), "orphan-reap verdict captured (pre-fix: empty evidence section)"); + assert.ok(blob.includes("blockContents retained"), "reap line kept whole enough to show contents survived"); + assert.ok(blob.includes("codex local auto-compaction detected"), "OpenAI-lane codex detection captured"); + assert.ok(!blob.includes("[acp-usage] round 4"), "unrelated log lines still excluded"); +}); + test("#3611 enrichment is generic: storage topic and unknown topics carry it too", async (t) => { const root = mkdtempSync(path.join(os.tmpdir(), "bili-diag-gen-")); t.after(() => rmSync(root, { recursive: true, force: true }));