Files
deepseek-harness/packages/spill
Tianyi Cui c3c10820ba fix(tools): bound the shaped-append side channel; total error containment; recorded spill snapshot
Responding to ds-review-bot round 2 on #661:

- logWork is bounded: past maxParallelSubCalls pending shaped-append tasks
  the ordered commit lane holds (Promise.race drains one), so a slow spill
  backend backpressures the run instead of accumulating unbounded pending
  I/O and retained results. Tasks self-remove on settlement; run
  settlement still drains every task inside the open turn. New spill test
  drives three oversized reads against a hung backend at cap 1 and proves
  the third dispatch cannot start until a save drains.
- shapeDispatchLog's catch uses errorMessage() (total), so a thrown value
  with a throwing toString cannot escape the containment and lose the
  settle event.
- CodeDispatchLog.content documented as the RENDERED result projection
  (native tool/result vocabulary), not what the program received — the
  program gets the structured value; doc pair + type-equiv re-synced.
- New RECORDED tui-agent snapshot scenario code-mode-dispatch-spill: the
  real Loader-visible composition (worker runtime + spill-local + policy)
  drives an oversized bash sub-call end-to-end; replay proves the durable
  dispatch copy is bounded to preview + locator while the program value
  stays whole (the outer result carries just the line count).

Agent Note updated (both languages).
2026-07-26 18:29:09 +08:00
..
2026-07-19 22:52:03 +08:00

spill/ - spill storage capability family

The tool-output spill capability seam: an abstract storage interface, a local filesystem implementation, and the tool-result policy that uses it. All product packages.

Package Role ctx key
spill/ Abstract spill storage seam (saveText — persist oversized tool text and return a locator + retrieval hint) ctx.spillStore
spill-local/ Local-filesystem backend: private, session-scoped files with traversal-safe names (registers on ctx.spillStore)
spill-policy/ tools/post-execute policy: replaces oversized plain-text results with a preview + spill locator (no service surface)

The interface lives at spill/spill/. The split mirrors bash/fs: the seam owns storage only, spill-local owns the filesystem mechanics, and spill-policy owns WHEN to spill and the model-facing notice. Preview mechanics stay in util/retention — the policy composes the two without either owning the other's job.

See the tool output spill Agent Note for the design rationale, including why final-result spill is separate from tool-owned early spill (bash streams, subagent rollouts) and why creation belongs to the runtime spill seam rather than the model-facing write tool.