Repository navigation
fix: seam forensics re-notes outbound body on proxy-initiated re-send hops (#1894) - #1899
Merged
ranxianglei merged 1 commit intoOct 2, 2026
Conversation
Owner
Author
[bot] 🏷 PR #1899 review 结论 独立验证(本地证据)
结构化七问
残留(非阻塞):仅 facet 1(compat 梯)有专属 e2e fixture;facet 2–4 机制相同(发送时自记),由定向批次覆盖但无专属配对断言。本 PR 可接受;overflow-refold / fake-completion 的配对 fixture 如要补,留在本 issue 域内做 follow-up,不单拆。 合并前置(顺序要紧)
判定:代码方向与实现正确、测试为真(负向对照复现)、diff 干净;待 #1893 先行 + rebase 后全量 CI 绿即可合并。 |
ranxianglei
merged commit Oct 2, 2026
8861865
into
2026-10-02_fix-seam-nobaseline-false-positive
5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1894
Stacked on #1893 — this branch builds on #1893's main-chokepoint
noteForwardedBody; that PR must merge first (or this one rebases onto master afterwards). Until then this PR's diff against its base is exactly the four facets below.What changed
The
[cache-seam]forensics pair each settled usage sample with the outbound body noted vianoteForwardedBody. #1893 made the main send chokepoint note the wire bytes, but three in-request, proxy-initiated re-send hops replaceupstreamResultwith MODIFIED bytes without re-noting — so when such a hop succeeds, the settled sample paired the FIRST-ATTEMPT (rejected) bytes against the previous baseline:hop()insrc/server.ts): re-sendsapplyCompatRolesoutput after a 400 role rejection — now re-notesfixed.bodyon success.src/server.ts, 使用pi 压缩后就提示prompt is too long #1195): re-sends the refolded body after a 400/413 context overflow — now re-notes it on success.resolveFakeCompletion, [bug] 假完成:模型把工具调用写成文字(无 tool_use 块)→ 轮次提前终止,agent 显示正常完成(#361 根因 follow-up) #371): re-sends the hinted body — now re-noteshintedwhen the retry is ACCEPTED (rejected retries leave the slot untouched, matching the original buffer being presented).compressLoopResponsesJson, found while working this issue): each per-round re-request settles its usage in the caller but never noted its own wire bytes — same staleness mechanism, now notes them (same contract asloop/core.tsfetchUpstream).The non-streaming settle site no longer notes anything: it runs AFTER the hops, so pinning first-attempt bytes there would clobber the hop re-notes. Invariant going forward: every send path notes its own bytes at send time; the settle pairs with whatever was last noted.
Behavior change (diagnostic-only)
Old → new for the affected transitions only: the settled forensic pair compared first-attempt bytes vs previous baseline; it now compares the EFFECTIVE (post-hop) bytes vs previous baseline. Concretely, on a compat-role hop mid-session the LCP/message-index pointer moves from the full-baseline prefix (first attempt was byte-prefixed by the baseline) to the true divergence site (the rewritten role field). No accounting, closure, cache-key, retry, or wire impact — only the
[cache-seam]pairing and theseamSuspects/providerSideMissesclassification on the affected sample.Config surface
None. No new config fields, env vars, or CLI flags.
Tests
tests/issue1894-seam-hop-renote.test.ts: real proxy + role-rejecting fake upstream (Responses lane, mid-session flip to rejectingdeveloper). Asserts the settled SeamEvent's LCP equals the ground-truth LCP of (baseline, post-hop bytes) and NOT the stale (baseline, first-attempt bytes) value. Negative control verified: without the source change the same fixture fails with lcpBytes 11239 (full stale baseline) instead of 55 (true divergence at the rewritten role).npm run typecheckgreen.