Relationships
#4471 behavior/workflow run: summary box border misaligns on rows with a truncated value
Opened by robin · 11/6/2026· Shipped 11/6/2026
Problem
The summary box printed after swamp behavior run (and swamp workflow run) draws its right border
in the wrong column on any row whose value is truncated. This happens when the behavior's longest
argument name is more than 12 characters. A real run, swamp 20261106.094050.0-sha.fcdd7e60:
┌──────────────────────────────────────────────────────────────────────────────────┐
│ Arguments │
│ query is:open is:pr archived:false (org:yo61 OR org:ycst-org-uk OR...│
│ mergeAuthors ["dependabot"] │
│ reviewAuthors ["yo61-renovate","horopter-renovate","ycst-renovate"] │
│ releaseAuthors ["semantic-release-pusher","horopter-semantic-release-pusher...│
│ mergeMethod squash │
│ │
└──────────────────────────────────────────────────────────────────────────────────┘Each truncated row is 2 columns wider than the box, so its │ lands past the corner.
Cause
renderDataBox in src/presentation/output/console_writer.ts has two width limits that don't know
about each other:
- The box's content width is capped at 80 columns (
Math.min(..., 80)), so the box is 82 wide. - Each value is truncated by
truncateString(value, MAX_VALUE_WIDTH): up to 60 characters, plus..., so 63.
An argument row is 4 (indent) + maxKeyLen + 3 (gap) + 63 wide. With maxKeyLen 14
(releaseAuthors) that's 84 against a box of 82. Padding is Math.max(0, boxWidth - visLen), so
it clamps to 0 and the row overflows. Any key column over 12 characters overflows by
maxKeyLen - 12.
From reading the code, without seeing it happen yet, the same arithmetic applies in two more places:
- "Data produced" attribute rows.
formatAttributeEntriesuses the same" "indent and the sameMAX_VALUE_WIDTH, so a string attribute over 60 characters under a key over 12 overflows in the same way. - Artifact header rows.
<name> from <source>isn't truncated at all, so a long data name or step name overflows by however much it's over.
A smaller related point: widths are measured with .length after stripAnsi, so any wide
character (CJK, emoji) in a value is counted as one column and misaligns the border too.
Proposed solution
Cut each value to the space the row has left, not to a fixed 60. Each value gets
80 - indent - keyColumn - gap - 3 columns before the .... Then the box's 80-column cap holds for
every row and the border always lines up. Header rows need the same treatment: truncate the name or
source so the row fits.
A test that renders a box with a 14-character key and a 100-character string value, and asserts every line has the same visible width, would catch this and any later version of it.
Alternatives considered
- Widen the box to fit the longest row. That fixes the border but breaks the 80-column limit the box was given, which the comment above the retrieval hints depends on ("a query is wider than the box's 80 columns").
- Lower
MAX_VALUE_WIDTH. That only moves the threshold. A long enough key overflows again.
Shipped
Click a lifecycle step above to view its details.
zack commented 11/6/2026, 3:49:12 PM
Thanks @robin for reporting this! We shipped: Make every row of the run summary box fit its 80-column limit so the right border always lines up. Build each box row as styled plain-text segments, fit it to the box with a display-width-aware fitRow before painting (the fitSegments pattern from update_check.ts), and pad by the returned width. Drop the fixed 60-character value cut, pad the key column by display width, and strip color codes from data text. This fixes overflowing argument rows, Data produced attribute rows, untruncated artifact headers, over-long keys and wide characters in one place.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.