Skip to content

fix(tui): reduce slow startup with fast-boot, bootstrap timeouts, and server pre-warm - #39821

Closed
Alter-Igor wants to merge 18 commits into
anomalyco:devfrom
Alter-Igor:fix-slow-startup
Closed

Alter-Igor wants to merge 18 commits into
anomalyco:devfrom
Alter-Igor:fix-slow-startup

Conversation

@Alter-Igor

Copy link
Copy Markdown

Problem

Opencode is slow to open because the TUI waits for all bootstrap HTTP calls (config.providers, provider.list, agents, config.get) to complete before showing the UI. If any one of them stalls, the user sees a blank spinner for 5-15 seconds.

Changes

P1 -- Fast boot (immediate render)

packages/tui/src/app.tsx

  • Changed skipInitialLoading default to true so TUI renders immediately while background sync finishes.
  • Set OPENCODE_FAST_BOOT=false to restore the old splash-screen behavior.

P2 -- Bootstrap timeout guard

packages/tui/src/context/sync.tsx

  • Added timed() helper wrapping blocking HTTP calls with an 8-second timeout
  • Wraps: providers, provider-list, agents, config in blocking phase; session-list, commands, lsp, mcp in non-blocking phase
  • On timeout: logs warning instead of error, continues with whatever data was received, does not crash the TUI

P3 -- Server pre-warm

packages/tui/src/context/sdk.tsx

  • Fires a background fetch(/health) on TUI mount (2s timeout) so the opencode server has time to load plugins/config before first real call hits /config/providers

Validation

  • TypeScript typecheck passes (no new errors beyond pre-existing missing module declarations)

Alter-Igor and others added 18 commits July 31, 2026 16:05
When a text-only model (e.g. GLM-5.2, DeepSeek-R1) is configured and a
vision_proxy is set in the provider options, image parts are automatically
intercepted and sent to the vision proxy model. The text description
replaces the image before the primary model sees it.

Closes anomalyco#36841
Clipboard images may arrive as raw bytes (Uint8Array/Buffer) or URL
objects rather than data URL strings. Added conversion to base64 data
URL for all image data formats.
The vision_proxy config was on the openrouter provider but GLM-5.2
runs under the zhipu provider. Now the middleware:
1. Checks the current provider's options first
2. Falls back to scanning ALL providers for a vision_proxy config
3. Uses the vision_proxy's own apiKey/baseURL if provided
4. Falls back to the current provider's apiKey if not

This means vision_proxy can be configured once on the openrouter
provider and work for any text-only model on any provider.
…anion plugins (#1)

* feat(plugin): add synapse-coder-reporter learning-loop plugin

Detects LSP diagnostics after edit/write/apply_patch, holds the failing
edit as pending, and reports an original->corrected pair to the Synapse
Coder staging MCP (coder_report_correction) only when a follow-up
same-file edit lands clean — the live schema requires non-empty
original/corrected, so one-sided detections are dropped after 30 min.

- Env-var opt-in gate (SYNAPSE_CODER_REPORTER_ENABLED, default off)
  with first-use TUI toast (once-per-project marker)
- Offline queue (.opencode/synapse-coder-queue.json) with retry on
  load + 5-min timer; fire-and-forget hooks (no await on report path)
- MCP wiring for synapse-coder + Alterspective servers in
  .opencode/opencode.jsonc (local entries fixed to schema shape)
- 28 tests covering detection, pairing rules, opt-in, queue, model
  tracking, fire-and-forget, first-use toast
- Plan/evidence docs under docs/implementation/current/SYN-001-*

* feat(plugin): add alterspective-rag-standards system-prompt plugin

Statically injects Alterspective standards awareness (rule-ID citation,
RAG-first routing via rag_search/rag_ask, standards index pointers) into
the chat system prompt via the experimental.chat.system.transform hook.
Opt-out via ALTERSPECTIVE_STANDARDS_INJECTION_DISABLED=true or
ALTERSPECTIVE_STANDARDS_INJECTION_ENABLED=false. 6 tests.

* feat(scripts): add health/version sidecar for the opencode server

Standalone HTTP sidecar exposing /health and /version (upstream probe
optional via OPENCODE_SERVER_URL) — the fork-local fallback for
operational visibility, since adding routes would touch high-churn
upstream server files. 5 tests.

* docs: mark ISS-002 resolved (global payload doc corrected + deployed)
ENV-NAME-01: use staging.synapse-coder-mcp.alterspective.com.au (custom
domain + managed cert now bound on the staging ACA) instead of the raw
azurecontainerapps.io host. Plugin URL is now env-overridable via
SYNAPSE_CODER_URL with the canonical host as default.
#3)

AGENTS.md 'Fork-local notes' now lists the .opencode integration
(plugins, sidecar, MCP wiring incl. local-entry shape) so future
upstream syncs preserve it. SYN-001 status.md updated to final:
merged (PRs #1, #2), activated, learning loop verified end-to-end.
…042) (#4)

com.docker.backend.exe listens on 4040-4042 on Windows Docker Desktop,
so the sidecar's original default failed to bind. 4043 verified free;
runtime-probed /health and /version live (200) on the new default.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant