Skip to content

fix(extension): skip the engine's boot-time plugin install in the H4 fixture (Closes #2199) - #2200

Merged
bc037 merged 4 commits into
mainfrom
fix/2199-ci-cold-start-warmup
Dec 2, 2026
Merged

bc037 merged 4 commits into
mainfrom
fix/2199-ci-cold-start-warmup

Conversation

@bc037

@bc037 bc037 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Related Issue

Closes #2199

Description

fast was red on main: the H4 warm-up test (mode_block.test.ts) timed out after 120 s on GET /config.

Root cause. With a plugin in the config, the first GET /config waits for the engine's boot-time install of @opencode-ai/plugin. The engine runs that install inside its own process (@npmcli/arborist, one JavaScript thread), once per config directory (global and project). Measured with the vendored 1.18.30 binary (the CI artifact) in WSL on a 20-core machine, with the H4 config and a no-op plugin:

Case GET /config CPU
no plugin 0.1 s 1 s
plugin, two config dirs 96.2 s 101 s
plugin, project config disabled (one dir) 48.7 s 51 s
plugin, "already installed" state seeded 0.0 s 1 s

A CI runner is slower per thread, so the 120 s budget is not reachable. The plugin's code does not matter (an empty plugin reproduces it), and the package registry answers in about 100–200 ms. The model catalog was tested and ruled out.

Fix. The engine skips the install when <dir>/node_modules exists and the dir's package.json and package-lock.json already name the package. seedInstalledPluginDeps writes that state in both config dirs for this fixture. The H4 plugins import only node built-ins, so they do not need the package.

Also in this PR (test-only): when a warm-up times out, the error now reports the engine and installer processes, open sockets, a bounded view of HOME, and a registry probe. This is what exposed the CPU spin and the effect files being written.

Changes: test/fixtures/seed_plugin_deps.ts (+ unit tests), test/fixtures/stall_diagnostics.ts (+ unit tests), test/mode_block.test.ts. No product code changes.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Config / infrastructure (CI, tooling, build, docs)
  • Breaking change (fix or feature that changes existing behavior)

Verification

  • pnpm -r run build exits 0
  • pnpm -r run test exits 0 (or pnpm -r run typecheck if tests aren't relevant)
  • Manual testing described below

All 11 CI checks pass on this branch, including fast (the H4 file ran 38 tests in 6.2 s; before the fix it ran for 132 s and failed). The new unit tests were written first and failed before the helpers existed. On the author's Windows machine the full suite does not pass, and the H4 test is skipped there (no engine binary); those failures also occur on unchanged main.

Manual Testing Notes

  • The measurements above came from a scripted boot of the CI binary in WSL (throwaway HOME), not from the real test.
  • Open: why the test passed on 30 Nov and failed from 1 Dec with identical code is not proven. The runs may have sat close to the 120 s limit. The engine's install cost itself (about 48 CPU-seconds for a 32-package tree) also affects real users who configure a plugin; that is an engine matter outside this PR.
  • Issue ci: fast is red on main - mode_block H4 warm-up GET /config cold start times out after 120s #2199 asks for fast to pass on two consecutive runs on main. That can only be checked after merge.

🤖 Generated with Claude Code

…art warm-up stalls

The H4 warm-up fails on main with "warm-up GET /config (instance cold start)
timed out after 120s", and the engine prints only that it is listening, so the
failure cannot tell a hung package install from a hung boot.

On a warm-up timeout the error now also carries:
- the engine and installer processes (ps)
- a bounded listing of what the engine wrote into HOME
- a probe of the package registry from the runner

The helper is best-effort and bounded; it never throws from the error path.
This does not change test behavior, only the failure message.

Refs #2199

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0f1dd2b-6473-4f75-b5f9-4c1191f8fd78
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

bgcole08 and others added 3 commits December 1, 2026 17:08
…all report

The first stall report showed the registry answers (HTTP 200 in 175ms) and that
the engine process was alive for 2 minutes with no installer child process, so
the stall is inside the engine, not a subprocess or a network outage.

To see what it waits on, the report now also carries:
- open TCP sockets with owning process (ss -tnp): a half-open connection names
  the host the engine waits on
- CPU and state per process: a busy loop versus an idle wait
- HOME listed three levels deep: what the engine managed to write

Refs #2199

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ve model catalog

The second stall report showed the engine at 100% CPU in state R for the whole
120s warm-up, with no installer child process, idle connections only, and
models.json (downloaded from models.opencode.ai) on disk. The registry
answered in about 200ms. So the stall is inside the engine after its inputs
arrived, not a network wait.

The H4 fixture uses its own dead-port provider and needs no model catalog.
Set OPENCODE_DISABLE_MODELS_FETCH so the first request does not download live,
time-varying data. This tests the theory that the catalog triggers the spin;
it also removes an external dependency from the test either way.

Refs #2199

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…fixture

Root cause of the H4 warm-up timeout on main: with a plugin configured, the
first GET /config waits for the engine's background install of
@opencode-ai/plugin. The engine runs that install inside its own process
(@npmcli/arborist on the one JavaScript thread), once per config directory
(global and project). Measured with the vendored 1.18.30 binary in WSL on a
20-core machine, with the H4 config and a no-op plugin:

- two dirs:                    96.2 s, 101 CPU-seconds
- project config disabled:     48.7 s,  51 CPU-seconds (one dir)
- "already installed" seeded:   0.0 s,   1 CPU-second

A CI runner is slower per thread, so the 120 s warm-up budget is unreachable.
A provider-only config (no plugin) answers in 0.1 s, and an empty plugin
reproduces the stall, so the plugin code is not involved.

The engine skips the install when <dir>/node_modules exists and the dir's
package.json and package-lock.json already name the package. The H4 plugins
import only node built-ins, so the fixture seeds that state in both config
dirs. seedInstalledPluginDeps is unit tested.

Also drop OPENCODE_DISABLE_MODELS_FETCH from the previous commit: the model
catalog was disproved as the cause (the stall persisted with it off).

Refs #2199

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bc037 bc037 changed the title test(extension): report what the engine was doing when the H4 warm-up stalls (Refs #2199) fix(extension): skip the engine's boot-time plugin install in the H4 fixture (Closes #2199) Dec 2, 2026
@bc037
bc037 marked this pull request as ready for review December 2, 2026 20:54
@bc037
bc037 merged commit c209966 into main Dec 2, 2026
12 checks passed
@bc037
bc037 deleted the fix/2199-ci-cold-start-warmup branch December 2, 2026 20:56
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.

ci: fast is red on main - mode_block H4 warm-up GET /config cold start times out after 120s

2 participants