Skip to content

fix(acp): long sign-in errors no longer end with a broken character - #48381

Open
StiensWout wants to merge 5 commits into
pingdotgg:mainfrom
StiensWout:wf/find-718b990b08818589649dcb47
Open

StiensWout wants to merge 5 commits into
pingdotgg:mainfrom
StiensWout:wf/find-718b990b08818589649dcb47

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

When an ACP agent returns a sign-in error longer than 500 characters, the app shortens it. The cut counted UTF-16 units, so an emoji or flag at the limit was split, and the error ended with a replacement character (�) or half a flag before the ellipsis. The shortened message now ends at the last whole grapheme within the same 500-unit budget, so it never ends on a partial character.

Related: #44772, #48336

Reproduction on main

Commit 82eacef94b (main). The key emoji turns into a replacement character just before the ellipsis. Expected: The shortened error ends at a character boundary.

  1. Add the demo sign-in agent as a Local ACP command.
  2. Open the demo sign-in agent in Settings → Providers.
  3. Click Sign in.
  4. Read the end of the error under Account.

The cause is at packages/provider-acp-registry/src/server/auth.ts:36. Ran pnpm scenarios:prove scripts/scenarios/acp-sign-in-error-keeps-whole-characters.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expected "on refused�…" not to contain "�" in the output.

Evidence

Environment: The web app in Chromium on Linux x64, a fresh checkout on a boat.dev VM reset before each run.

Proven: the repro fails at the test commit a97c685b65 and passes on the head 7ec341ba59, both on main 82eacef94b.

Before After
Commit a97c685b65 7ec341ba59
Result ASSERTION_FAILED: expected "on refused�…" not to contain "�" passed
acp request error (unchanged) Before: acp request error
The key emoji turns into a replacement character just before the ellipsis.
After: acp request error
The shortened error ends at a character boundary.
failure Before: failure
Recording Before: recording After: recording

Tests

  • a97c685b65 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 82eacef94bbaeb8a6b223e29efa1be3209025984 passed on head.

Not in this change

  • Other providers' error truncation was not audited for the same split.
  • The terminal sign-in path (lastPrintedLines) keeps its own tail cut, which already avoids splitting surrogate pairs; it was left as is.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by Claude Opus 5.5 and GPT 6.2 Sol

StiensWout and others added 5 commits December 3, 2026 19:55
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Dec 3, 2026
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ACP error formatter now truncates details at grapheme boundaries within the 500-code-unit limit. Unit and end-to-end tests cover Unicode boundary cases and the displayed sign-in error.

Changes: ACP error truncation

Layer / File(s) Summary
Grapheme-safe truncation
packages/provider-acp-registry/src/server/auth.ts, packages/provider-acp-registry/src/server/auth.test.ts
appendDetail now truncates at a complete grapheme boundary. Unit tests cover surrogate pairs and regional-indicator flags at the limit.
Sign-in error validation
scripts/scenarios/acp-sign-in-error-keeps-whole-characters.e2e.ts
A local ACP agent returns a diagnostic with an emoji across the truncation boundary. The end-to-end test checks the displayed error and removes the temporary provider instance during cleanup.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: saphid

Merge Risk: Minimal · up to 7ec34

Long sign-in errors will no longer be cut in the middle of an emoji or flag. The change is small, covered by tests, and easy to revert, so the merge risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(acp): long sign-in errors no longer end with a broken character" states the main change: sign-in error truncation no longer splits a character. The changeset matches it. The changes to …
Description check Passed The description follows the template. It has a problem statement (the 500-unit cut splits emoji and flags), a change explanation (truncate at the last whole grapheme within the same budget), and verif…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(acp): long sign-in errors no longer end with a broken character" states the main change: sign-in error truncation no longer splits a character. The changeset matches it. The changes to appendDetail in auth.ts truncate at the last grapheme boundary, and tests and an e2e scenario cover the case. The title is 67 characters, a single conventional-commit sentence, and the 67-character length is within normal limits.

Full details: Description check

Explanation

The description follows the template. It has a problem statement (the 500-unit cut splits emoji and flags), a change explanation (truncate at the last whole grapheme within the same budget), and verification evidence (a failing test before the fix and a passing run on head, with before/after screenshots and recordings). It also notes what is out of scope. The Scope section links related issues #44772 and #48336 but does not explicitly say whether the bug is covered by an issue or why no issue is needed. The title check is not affected by this gap. The description lists the models that did the work, which the template asks for. The author also states the check was run on the changed files, so the verification section is specific.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 82eacef and 7ec341b.

Files selected for processing: 3

  • packages/provider-acp-registry/src/server/auth.test.ts
  • packages/provider-acp-registry/src/server/auth.ts
  • scripts/scenarios/acp-sign-in-error-keeps-whole-characters.e2e.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@macroscopeapp

macroscopeapp Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7ec341b

Macroscope's review found this PR approvable — Long ACP sign-in error details now truncate at complete Unicode grapheme boundaries rather than splitting characters. The change is limited to error-message presentation and preserves the existing length limit.

You can add or adjust custom eligibility rules. Learn more.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant