Skip to content

Show thread titles and project names in bb thread list - #1798

Merged
SawyerHood merged 1 commit into
mainfrom
bb/draft-pr-for-1648-bb-thread-list-prints-ids-but-thr_prg5jtedhi
Aug 18, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/draft-pr-for-1648-bb-thread-list-prints-ids-but-thr_prg5jtedhi

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

What was wrong

bb thread list printed exactly three columns: ID, Project, and Status. The server response for GET /api/v1/threads (and bb thread list --json) carries title and titleFallback for every thread, and the desktop sidebar and bb thread show display them. The table renderer printThreadTable in apps/cli/src/commands/thread/list.ts never put the title in the table, so a user had to shell out to --json to learn which thread was which. Root cause and repro: https://get-bb.github.io/reports/issues/1648.html

What changed

  • apps/cli/src/commands/thread/list.ts: add a Title column resolved as title -> titleFallback -> -, collapsed to one line and cut at 60 characters with an ellipsis. Column order is ID, Title, Project, Status; ID stays first for scripts.
  • Same file: the Project column now shows the project name. The command fetches projects.list once for the table view only (--json output does not fetch projects). Unknown project IDs fall back to the raw ID; the personal project still shows -.
  • apps/cli/src/__tests__/command-output/thread-list.test.ts: new test that asserts the Title header, the title, the fallback title, single-line collapse, 60-char truncation, project name resolution, and the unknown-project fallback; a test that --json skips the project fetch; the two exact-string layout tests updated for the new columns.
  • packages/templates/src/templates/bb-guide-threads.md (+ regenerated templates.generated.ts): document the table columns for bb thread list.

Deviation from the report

The report proposed only the Title column. Per the scope note (and #1760), this PR also resolves projectId to the project name in the same change.

Verification

  • New test bb thread list prints the thread title, fallback, and project name (#1648) fails on the base commit (3 failed / 7 passed with the old list.ts) and passes after the change.
  • pnpm exec turbo run typecheck test --filter=@bb/templates --filter=@bb/cli: 6 tasks successful, @bb/cli 452 tests passed, @bb/templates 44 tests passed.

Fixes #1648

AGENT GENERATED: by Claude Opus 5

bb thread list printed only ID, Project, and Status, so users had to fall
back to --json to see which thread was which. Add a Title column
(title -> titleFallback -> "-", one line, cut at 60 chars) and resolve
project IDs to project names. ID stays first for scripts.

Fixes #1648

Co-Authored-By: Claude <[email protected]>
@SawyerHood
SawyerHood marked this pull request as ready for review August 18, 2026 18:25
@bb-slop-cop

bb-slop-cop Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and test coverage.

thread.id,
thread.projectId === PERSONAL_PROJECT_ID ? "-" : thread.projectId,
truncateCell(formatThreadListTitle(thread), MAX_TITLE_WIDTH),
formatThreadListProject(thread, projectNames),

@bb-slop-cop bb-slop-cop Bot Aug 18, 2026 •

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.

🚨 slopcop/review — Bound the project cell before table layout. Project names only require a nonempty string, so their length and line count have no limit. projectWidth then uses the longest name for every row. A 10,000-character name across 1,000 thread rows produced about 20 MB of output in a local check. Apply the same single-line, maximum-width formatter to project names before this row is built.

}

function truncateCell(value: string, maxWidth: number): string {
const singleLine = value.replace(/\s+/g, " ");

@bb-slop-cop bb-slop-cop Bot Aug 18, 2026 •

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.

🚨 slopcop/review — Sanitize terminal control sequences before this value reaches cli-table3. This replacement removes whitespace only. I reproduced both ESC[2J and an OSC 8 link in the rendered output. A stored title, first-prompt fallback, or project name can therefore clear or reposition the terminal, create a misleading link, or trigger other terminal actions. Add a shared terminal-cell sanitizer that removes complete escape sequences and remaining C0/C1 controls. Apply it to both title and project cells before width calculation.

function truncateCell(value: string, maxWidth: number): string {
const singleLine = value.replace(/\s+/g, " ");
if (singleLine.length <= maxWidth) return singleLine;
return `${singleLine.slice(0, maxWidth - 1)}…`;

@bb-slop-cop bb-slop-cop Bot Aug 18, 2026 •

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.

🚨 slopcop/review — Do not truncate a Unicode title with UTF-16 code units. For example, 58 ASCII characters followed by an emoji cross this slice boundary. The result contains only the emoji's high surrogate before the ellipsis, so terminals show a replacement character. CJK and combining text also have display widths that differ from .length. Truncate by grapheme and terminal display width, then calculate titleWidth with the same width rule. Add emoji, CJK, and combining-mark cases.

@bb-slop-cop bb-slop-cop 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.

🚨 SLOP COP 🚨 · review

Plain English summary: This change makes bb thread list easier to read. It adds titles and replaces project IDs with project names. JSON output stays unchanged.

I found three issues:

  1. Medium security: The new text cells keep terminal control sequences. I reproduced a screen-clear sequence and an OSC link in the table output.
  2. Medium performance: A project name has no length limit and sets the width for every row. One test produced approximately 20 MB.
  3. Medium correctness: The title limit uses UTF-16 units. It can split an emoji and print a damaged character.

The title selection rule now exists in several app and CLI helpers. A small domain helper could return the title or its fallback. Each caller could select its own empty value.

The project lookup also adds one serial request. That request returns all projects and their sources. A small name lookup would reduce this work.

Validation passed. Turbo completed six tasks, 452 CLI tests, and 44 template tests. The source CLI showed the expected columns against the live server. All current GitHub checks pass.

I did not use a browser test because this pull request changes only the CLI and its guide.

@SawyerHood
SawyerHood merged commit bf3d67a into main Aug 18, 2026
10 checks passed
@SawyerHood
SawyerHood deleted the bb/draft-pr-for-1648-bb-thread-list-prints-ids-but-thr_prg5jtedhi branch August 18, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bb thread list prints ids but no titles

1 participant