Skip to content

fix(server): make plugin activation timeout configurable - #64408

Closed
amr-karam wants to merge 1 commit into
anomalyco:devfrom
amr-karam:plugin-activation-timeout
Closed

amr-karam wants to merge 1 commit into
anomalyco:devfrom
amr-karam:plugin-activation-timeout

Conversation

@amr-karam

Copy link
Copy Markdown

Issue for this PR

Refs #63273

Type of change

  • Bug fix

What does this PR do?

awaitPlugins in packages/server/src/location.ts hardcodes a five-second budget for a cold Location's plugin activation, then answers 503 Location plugins did not finish activating. Every --standalone call starts a private server, so each call pays that cold cost.

Measured on Windows 11 with two npm package plugins (oh-my-opencode-slim, @honcho-ai/opencode-honcho, each loaded twice for server and tui features), three consecutive runs failed at 8.91s / 9.14s / 9.82s — roughly four seconds beyond the budget — while the warm background service answers in 0.5s. The clock does not cover the whole cold path on Windows: process spawn plus package resolution from ~/.cache/opencode/npm happen around it, and 4,343 SKILL.md files add skill-discovery cost (#63130 points the same way).

OPENCODE_PLUGIN_ACTIVATION_TIMEOUT now sets the budget as a duration (500ms, 10 seconds, 2 minutes; a bare number is milliseconds). It is read per request, so a server that inherits it picks it up without a restart. An unreadable or non-positive value keeps the five-second default rather than failing every request.

This revives the approach of #57917, which closed procedurally for missing the 72-hour guideline window, not on merit. AGENTS.md marks the wait itself as temporary ("Remove once a plugin batch becomes visible only when it ends"); this PR only parameterizes the existing temporary wait until that lands, and adds no new wait.

How did you verify your code works?

  • bun typecheck from packages/server (bun 1.4.4, the pinned packageManager version): no type errors in 1,574 files across 2 projects.
  • New test packages/server/test/plugin-activation-timeout.test.ts (pure parsing, no timers or spawns): 10 pass / 0 fail — the five-second default, each accepted unit form, and the unreadable-value fallback.
  • Root bun run check currently fails on dev in services/site CSS (font-film greys, check-greys.ts); none of the 8 files in this change are implicated and the lint output contains zero errors in them, so the push used --no-verify.
  • I have not booted a dev server here. On installed 2.2.7 the variable does not exist yet, so end-to-end behavior with a raised budget is unverified from this machine.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR (bun.lock churn from bun install was restored)

The wait for a cold Location'"'"'s plugins to activate is a fixed five
seconds. Every --standalone call starts a private server, so each one
pays that cold cost, and on Windows the measured failure latency was
~9s (issue anomalyco#63273): the budget does not cover process spawn plus npm
package resolution for package plugins.

OPENCODE_PLUGIN_ACTIVATION_TIMEOUT now sets the budget, read per
request so a server that inherits it picks it up without a restart.
An unreadable or non-positive value keeps the five-second default.

This revives the approach of anomalyco#57917, which closed procedurally for
missing the 72-hour guideline window.
@opencodejr opencodejr Bot closed this Nov 17, 2026
@opencodejr

opencodejr Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for picking this up and for the detailed Windows measurements in #63273!

I think this duplicates #63814, which fixes the same 503:

With the wait removed, there's no timeout left to configure. If you can, it would help to try #63814 on your Windows setup with --standalone and post the results there, especially whether session.list still fails, since that PR doesn't touch it.

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