Repository navigation
fix(acp): replace invalid UTF-8 bytes that broke Biome checks - #1876
ShryukGrandhi wants to merge 1 commit into
Conversation
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
nc-review: comments — 1 important, 1 nit@ShryukGrandhi — a few things worth a look, none blocking. The PR replaces corrupted bytes (stray 0x9d / Windows-1252 0x97) with real em dashes in source/acp/acp-agent.ts and source/app/prompts/sections/task-approach-nano-architect.md, applies the Biome formatting fix the bad bytes were hiding, and adds a repo-scoped strict-UTF-8 regression spec. This directly and correctly resolves issue #1862: I confirmed the base copies of both files still contain the corrupt bytes (and task-approach-nano-architect.md is the only sibling section affected), and the new spec would fail before the fix and pass after. The code and tests are sound; the one substantive concern is that the ACP-agent.ts portion of this fix (and a pending changeset for it, .changeset/acp-help-invalid-utf8.md) already appears to be present on the base branch, so this PR may be re-applying an already-landed fix and adds a redundant second changeset for it. I could not find this exact PR among the open-PR corpus, so I am not claiming a live duplicate — please confirm whether the ACP hunks are already on main and consolidate the changesets. 🟠 important · The base branch already ships If that is the case, please drop the redundant ⚪ nit · Nice regression test — the strict 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Description
source/acp/acp-agent.tshad seven stray0x9dbytes where em dashes used to be: in the VS Code/helpreply (the built-in command list and the custom command list) and in two comments. They are not valid UTF-8, so Biome stopped withstream did not contain valid UTF-8, andpnpm test:lint/pnpm test:formatfailed for the whole repo. The same lines also reached clients as replacement characters.The original version of the file (67d8a81 / 663b688) had real
—characters. A later edit reduced each one to a single byte. This PR puts the em dashes back.The new regression test turned up one more file with the same problem:
source/app/prompts/sections/task-approach-nano-architect.mdhad a Windows-12520x97in its heading. That section goes into the system prompt in nano architect mode. I changed it to—as well, so it matchestask-approach-architect.md.Once Biome could read
acp-agent.ts, it reported one formatting difference (theacpContentToUserMessage(...)call) that the bad bytes had been hiding. I appliedbiome formatto fix it, sotest:formatpasses.I added
source/source-encoding.spec.ts. It decodes every.ts/.tsx/.js/.json/.mdfile undersource/with a strict UTF-8 decoder, so this kind of problem shows up in the AVA run, not only as a Biome I/O error.Fixes #1862
Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Before the fix,
pnpm exec biome check source/acp/acp-agent.tsfailed with the UTF-8 I/O error, and the new spec failed and listed both files. After the fix:pnpm run test:format: passespnpm run test:lint: passespnpm run test:types: passespnpm run test:knip: passespnpm run test:ava source/source-encoding.spec.ts source/acp/: 238 passedpnpm run test:ava source/source-encoding.spec.ts source/acp/acp-agent.spec.ts source/utils/prompt-builder.spec.ts: 138 passedThe full AVA suite did not finish within 20 minutes on my machine, so I only ran the specs listed above.
Manual Testing
Checklist