Skip to content

Inspector performance: scoped summaries, non-blocking crew integration - #1424

Merged
currentbits merged 10 commits into
mainfrom
coder/inspector-performance
Oct 4, 2026
Merged

currentbits merged 10 commits into
mainfrom
coder/inspector-performance

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part 1 of #1422 (the redesign follows in a separate PR). Spec and plan are included under docs/superpowers/.

What was slow

  • P1, Agents tab during a crew run:
    • The crew-integration effect depended on the summaries array, which is new on every 5 s poll, and reloaded on every threads:changed.
    • Each call ran about 6 + 3×workers blocking git commands in the main process (execFileSync), roughly 100–270 ms of stall per call, many times a minute.
  • P2, P1: Scope threads:summaries so opening Agents does not read every transcript #1398:
    • threads:summaries read the last message of every thread (about 1,850).
    • The Recap card fetched all rows to show one, on nearly every thread selection.
    • The team poll ran every 5 s whenever any project had a working thread.
  • P3: memo(AgentsPanel) never skipped renders, because App passed new inline crew handlers on every render.
  • P4: a panel-level LaneHeartbeat duplicated the app-level ClaimedLanesHeartbeat and wrote the store every 15 s.

Changes

  • threads:summaries scoping: it accepts { projectId?, threadIds? }, filters before any message read, and caps lastActivity.text at 200 characters. With no argument the output is unchanged.
    • The Recap card passes { threadIds: [id] }.
    • The team view passes { projectId }.
    • The poll key (panelRosterKey) covers only the selected project.
  • Crew-integration effect:
    • It is keyed on a derived isCrewLead boolean, and threads:changed reloads are throttled to 1 s.
    • A request-sequence guard drops stale results, now that responses can arrive out of order.
  • Async git in crewIntegration: it uses gitTryAsync, repoDefaultBranchAsync and a new listChangedPathsAsync, which shares diffBaseCandidates with the sync resolveDiffBase. Same values, and it no longer blocks main.
  • App: stable useCallback crew handlers, and the duplicate lane heartbeat is removed. Remote projects can't claim lanes, so the app-level beat covers everything.

Verification

  • tsc clean.
  • Renderer 2679/2679. vite build OK.
  • Electron 4106/4107 on the pre-fix HEAD. The one failure is an unrelated claude.test.js JSON-read race; it passes 3/3 alone.
  • Crew-integration and worker-snapshot 33/33 after the final fixes.
  • New tests:
    • scoped summaries read only the requested threads;
    • Recap and the team view request the narrowest scope;
    • no crew-integration rerun on a summaries-only change;
    • five pushes collapse into one reload;
    • an out-of-order integration result can't overwrite a newer one;
    • crewIntegration yields to the event loop with a live lead and worker.
  • Per-task reviews and a final whole-branch review: ready to merge.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Willem and others added 10 commits October 4, 2026 13:37
The Recap card now asks for just its own thread's summary and the
Agents team view asks for just its project's rows. App gives AgentsPanel
a project-scoped panelRosterKey so a working thread in another project
no longer keeps the 5s team-view poll alive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keys the crew-integration effect on a memoized isCrewLead boolean instead
of the raw summaries array, so a new array on every 5s poll no longer
reruns ~6+3xworkers blocking git commands. Also debounces the
threads:changed push reload to one reload per second.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
crewIntegration built the Agents tab read model entirely with blocking
execFileSync git calls, stalling the whole Electron main process. Add
listChangedPathsAsync and export repoDefaultBranchAsync (gitTryAsync was
already exported), extract diffBaseCandidates so resolveDiffBase and its
new async twin share one candidate list, and make crewIntegration async
end to end (worker rows via Promise.all to preserve row order). Only
production caller is the async IPC handler at ipc.js:510, which already
awaits the return value as a promise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
crewIntegration is now async in main, so the lead effect's poll and the
four action handlers (integrate/refresh/verify/land) can resolve out of
order; a late poll could clobber the view a just-finished action just
set. Add integrationSeq, bump it before each crewIntegration call, and
only apply a result (or its error) if the sequence is still current.
Keeps the effect's existing cancelled guard alongside it.

Also update two stale comments that said the team-view fetch walks
every thread's messages; it has been scoped to the selected thread's
project since #1398.

Added a renderer test (TDD: verified RED against the pre-fix code,
then GREEN) that resolves an early crewIntegration call slowly and a
later one fast, asserting the later view is not overwritten.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The P2 bullets and the Data flow line still described the pre-#1398
plan (threadIds-only filter, RecapCard passing its own id, team view
passing crew children, poll gated on "this crew"). Update them to
match what shipped: threads:summaries takes { projectId?, threadIds? },
RecapCard passes { threadIds: [id] }, the team view passes
{ projectId }, and the 5s poll runs only while a thread in the
selected project is working.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"crewIntegration yields to the event loop while it runs git" ran with
no worktree and no workers, so it never exercised the git reads it
claims to yield around. Give the lead a committed change and fork one
worker with its own change (workOn/forkWorker), and assert
view.workers.length === 1 alongside the existing yield assertion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant