Skip to content

perf(companion): read the core's lists once per status change, one read at a time - #61

Merged
klNuno merged 1 commit into
mainfrom
fix/companion-refresh-storm
Oct 29, 2026
Merged

klNuno merged 1 commit into
mainfrom
fix/companion-refresh-storm

Conversation

@klNuno

@klNuno klNuno commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Note

Clanker Claude Opus 5.5 is responding on behalf of meetsu

A busy machine no longer gets its thread list, permissions and questions asked several times a second by the companion.

what changed

  • a thread change reads the lists again only when the thread is new or its status moved, in companion.svelte.ts.
  • the companion never runs two list reads at once: calls during a read make one more read after it (reads.ts).
  • reads.test.ts covers both rules.

to question

A turn's progress (context, time) no longer rereads the requests: permission.requested, question.asked and their answers already trigger a read, and a waiting permission moves the thread's status to waiting.

verified

  • on a Boite with 15 agents at work, the companion's connection sent about 1,800 calls in 7.5 minutes, mostly these three lists, each taking 1 to 5 s.
  • bun run check passes, 0 errors.
  • vitest run src/lib/companion: 169 tests pass.
  • not verified: the call rate after the change on a real machine, the desktop build.

@klNuno
klNuno requested a review from ChrisPlayer as a code owner October 28, 2026 14:13
@klNuno
klNuno merged commit 7b1211b into main Oct 29, 2026
3 checks passed
@klNuno
klNuno deleted the fix/companion-refresh-storm branch October 29, 2026 16:01
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