OpenProgram Docs

Startup latency

  1. CLI commandbuilds the parser, checks first run
  2. no model catalogue read
  3. TUI first frameNode draws, the Worker is already up
  4. the Worker warmed SDKs and turn modules after start
  5. First turnreaches the model as fast as later turns

Code: interfaces/server/prewarm.py; operations/worker/runner.py _warm_providers; interfaces/cli/commands/providers/parser.py; interfaces/cli/application.py _needs_first_run_setup; models/auth/store.py stored_providers; programs/tools/web/pdf.py _tool_check_fn. Tests: tests/component/core/test_startup_latency.py.

What was measured

A fresh trial Worker per round (OPENPROGRAM_TRIAL=1, own data directory, port and fake model), the code before and after the change in alternating rounds. Load average was 50 to 115, so single runs vary twofold; figures are medians of 12 TUI starts and 5 Worker starts per tree.

PathBeforeAfterCause
Building the CLI parser0.2–0.27 s with a cached catalogue; 2.6 s without one0.09 sproviders/parser.py imported providers/keys.py for its arguments, which imported models.listing and read the models.dev catalogue, fetching it when no cache existed. Every command builds the whole parser
First-run checkRead the catalogue for every known providerReads only the stored key filesstore.get resolves company aliases through the catalogue; the check now asks store.stored for the providers that have a file
TUI: CLI to Node spawn, Worker running2.2 s1.2 sThe two items above
TUI first frame, Worker running3.2 s2.0 sNode and Ink rendering after the spawn is unchanged
First turn after Worker start, to the model request3.9 s; 1.14 s in a quieter run0.84 s; 0.76 sOne-time imports on the turn: the OpenAI SDK 0.44 s and its resources 0.19 s, AppKit, ApplicationServices and ScreenCaptureKit 0.12 s for the computer-use check, pypdf 0.07 s for the PDF tool's availability check. Sampling the turn: 0.95 s busy before, 0.24 s after
Later turns0.14–0.4 sunchangedThe bound for the first turn

Background warm-up

After the providers are initialised, _warm_providers runs prewarm.run on the same background thread. Each step is independent; one that raises is skipped and the Worker log gets one line with each step's time.

StepWhat it loads
provider_sdksThe SDK of each model in use: the default conversation model and every Agent's pinned model, mapped by API (openai, anthropic, google.genai) with their resource modules. SDKs of providers no one uses stay unloaded
turn_modulesThe turn runtime and the computer-use provider registry
computer_use_frameworksThe macOS accessibility and capture frameworks, only where computer use reports itself available

The PDF tool's availability check uses importlib.util.find_spec instead of importing pypdf, so tool listing no longer loads it at all.

Why this shape

PeerWhat it does, and what we take
oh-my-piconnection-prewarm.ts opens a connection to the provider while the user types. It does not carry over: each turn runs on its own asyncio loop (loop_runner.run_loop_blocking), so a pooled connection cannot outlive the loop that opened it. What does carry over is warming the work the first request pays once, which here is imports
Hermes_startup_fast.py keeps the CLI's import path short. Same rule for our parser: a command's startup imports only what that command needs
OpenCode, Grok Build leaderA resident process shared by clients. OpenProgram's Worker already is one; the remaining cost was its first turn

Implementation status

Not changed: in a development checkout the Worker's start also runs git rev-parse for the revision and scans the docs tree for its newest file; an installed runtime does neither. Node and Ink start-up inside the TUI was not profiled.

Last updated · 2026-11-30