Repository navigation
Conversation
There was a problem hiding this comment.
The fix is sound. On the base, the new ACP wire test fails with the -32603 Internal error from the issue. With this change it passes, and all of test/acp/ passes (101 tests). typecheck:tsc is clean.
Wrapping parsePatch in Effect.try lets a bad patch header take the existing per-file orElseSucceed fallback, the same way the applyPatch and Patch.derive calls next to it already do. The file gets no diff and the turn continues.
Public API: unchanged.
One small point: this is a one-line fix, so the new test in prompt.test.ts can be dropped to keep the change minimal.
There was a problem hiding this comment.
The new commit only adds a test. It runs a real ACP subprocess and edits notes.txt\nx. I ran it: on the base it fails with the -32603 internal error, and with this change it passes. All of test/acp/ passes (102 tests), and typecheck:tsc is clean. Public API: unchanged.
The fix is still sound. Like the wire test in prompt.test.ts, this second test isn't needed for a one-line fix and can be dropped to keep the change minimal.
What was wrong
Over ACP, editing a file whose name contains a newline (for example
notes.txt\nx) changed the file, but the tool call never completed. The prompt then failed with-32603 Internal error, which ended the turn.Root cause
When a tool call completes,
withCompletedDiffsinpackages/cli/src/acp/permission.tsrebuilds a client diff from the patch the tool recorded. A newline in the file name breaks the patch header, soparsePatchthrowsUnknown line 5 "x". That was the only call in the per-file pipeline not wrapped inEffect.try. The throw became a defect, which the per-fileEffect.orElseSucceeddoes not catch, so the error escaped and failed the whole update and the turn.Fix
Wrap
parsePatchinEffect.try, like theapplyPatchandPatch.derivecalls next to it. If the patch can't be parsed, the existing fallback now handles it: the tool call completes without a diff for that file, and the turn continues.How verified
packages/cli/test/acp/prompt.test.tssends a completededitfornotes.txt\nxthrough the real ACP agent. Before the fix it fails with the same-32603 Internal errorthe issue reports. With the fix the turn ends withend_turnand the tool call completes. The test is skipped on Windows, because Windows file names cannot contain a newline.bun test test/acp/inpackages/cli: 101 pass. The new test also passed--rerun-each 10.bun typecheckinpackages/cli: clean.No feature flag: this is a bug fix.
Visual
Closes #54831