Skip to content

Add a bench for main-process lag under agent load (#1661) - #1683

Merged
currentbits merged 1 commit into
mainfrom
perf/agent-churn-bench
Oct 19, 2026
Merged

currentbits merged 1 commit into
mainfrom
perf/agent-churn-bench

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Adds scripts/perf/agent-churn-bench.js. It is the measurement for step 1 of #1661, which closed #1661: main stays responsive under agent load, so runner and Store stay in the main process.

The bench uses the same wiring as electron/smoke.js: real Store, runner, registerIpc, and a sandboxed window on preload.js. It does not boot main.js. It works on a /tmp clone of a store copy and refuses any other path. It starts N fake claude CLIs that stream stream-json partials through runner-provider-claude.js, then reports, for each agent count:

  • main event-loop delay (p50, p99, max)
  • main CPU
  • threads.list round-trip, timed in the renderer

BENCH_BIG_THREADS=1 streams into the largest transcripts in the clone (the worst case). It first moves those threads onto a scratch git repo, so no run touches a real project.

./node_modules/.bin/electron scripts/perf/agent-churn-bench.js /tmp/fstore 0,1,5,10,20 20

Results against the live store (1952 threads): p99 loop lag stays at 4–6 ms from 0 to 20 agents. The full tables are on #1661. This is a manual tool like store-stream-bench.js; no test or CI job runs it.

🤖 Generated with Claude Code

Runs N fake stream-json claude agents through the real runner, Store
and IPC against a /tmp copy of the store, and reports main event-loop
delay, main CPU and renderer-timed threads.list round-trip per level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T07:37:10.456083Z f073b7f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits merged commit cb8ba65 into main Oct 19, 2026
0 of 6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f073b7fb3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +159 to +161
const id = bigThreads.length
? bigThreads[i].id
: (await js(`window.coder.threads.create(${JSON.stringify({ projectId: project.id, title: `bench ${n}/${i}` })})`)).id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin new benchmark threads to the Claude provider

When BENCH_BIG_THREADS is unset and the copied store has defaultProvider set to Codex, Grok, or another provider, threads.create inherits that provider while only CODER_CLAUDE_BIN has been redirected. The benchmark can therefore launch a real installed CLI—potentially consuming paid usage—and measure a completely different adapter instead of the advertised fake-Claude workload. Pass provider: "claude" when creating every benchmark thread.

Useful? React with 👍 / 👎.

Comment on lines +162 to +163
threadIds.push(id);
await js(`window.coder.runs.start(${JSON.stringify({ threadId: id, prompt: "bench" })})`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Disable the run cap before measuring agent counts

With a normal copied store, maxConcurrentRuns defaults to 4, and runs.start returns a queued result for starts beyond that cap. Consequently the default 5-, 10-, and 20-agent rows run only four streaming processes during the sample, so the reported scaling data cannot support conclusions about those agent counts. Clear the cap in the cloned store or verify that all requested thread IDs are active before starting each measurement.

Useful? React with 👍 / 👎.

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.

Agent host: measure, then move runner + Store into a utilityProcess

1 participant