Repository navigation
fix(#1691): honor decompress toFile destination (was ignored) - #1696
Conversation
…pdir()) The decompress tool advertised a toFile argument in its schema and prompt but never read it: every restore went to os.tmpdir() above 10K chars and inlined below, silently discarding any caller-supplied path. resolveDecompress (single chokepoint for the whole-block and CCR range paths) now routes through a shared toFilePointer helper: an explicit non-empty string destination wins regardless of body size, resolves relative paths against the proxy cwd, creates parent dirs, writes 0600, and returns/queues only a lean pointer (never inflating context). Explicit paths are intentionally left out of the temp-file reaper. Absent/empty toFile falls back to the prior behavior byte-for-byte; malformed (non-string) values log a one-line warning.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1638-pr.1696.153888eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1696.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Reviewing this PR now (it's prior agent work — verifying rather than redoing). Code read-through done: diff is single-commit, 2 files ( |
[bot] 🏷 Review verdict: mergeable. This is prior agent work, so I verified rather than redid it — pulled the branch at detached HEAD ( ① Original issue (#1691) — direction confirmed. I re-read the pre-fix source: ② Regression review — existing behaviors on touched paths, each verdict:
No unintended regressions found. Behavior changes disclosed in the PR (toFile honored for any size / relative→cwd / malformed→warn+default / no-toFile byte-for-byte unchanged) are accurate — I confirmed each against the code. ③ Code. Small, single-purpose helper; edge cases handled (undefined/null → default, non-string → warn+default, blank → default, parent dirs created, 0600, all fs errors caught). No ④ Tests. All 6 have teeth: exact-path existence (incl. nested dirs), negative assertions (body not inlined, no refold hint, no ⑤ Diff. Single commit, 2 files (+211/−2), every line on-purpose; no lockfile/version churn; branch is current with master (verified Evidence: local on rebased head — typecheck clean · build success · targeted 6/6 · full suite 3234 pass / 0 fail / 12 skipped (matches PR claims); GitHub CI on head Auto-merge gate §7.4: passes all 8 items (single-module fix, regression-covered, green on fresh head, no config/wire/persistence/cross-repo/load-bearing-infra touch, pure 中文摘要:修复了 decompress 的 toFile 参数“文档承诺但从未实现”的问题(显式路径现在按任意大小写入、相对路径按代理 cwd 解析、只回指针不撑大上下文,不传时行为逐字节不变);我逐项核对了受影响路径的既有行为(无回归)、验证了本地与 CI 全绿(typecheck/build/3234 项测试/CI 12/12),测试有牙、diff 干净,可以合并。 |
Summary
Honors the
toFileargument on thedecompresstool — previously advertised in the schema/prompt but never read. Every restore went toos.tmpdir()when the body exceeded 10K chars and inlined otherwise, silently discarding any caller-supplied path.Fixes #1691
Root cause
Not a regression — the feature was never implemented. In
src/decompress-shared.ts,resolveDecompress(the single execution chokepoint for both the whole-block restore and the CCR range restore) derived its output path exclusively fromtmpdir(), gated only bybody.length > 10000. Theargs.toFilefield was read nowhere. (Prior changelog mentions of a "#1334/#1294 toFile path" refer to the auto-tmpdir file branch, not this user-facing argument.)The tool schema and prompt strings live in acp-kernel and already advertise
toFilecorrectly — no kernel change is needed; this makes the shipped behavior match the documented contract.What changed
src/decompress-shared.ts:toFilePointer(args, ctx, header, body)helper. Whenargs.toFileis a non-empty string it wins regardless of body size: resolves relative paths against the proxy cwd (path.resolve), creates parent dirs, writes with mode0600, and returns/queues a lean pointer (… written to: <path>). The restored content is never inlined into context.pendingRetrievals(the full body is still never injected).toFiledestinations are intentionally NOT added totrackedTempFiles, so the temp-file reaper /beforeExitcleanup never touches a file the caller asked for by name.Behavior change (old → new)
toFilegivenos.tmpdir()if body >10K, else inlinetoFiletoFile(non-string)[acp-decompress] toFile must be a string…warning, then default outputtoFileNo config surface added (owner-gated area); no persistence or wire-format change.
Tests
New
tests/fix-decompress-tofile.test.ts(6 cases): a small restore written to a nested caller path (would otherwise inline), a large restore targeting the caller path instead of anacp-decompress-*tmpdir name, default unchanged (notoFilestays inline, no file created), a malformed value warning + falling back, a relative path resolving against cwd, and a rangetoFilewriting the span while queueing only a lean pointer.Pre-flight on rebased head (v0.1.172 /
c0e9e65f):typecheckclean · full suite 3234 pass / 0 fail / 12 skipped ·buildsuccess.