Repository navigation
fix: decompress toFile export carries real failure outcome (#2204) - #2215
Merged
Merged
Conversation
toFilePointer resolved raw input straight through path.resolve, so host
virtual URIs (local://...) became disk paths (ENOENT mkdir noise), and
every export-failure site returned a success-shaped receipt:
- whole-block/range toFile + tmp-spill catches returned toolOk(...) with
'[Failed to write ...]' text; the range path even queued a fake user
injection, counted stats.rangeRestores and acked 'restored N item(s)'
while the file write had failed.
Fix at the decision point:
- resolveToFileTarget(): URI gate (scheme >= 2 chars; single letter stays
a Windows drive path), file:// resolved via fileURLToPath, any other
scheme refused BEFORE any fs operation with an actionable message.
- exportFailureReceipt(): toolFail('[decompress FAILED: could not write
export to ...]') with the preview labeled partial/full (shown of total
chars) plus retry advice; all four export sites return it.
- resolveDecompressRange returns the failure before queueing an injection,
bumping stats or marking dirty.
- forwardTool (shared agent lane) now returns { text, failed } mapping
outcome failure|refused exactly like mcp.ts; native plugin lanes surface
isError:true (pi/omp manifest tool, dsh-native, opencode-native V1 throw)
so hosts see a real error instead of isError:false.
Behavior changes (old -> new): failed exports outcome success -> failure
and host toolResult isError false -> true on all plugin/MCP lanes; receipt
text changes from '[Block ... content] / [Failed to write ...]' to
'[decompress FAILED: ...]' + labeled preview (model-visible in all modes);
unsupported URIs are refused pre-fs instead of mis-resolved; file:// URIs
are now resolvable; wire mode: a failed export now trips the existing
FAILED guards (pair stays visible, repeat-identical-failure early stop);
plugin-mode context credit no longer counts failed exports as restores.
Success-path outputs are byte-identical (pinned by the untouched
#1691/refold/ccr suites).
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)This exact version is immutable and reproducible. The rolling Option B — Download artifact
Install instructions are refreshed on each push. |
Owner
Author
added 2 commits
October 6, 2026 02:34
Review find on PR #2215: three tests in the new suite used fixture sizes the kernel cannot produce — folds under the 5000-char min-compress threshold create no block ('blockId is required'), and bodies over the 10000-char gate spill to tmp instead of restoring inline. Fixtures now sized so every asserted branch is reachable (endRef=6 whole-block ≈8.3K; single-message range span <4000 preview cap for the FULL label; endpoint span clears the post-trim min threshold). Product code untouched.
Review find on PR #2215 (pre-existing on master, not PR-introduced): the acp-kernel file: link entry in package-lock.json recorded 0.0.102 while kernel/package.json is 0.0.103, so every fresh checkout + npm install churns this line. One-line sync as generated by npm install.
Owner
Author
[bot] 🏷 PR #2215 review 完成。方向正确、机制全部在代码里核实成立,但新测试套件有 3 个用例在提交树上必然红(fixture 尺寸落在 kernel 不可能产生的区间),已在 PR 分支直接修掉;另发现 master 预存的 lockfile 漂移,一并顺手修掉。当前 PR head: 审核过程
我在 PR 分支上的修复(两个独立标注 commit)
行为变更披露(有意变更,旧值→新值+原因)
结构化七问
结论可合。方向对、机制实、测试有牙,无回归、无 config surface 变更。CI 正在新 head |
Contributor
📦 Merged Build PublishedThis merge to master was published as
|
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 #2204
What was wrong
toFilePointer(src/decompress-shared.ts) fed the rawtoFileinput straight intopath.resolve, so host virtual URIs (local://bili-investigation-b2.txt) became disk paths (local:\...→ ENOENT mkdir noise). Worse, every export-failure site returned a success-shaped receipt:toFilecatch and both tmp-spill catches returnedtoolOk(...)with[Failed to write ...]text;stats.rangeRestores, and ackedrestored N item(s) — full content followswhile the file write had failed;ok:true + outcome:"success", and the native agent lanes (pi/omp/dsh/opencode via sharedforwardTool) render that asisError:false— exactly what OMP observed.Fix (at the decision point, not a symptom mask)
resolveToFileTarget(): URI form requires scheme length ≥ 2 (a single letter stays a Windows drive path, protecting informalC://xinputs);file://is resolved viafileURLToPath; any other scheme is refused before any fs operation with an actionable message naming the scheme and the remedy. No morelocal:directories.exportFailureReceipt()buildstoolFail('[decompress FAILED: could not write export to <path>: <err>]')with the preview explicitly labeledpartial content follows (shown of total chars)/full content followsplus retry advice. All four export sites return it;resolveDecompressRangereturns the failure before queueing an injection, counting a restore, or marking dirty.forwardToolnow returns{ text, failed }, mappingoutcome: failure|refusedexactly like mcp.ts already did; pi/omp manifest tool setsisError:true, dsh-native and opencode-native V1 throw the receipt text through their error channels; human-facing commands take.textunchanged.The
[decompress FAILED:prefix also integrates with existing machinery for free: wire mode now trips the establishedFAILEDguards (the failed pair stays visible; repeat-identical-failure early stop applies), and the plugin-mode success-header credit no longer counts a failed export as a restore.Behavior changes (old → new)
toFile/tmp-spill export (all 4 sites)success; host toolResultisError:falsefailure;isError:trueon all plugin/MCP lanes[Block … content …]\n[Failed to write …]\n<prefix>...[decompress FAILED: could not write export to …: <err>]+ labeled preview linelocal://…)file://URIfileURLToPathrestored N item(s)ack + fake user injection + stat bumpFAILEDcontract, wording linkage onlySuccess-path outputs are byte-identical (pointer text, tmp spill, inline, refold hint) — pinned by the untouched #1691/refold/ccr suites, all green.
Config surface
None. No new config keys, env vars, or CLI flags;
decompress.toFilesemantics stay "filesystem path", now with an explicit URI boundary documented in the refusal text.Verification
tests/issue2204-decompress-to-file-outcome.test.tscovering the issue's four required behaviors: legit absolute path write+read-back; unsupported URI refused pre-fs (asserts nothing created on disk); deterministically-triggered mkdir/write failure → failure outcome + labeled partial preview + block undamaged (retry succeeds); default over-length export still pointer-only. Plus:file://resolution, single-letter-drive non-classification, range-path no-injection-on-failure, endpointok:true + outcome:failure/success, and sharedforwardTooloutcome mapping (incl. legacy envelope degradation).tests/plugin-agent.test.ts: new end-to-end test — business-failure receipt reaches the pi/omp host asisError:truewith full text.