Repository navigation
[PR] debug: staged heap probes over the request processing window (--debug gated, zero behavior change) - #3552
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4222-pr.3552.c63fec2This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3552.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm/qwen3.8-27b) 查重: 不重复。 检索了 open+closed 的 issue 与 PR(关键词 mem-probe / heap / memory / OOM):无其他在途或已合并的记忆探针类改动。本 PR 与 #3386 是「诊断辅助 ↔ 待修 bug」关系而非重复——PR 正文已明确 NOT closing #3386,真正的修复等 owner 对 A/B/C 方案的拍板,两者边界清晰。 开始审核:拉取分支 |
One oversized request aborting the whole process (#3386: 25 MiB / 1372 msgs → 4 GB heap) cannot be attributed to its allocating stage from outside. Three mem-probe samples, gated on the existing --debug flag (zero new config surface, zero behavior change when off): - inbound-parsed: after readBody+decode+toString+JSON.parse and session identity resolution — baseline before the heavy local window work - prepared: after runPrepare returns (both the codex-intercept and the main path) — cumulative cost of image-index build, wire→core conversion, kernel processTurn, and outbound rebuild/stringify Each line logs heapUsed/external/rss plus the stage's payload bytes, prefixed 'mem-probe <stage>:' for grep continuity. The delta between consecutive samples is what tells the owner whether the OOM mass sits in parse materialization or in the fold/processTurn window — input for the #3386 A/B/C fix decision.
…dies Review nit on the staged heap probes: the log line contract says payload=<N>B (bytes) and inbound-parsed samples bodyBuffer.length (bytes), but the prepared-stage sampled prepared.body.length — UTF-16 code units for string bodies. Identical for ASCII/base64 payloads, under-reports multibyte text, and makes the inter-sample payload delta (unit-mixed) misleading exactly when comparing stages. Buffer.byteLength is allocation-free, so the debug path stays cheap.
c3a0281 to
982ecf2
Compare
(ai: vllm/qwen3.8-27b) 审核结论:代码可合入;当前 blocked 是仓库级 CI 门禁失配(已立 #3574),与本 PR 无关做了什么(不止读 diff):rebase 到当前 master b10c525(v0.1.198 release merge,窗口内 handle.ts 零改动,干净)→ 顺手修掉一处评审发现的小缺陷(独立标注 commit 顺手修的小缺陷(commit 结构化八问
合并判定代码层面 ready:rebase 完成、评审修复落地、本地定向验证全绿(typecheck clean;handle-path 套件 80/80;lane-decisions-matrix 22/22)、CI 重跑后全绿。但 等你把保护规则对齐 core 矩阵契约(或给该 PR 打 |
For #3386 (diagnostic aid — NOT closing it; the real fix awaits the owner's A/B/C decision on per-turn image budget / folding / dedup).
Why
#3386's crash signature — one 25 MiB / 1372-message request driving the V8 heap to the 4 GB default ceiling mid-turn, ~10 s crash-restart loop — cannot be attributed to its allocating stage from outside the process. The heap snapshot pinned the MASS (99.6% strings, 97.9% image-related, base64 present three ways), but which pipeline boundary materializes it per request is exactly what the pending fix options need:
What
Three
mem-probesamples in src/server/handle.ts, each loggingheapUsed / external / rss(+ the stage's payload bytes):inbound-parsed— after readBody + content-decoding +bodyBuffer.toString("utf8")+JSON.parse, once session identity is resolved. Baseline before the heavy local-window work.prepared— afterrunPrepare()returns, on BOTH paths that produce a Prepared (codex-intercept forge path and the main path). Cumulative cost of the incoming-image index build, wire→core conversion, kernelprocessTurn(fold/reconcile), and the outbound rebuild +JSON.stringify.Delta between consecutive samples = the cost of the stage in between. Log line shape:
[sessionId] mem-probe <stage>: heap=XMiB external=YMiB rss=ZMiB payload=NB— stable prefix for grep continuity.Guarantees
--debugflag (same precedent as the parsed-body dump already at handle.ts underopts.debug). No env var, no config field.memProbeearly-returns before touchingprocess.memoryUsage()when debug is false; when on, it only appends debug-level log lines via the existing logger (no console.error).Verification
npm run typecheckclean; targeted handle-path suites (dsh-title-sidecar-handle, issue2824-regression, session-continuity-proof, reasoning-echo) 78/78 green;npm run buildgreen (dist-external-zod gate OK). Full-suite verdict comes from CI on this head.