Skip to content

perf(open): Cut the fixed delays before the harness starts - #104

Merged
4ndreello merged 7 commits into
mainfrom
perf/open-boot-latency
Sep 23, 2026
Merged

4ndreello merged 7 commits into
mainfrom
perf/open-boot-latency

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

codedeck open spent about 950 ms before the harness started, and most of it was fixed waiting inside CodeDeck, not Claude Code:

  • the boot animation slept 19 x 40 ms before the spawn;
  • ensureDaemonStarted slept 200 ms before its first socket check, while the daemon accepts in 60 to 80 ms;
  • every open ran claude twice before the launch: which plus claude --version in resolveBinary (78 ms, version unused) and claude --append-system-prompt-file in assertSupport (176 ms).

Changes:

  • playBoot derives its frame delay from a 200 ms budget (190 ms total). Same frames, same final banner, non-TTY path untouched.
  • ensureDaemonStarted polls every 25 ms until a 6 s deadline. Same error, same budget.
  • resolveBinary scans PATH in process and keeps detectBinary as the fallback. assertSupport records support in <base>/claude-support.json, keyed by realpath, size and mtime, only when the probe prints the missing-argument error. Unknown option, ENOENT and other failures are never recorded.

Spec: .specs/features/open-boot-latency/spec.md (R1 to R10).

Known limitation: when claude is a version-manager wrapper (mise, asdf, volta), realpath is the wrapper, so upgrading the real binary does not invalidate the record. Accepted because the probe only guards a long-standing flag and the real launch still reports the error. Documented at the lookup.

Measurements

Fake claude on PATH, isolated RUN_AGENT_DIR, pty via script(1), open general --effort high --no-worktree, 7 runs per build, base 252485b vs this branch:

Scenario Before (median) After (median) Saved
warm daemon, default theme 955 ms 356 ms 599 ms
warm daemon, --no-theme 222 ms 155 ms 67 ms
cold daemon, --no-theme 714 ms 533 ms 181 ms

Fake claude invocations per warm open: 3 before (version, probe, launch), 1 after (launch).

Tests

Scoped batches on the pre-rebase HEAD:

  • npx vitest run tests/open-boot.test.ts tests/ipc-daemon-start.test.ts tests/open-claude-probes.test.ts: 11 passed; the size-key test added afterwards passed in npx vitest run tests/open-claude-probes.test.ts (6 passed)
  • npx vitest run tests/open-: 281 passed
  • npx vitest run tests/ps.test.ts tests/claims-cli.test.ts: 44 passed
  • npx tsc --noEmit -p .: clean; npm run build: ok
  • R4 real-time test under 16 CPU burners on 12 cores: 20/20, p95 28 ms against the 50 ms bound
  • Mutation probes caught: final boot frame skipped, poll at 60 ms, poll at 100 ms, 5 s deadline, early return removed, detectBinary called first, mtime or size dropped from the key, support recorded on ENOENT, on unknown option, or on any probe failure

Not covered: Claude Code's own time to input-ready with and without the plugin (needs the authenticated account), scripts/pty-gate.sh and the theme and rename gates, and the codex and opencode launchers, which keep the same probe pattern.

4ndreello and others added 7 commits September 22, 2026 22:43
Keep the resolving logo within a 200 ms launch budget without changing the final banner.

Co-Authored-By: Codex <noreply@openai.com>
Resolve Claude from PATH without a version spawn and cache confirmed flag support by binary identity.

Co-Authored-By: Codex <codex@openai.com>
Repeat ENOENT against the unchanged executable and cover unrelated probe errors.

Co-Authored-By: Codex <codex@openai.com>
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit e1120fb into main Sep 23, 2026
4 checks passed
@4ndreello
4ndreello deleted the perf/open-boot-latency branch September 23, 2026 01:45
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