Skip to content

fix(adapter-core): board clip() measures display columns, not string length (bro-2r7f7) - #1186

Merged
devin-ai-integration[bot] merged 3 commits into
mainfrom
devin/1795603072-2r7f7-wide-clip
Nov 25, 2026
Merged

devin-ai-integration[bot] merged 3 commits into
mainfrom
devin/1795603072-2r7f7-wide-clip

Conversation

@ThePlenkov

@ThePlenkov ThePlenkov commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

The clip function in adapter-core now respects terminal column width rather than string length. Wide characters (CJK, emoji, full‑width) count as two columns, combining marks as zero width, and surrogate pairs are never split. This prevents overflow when truncating text for display.

Changes

  • Added charWidth(cp) to determine column width of a code point (0 for combining/zero‑width, 2 for wide ranges).
  • Added displayWidth(text) returning total terminal columns.
  • Rewrote clip(text, width) to iterate code points, accumulate width, and stop before exceeding the budget, appending an ellipsis.
  • Added unit tests covering CJK text, surrogate pairs, and combining marks.

Functional impact

  • Text truncated at the correct visual width, preventing overflow in terminal or UI layouts.
  • Wide glyphs like CJK characters and emoji are properly accounted for, so they are not incorrectly truncated or allowed to exceed the display width.
  • Combining marks (e.g., accents) do not add extra columns, preserving text integrity.
  • Surrogate pairs (emoji) are kept intact, avoiding broken characters.

Summary by Sourcery

Update adapter text clipping to measure visual terminal width instead of string length.

Bug Fixes:

  • Make text clipping respect terminal display columns so wide glyphs no longer overflow constrained layouts.
  • Preserve surrogate pairs and combining marks when truncating displayed text.

Enhancements:

  • Add display-width calculation for combining marks, zero-width characters, CJK/full-width characters, and emoji across core and generated plugins.

Tests:

  • Add coverage for wide glyphs, emoji, surrogate pairs, combining marks, and unchanged narrow text behavior.

…length (bro-2r7f7)

Wide glyphs (CJK, emoji) count as two terminal columns but slice()
counted them as one — titles overflowed the board panel — and a cut
inside an astral character split the surrogate pair. clip() now walks
code points (for..of never splits pairs) against a wcwidth-lite column
budget: zero-width combining marks and joiners, two-column wide and
fullwidth ranges. displayWidth() exported for hosts that pad/align.

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@amazon-q-developer

Copy link
Copy Markdown

Warning

Amazon Q Developer for GitHub: end of support

On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026.

For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c17311b-2cdd-48ec-aa9b-224cef58cff7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Export displayWidth so hosts can measure terminal columns using the same width rules as clipping.

  • packages/agent-plugins/adapter-core/src/core.ts L527-534

Implementation

Add code-point width calculation and use it to clip without exceeding the column budget or splitting surrogate pairs, including in the regenerated plugin adapters.

  • packages/agent-plugins/adapter-core/src/core.ts L493-526, L535-552
  • plugins/omp/bro/bro.ts L364-391
  • plugins/pi/bro/bro.ts L364-391

Tests

Cover display-width clipping for wide glyphs, surrogate pairs, and combining marks.

  • packages/agent-plugins/adapter-core/src/core.test.ts L21, L64-92

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR correctly fixes the core bug (string-length vs. display-column measurement, surrogate-pair safety via for..of) and the approach is sound. However, there is one blocking logic error in the charWidth implementation:

Critical — incomplete emoji range in charWidth

The wide-character check covers 0x1f300–0x1f64f but misses the transport/map block (0x1f680–0x1f6ff), supplemental symbols (0x1f900–0x1f9ff), and other widely-used emoji planes up to 0x1fffd. Emoji like 🚀, 🚗, 🛸, 🤔 all land in these gaps and are measured as 1 column, reproducing the exact overflow bug the PR claims to fix. The surrogate-pair test uses \u{1F680} (🚀) and labels it "width 2" in its comment, but the current code returns 1 for that code point — the test only passes by coincidence because its assertions don't directly verify the emoji's column width.

Two comments posted:

  1. core.ts — fix the missing emoji ranges in charWidth.
  2. core.test.ts — add an explicit assert.equal(displayWidth(emoji), 2) assertion so the test actually enforces the intended behavior and would have caught the range gap.

You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@codacy-production

codacy-production Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 141 complexity · -1 duplication

Metric Results
Complexity 141
Duplication -1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review November 25, 2026 10:43
@codeant-ai

codeant-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #f28c9 Reviewed your PR 380d342 Nov 25, 2026 · 10:43 10:55

@codeant-ai

codeant-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@kody-ai

This comment has been minimized.

@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Sorry @devin-ai-integration[bot], you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 days by commenting @sourcery-ai review. Upgrade to get a review now.

@baz-reviewer

baz-reviewer Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Merger   ✅ Ready to Merge

The diff delivers display-column-aware clipping, including wide characters and surrogate pairs. All review discussions are settled.


@gitar-bot

gitar-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Gitar is working

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Gitar

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Nov 25, 2026
Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
amazon-q + macroscope on #1186: 1f300–1f64f misses transport/map
(1f680–1f6ff, 🚀 included) and supplemental symbols — rockets measured
1 column and clip('🚀'×40) overflowed the board at 80 columns.

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

@kody-ai

kody-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@sonarqubecloud

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Devin Review

🟢 Devin Review found nothing to fix · View findings

@kilo-code-bot

kilo-code-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/agent-plugins/adapter-core/src/core.ts
  • packages/agent-plugins/adapter-core/src/core.test.ts
  • plugins/omp/bro/bro.ts (generated — verified in sync with core)
  • plugins/pi/bro/bro.ts (generated — verified in sync with core)

Reviewed by free · Input: 152.5K · Output: 10.2K · Cached: 872.4K

Review guidance: REVIEW.md from base branch main

@codeant-ai

codeant-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Nitpicks

3 code suggestions

1. U+1AB0 is a zero-width combining mark outside this range, so displayWidth overcounts it and clips otherwise-fitting titles early.

Logic error · packages/agent-plugins/adapter-core/src/core.ts:498


2. 🚀 (U+1F680) falls outside this range and is counted as one column; clip(&#x27;ab🚀cd&#x27;, 4) then returns five terminal columns.

Logic error · packages/agent-plugins/adapter-core/src/core.ts:517


3. The checked-in pi and omp adapters still use the old string-length clip, so users loading those bundles keep seeing overflow and split surrogate pairs.

Incomplete implementation · packages/agent-plugins/adapter-core/src/core.ts:537-552

@codeant-ai

codeant-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 8c098f2394fe

@devin-ai-integration
devin-ai-integration Bot merged commit db98d7e into main Nov 25, 2026
23 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the devin/1795603072-2r7f7-wide-clip branch November 25, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baz: ready to merge size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant