Repository navigation
[Bug Report]seeded (forked) session re-uploads its whole inherited log on every request #14341
Replies: 1 comment
|
附议,相同问题 @0.2.2-rc.5 : Confirming this on 0.2.2-rc.5 with an independent reproduction — plus the numbers that make the "deadlock" half of the report unambiguous. Setup. Parent session 33 turns / 9,343 events / 23.7 MB decoded log. Two forks of it ( Three attempts across the two forks:
Recomputed the field from the raw
Cross-check that Two consequences worth stating explicitly:
On the proposed fix. For this fork the inherited prefix is 9,269 events; its own are Second half of the fix (also raised in #13971): make the budget window-aware instead of a flat 8 MiB, and give an undeliverable backlog a progress path — if a request carrying Workaround, verified by recomputation (profile - id: session-log-deepseek
config:
maxBytes: 262144→ first request carries 64 events / 201,260 B (0.19 MiB, ~38 K tokens) instead of 8.00 MiB; body ≈ Same issue in Chinese: #13717. Same family: #7247, #11834, #13971. Happy to add raw logs or the measurement script if useful. |
Uh oh!
There was an error while loading. Please reload this page.
Symptom
A forked session (created via
session/fork) is permanently unable to send a request.Every attempt is rejected before forwarding with:
otheris dominated by thedsh_session_logfield. Six consecutive attemptsover 8 hours all measured ~1.756 M tokens for that field — it never shrank.
Root cause
prepare()(lib/index.js:141-151) computes:and
acceptedThrough()(lib/index.js:105-124) only counts acceptance eventsbelonging to this session:
A forked session is created with the parent's events as its seed
(
SessionStore.fork()/session/fork,meta: { isSeeded: true }), and thosecopied events include the parent's
session-log-deepseek/delivery-acceptedevents, which carry the parent's
sessionId. They are therefore all skipped,afterSeqstays-1, and the entire inherited log is re-uploaded on everyrequest.
Measured in the reproduction: parent log 2,765 events / 6,005,754 chars;
forked child 2,778 events / 6,053,071 chars — i.e. parent full copy + 13 own
events, re-sent every turn.
The plugin already knows the inherited length —
wireHeader()(lib/index.js:34)sends it:
but
prepare()never uses that value.Why it is a deadlock, not a slowdown
acceptonly appends thedelivery-acceptedwatermark when the request isaccepted by the transport. Since every request exceeds the window, the watermark
can never advance, so every retry re-sends the same oversized body. The session
is permanently bricked, including for short follow-up messages.
Suggested fix
Treat the inherited prefix as already delivered:
Expected effect on the reproduction: 13 events (~50 KB) per request instead of
6 MB.
Secondary
maxBytesdefaults to 8 MiB, which allows a single request field to reach~2 M tokens against a 1 MiB model window. A smaller default, or a cap derived
from the model window, would fail gracefully (bounded upload) instead of
producing an unsendable request.
All reactions