Skip to content

fix: cap session tab title length - #68

Merged
auchan merged 2 commits into
mainfrom
fix/issue-63-cap-session-tab-titles
Sep 5, 2026
Merged

auchan merged 2 commits into
mainfrom
fix/issue-63-cap-session-tab-titles

Conversation

@pi-claw-agent

@pi-claw-agent pi-claw-agent Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Session editor-tab titles now pass through a deterministic code-point-based length cap (28 chars plus ellipsis, whitespace collapsed) applied in the shared tab-title builder, so streaming and idle states always produce the same label length and one long conversation can no longer crowd sibling tabs out of view. Added focused unit tests for truncation, surrogate safety, and the shared builder, plus source assertions locking equal-length caps for both tab states.

Validation

  • bun install --frozen-lockfile
  • bun run check-types
  • bun run lint
  • bun run compile-tests
  • bun esbuild.js
  • bun esbuild.webview.js
  • xvfb-run -a bun x vscode-test (189 passing)
  • git diff --check

Closes #63

@pi-claw-agent pi-claw-agent Bot added the agent:reviewing Independent Agent review is in progress label Sep 5, 2026
@pi-claw-agent

pi-claw-agent Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Independent Agent review: approved

Review round 1/2 for 59832c895382.

Session editor-tab labels now flow through a single capped builder (28 code points plus ellipsis, whitespace collapsed) used identically for streaming and idle states, so a long conversation can no longer push sibling tabs out of view and activation does not change label length. Unit tests cover truncation, surrogate safety, whitespace collapse, and the shared-builder wiring.

Findings

  • minor: Cap comparison uses UTF-16 length while slicing counts code points — src/tab-label.ts:15
    • Evidence: `compact.length <= maxLength` counts UTF-16 code units, but the truncation branch slices by code points. A label with exactly 28 code points that contains astral characters (e.g. '\u{1F600}'.repeat(28)) has 56 code units, so it takes the truncation branch and gains an unnecessary '…' (29 displayed) while an equally long ASCII label of 28 code points stays unadorned (28 displayed). Verified against the compiled module.
    • Recommended fix: Compare against the code-point count (e.g. Array.from(compact).length or a spread) in the length guard so the cap decision and the slice share one unit, keeping exact-cap labels free of a spurious ellipsis.

Reviewer checks

  • Inspected git diff main...59832c8 and traced every panel.title assignment through the shared tab-title builder, plus fallback labels and streaming-state updates.
  • bun run compile-tests
  • ./node_modules/.bin/mocha --ui tdd out/test/tab-label.test.js (5 passing)
  • ./node_modules/.bin/eslint src/test/tab-label.test.ts src/tab-label.ts
  • bun run check-types
  • node compiled-module boundary probes for astral characters at the cap (no surrogate splitting, unnecessary ellipsis at exact code-point cap confirmed)
  • git diff --check main...59832c8

Generated by the independent sandboxed Reviewer Agent. The PR still requires human review and merge.

@pi-claw-agent pi-claw-agent Bot added agent:pending-approval Independent Agent review passed; awaiting human approval and removed agent:reviewing Independent Agent review is in progress labels Sep 5, 2026
@auchan
auchan force-pushed the fix/issue-63-cap-session-tab-titles branch from 6ab564f to 4dd56a7 Compare September 5, 2026 16:00
@auchan
auchan merged commit aadb821 into main Sep 5, 2026
1 check passed
@auchan
auchan deleted the fix/issue-63-cap-session-tab-titles branch September 5, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:pending-approval Independent Agent review passed; awaiting human approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

标题栏应该采取更激进的宽度限制。

1 participant