Skip to content

CPLAT-12501: open on the outputs digest, and fix the 722ms startup stall - #173

Merged
gavin-jeong merged 1 commit into
masterfrom
CPLAT-12501-outputs-default-and-startup
Oct 1, 2026
Merged

gavin-jeong merged 1 commit into
masterfrom
CPLAT-12501-outputs-default-and-startup

Conversation

@gavin-jeong

Copy link
Copy Markdown
Collaborator

JIRA: https://sendbird.atlassian.net/browse/CPLAT-12501

Two reports, both of them startup defaults.

1. Scratchpad only showed on date rows

Not a collection bug — an asymmetry in which pane each row shows.

A date row ignores the preview mode and always renders Produced. Project and session rows follow sessPreviewMode, whose zero value is the conversation preview. So scratchpad — and PRs, Jira, plans — sat one p→o away on those rows while appearing immediately on a date row.

browserPreviewMode now defaults to the outputs digest, which is what the daily view already did. The first question about a row is what it produced, not the wall of conversation text that answers how; Tab still gets you the conversation.

Found while doing it: sessPreviewMode was only initialised from dailyPreviewMode when starting in the daily view, and otherwise fell through to the zero value rather than the starting view's own default. Both branches go through one path now.

2. Navigation sluggish right after launch

Handling the initial sessionsScannedMsg blocked the UI loop for 722ms. The breakdown on a 233-session directory puts almost all of it in one call:

Step Cost
autoSelectSession → CurrentWindowClaudes (first call) 223ms
newSessionList 7.5ms
applyStartupFilter 1.6ms
carryOverRefState, injectRemoteSessions <0.2ms

CurrentWindowClaudes walks every pane on the first call and is memoized after (2µs). autoSelectSession runs the moment the scan lands — purely to place the cursor — so the whole walk hit the loop exactly as the list first appeared.

Init's scan command warms the memo on its own goroutine now, next to the MarkLiveSessions call already there.

722ms → 8.4ms.

Test plan

  • go build ./... && go vet ./... && go test ./... green
  • Both symptoms reproduced and measured before changing anything
  • Four tests, each verified by reverting the relevant change and watching it fail:
    • TestScannedMsgDoesNotWalkTmuxOnTheUILoop — asserts the memo is already warm after the startup command, not a wall-clock number, so it cannot go flaky under load
    • TestBrowserOpensOnTheOutputsDigest — all three preview-mode fields
    • TestExplicitPreviewFlagStillWins — -preview conv must still beat the new default
    • plus the existing suite

My first version of the startup guard only ran Init()'s outer command and passed while the bug was present — the batch's inner commands were never called. It now expands the batch the way the runtime does.

Note on the behaviour change

Opening on the outputs digest instead of the conversation is a visible default change for anyone used to the current startup pane. Tab and the page menu reach the conversation as before, and -preview conv (or the persisted preference) still pins it.

Security checklist

  • No SecurityGroup rule changes
  • No 0.0.0.0/0 inbound
  • No public subnet resources
  • No IAM user changes
  • No secrets in code, commits, or logs

…he loop

Two reports, both of them startup defaults.

Scratchpad was only visible on date rows. Not a collection bug — an
asymmetry in which pane each row shows. A date row ignores the preview
mode and always renders Produced; project and session rows follow
sessPreviewMode, whose zero value is the conversation preview. So
scratchpad (and PRs, Jira, plans) sat one p->o away on those rows while
appearing immediately on a date row.

browserPreviewMode now defaults to the outputs digest, which is what the
daily view already did. The first question about a row is what it
produced, not the wall of conversation text that answers how; Tab still
gets you the conversation.

While doing that: sessPreviewMode was only initialised from
dailyPreviewMode when starting in the daily view, and otherwise fell
through to the zero value rather than the starting view's own default.
Both branches go through one path now.

Navigation was also sluggish right after launch. Handling the initial
sessionsScannedMsg blocked the loop for 722ms, and the breakdown on a
233-session directory puts almost all of it in one call:

  autoSelectSession -> tmux.CurrentWindowClaudes   223ms
  newSessionList                                     7.5ms
  applyStartupFilter                                 1.6ms
  carryOverRefState, injectRemoteSessions           <0.2ms

CurrentWindowClaudes walks every tmux pane on the first call and is
memoized after (2µs). autoSelectSession runs the moment the scan lands,
purely to place the cursor, so the whole walk hit the loop exactly as
the list first appeared. Init's scan command warms the memo on its own
goroutine now, next to the MarkLiveSessions call already there.

722ms -> 8.4ms.

Four tests, each verified by reverting the relevant change and watching
it fail. The startup guard asserts the memo is already warm rather than
a wall-clock number so it cannot go flaky under load, and
TestExplicitPreviewFlagStillWins pins that -preview conv still beats the
new default.
@upwind-code-us

upwind-code-us Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Upwind Upwind Code Scan - ✅ Passed

0 newly introduced vulnerabilities · 0 resolved · 1 total in this PR vs master

Total breakdown: 🔶 1 High

View full analysis in Upwind Console

Scan completed in 17s

Scan history (1 scan)
Commit Scanned at New Resolved Net
e83dd1a < 2026-10-01 04:34 UTC 0 0 0

Last scanned: e83dd1a · 2026-10-01 04:34 UTC

@upwind-code-us

upwind-code-us Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Passed

0 newly introduced misconfigurations · 0 resolved · 0 total in this PR vs master

View full analysis in Upwind Console →

Scan completed in 4s

Scan history (1 scan)
Commit Scanned at New Resolved Net
e83dd1a < 2026-10-01 04:34 UTC 0 0 0

Last scanned: e83dd1a · 2026-10-01 04:34 UTC

@Kairo-Kim Kairo-Kim added the auto-review/approved Auto-approved by the Slack auto-reviewer bot label Oct 1, 2026

@jinsekim jinsekim 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.

LGTM!

@gavin-jeong
gavin-jeong merged commit 943df96 into master Oct 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-review/approved Auto-approved by the Slack auto-reviewer bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants