Repository navigation
[PR] feat: plugin-lane stream-termination observability (#2328) - #2356
ranxianglei wants to merge 1 commit into
Conversation
61bea96 to
47965cf
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2529-pr.2356.c23af24This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2356.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Q1 raw-SSE capture: the Responses/Chat strip pipes tee the upstream stream
into diagnostics.dumpSse (reused, default OFF) as <ts>-<sid>-plugin-{chat,
responses}-raw.sse, mirroring the proxy lane.
Q2 termination metadata: the in-band truncation error frame now carries a
metadata-only diagnostics object (chunk/byte counts, last event types,
residual buffer length, sawTerminal, upstream status/content-type, retry
disposition). Byte-identical when no metadata is supplied.
Q4 classification: distinguishes why the terminal was never seen —
missing-terminal vs unrecognized-terminal vs incomplete-trailing-event —
surfaced in both the frame and the proxy log line.
Closes #2328
47965cf to
8d05bb9
Compare
[bot] 🏷 冲突已解决:分支已 rebase 到最新 master( 结构化七问
判定:冲突已清,分支基于最新 master,可合并状态待 CI 转绿。wire-shape 变更(truncation 帧新增 |
[bot] 🏷 这条冲突通知是过期状态,无需再次 rebase——刚核实过:
按「冲突解完状态会自动转干净,不重复 rebase」的纪律,这里不做无意义的二次 rebase。等剩余 4 项 CI 转绿即可人工合并(wire-shape 变更按 §7.4 保持 human merge)。若之后 master 再前进产生真实冲突,我再处理并附七问。 |
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #2328 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
Closes #2328
Follow-up observability for the plugin-lane SSE strip pipes (
pipePluginChatWithStrip/pipePluginResponsesWithStrip) — the lanes #2323's CRLF-tear bug came from, which had no raw-SSE capture and no termination context on their in-band truncation frame. All three checklist items share one failure domain (plugin-lane stream-termination observability) and ship together. No compression-semantics change.What
diagnostics.dumpSse(envACP_DUMP_SSEor file key) is set, each pipe tees the upstream stream into<dir>/<ts>-<sid>-plugin-{chat,responses}-raw.sse, mirroring the proxy lane's<ts>-<sid>-raw.sse. The parse branch is untouched; the tee branch feeds the existingdumpStreamToFile. Default OFF; only the first-attempt stream is captured (a retry/refetch second stream is not — documented limitation).upstream_stream_truncatederror frame gains a metadata-onlydiagnosticsobject:classification,sawTerminal,chunksReceived,bytesReceived,unparsedFrames,residualBufferLen,lastEventTypes(last 8),upstreamStatus,upstreamContentType,retryNote.server.tssupplies status/content-type (already in hand at every call site).missing-terminal(clean EOF, nothing unparseable) vsunrecognized-terminal(≥1 frame failed JSON.parse) vsincomplete-trailing-event(dangling partial frame left in buffer at EOF). Surfaced in both the frame and the proxy log line — directly answering the issue's "上游没发终端 vs 终端到了但解析被拒" split.Config surface
No new config. Q1 reuses the existing
diagnostics.dumpSsedirectory convention exactly as the proxy lane and loop lane already do — an existing mechanism expresses this precisely, so no new field/section/env var was invented (Configuration Surface Discipline). Thediagplumbing is internal (a trailing optional arg), not a config knob.The plugin-pipe truncation error frame now always carries a
diagnosticsobject (old: none). Old→new:{"error":{...,"message":"..."}}→{"error":{...,"message":"...","diagnostics":{...}}}(responses nests top-level rather than undererror). Rationale: counts/classification are zero-cost and strictly more informative → on by default; onlyupstreamStatus/upstreamContentTypeare conditional (present when the caller supplies them —server.tsalways does). Risk is low: these are bili-generated error-frame fields, never user intent or tool-call arguments (the #1039 wire-fidelity bound is untouched), and clients ignore unknown JSON keys.emitUpstreamTruncationstays byte-identical when called withoutmeta(no other caller passes one).Sequencing / hot-file note (updated post-rebase)
Source bugfix #2323 shipped as PR #2329 and merged to master (
2e32ea428) while this PR was open; this branch has been rebased onto current master including #2329, with the two pipe read-loop edits reconciled by union of intent: #2329's stateful CR-holding parser (pendingFinal+finalizeSseLineEndingsEOF re-drive) is preserved verbatim, and #2328's counters layer on top —chunksReceived/bytesReceivedcount real upstream chunks only (theelsebranch), so the synthetic EOF finalize pass never counts as a chunk, andretryFiredflags the one-shot retry in the done branch exactly as before. As predicted pre-rebase, after #2329 lands the CRLF-tear class simply stops appearing in theunrecognized-terminalbucket: the torn fragments now resolve and parse on the finalize re-drive.Verification
47965cf49):npm run typecheckclean; targeted suites green —issue2328-plugin-sse-observability(9/9),issue2171-zero-byte-truncation-retry+plugin-empty-turn-retry,issue1452-socket-hardening,issue2323-sse-crlf-cross-chunk— 55/55 total. All pre-existing suites use.includes()on code/message, unaffected by the added field.Wire-shape change (error-frame metadata) → human merge per §7.4, no auto-merge.