Skip to content

feat: sync upstream opencode v2.0.28 and add the Smart Router - #4

Merged
smakosh merged 11 commits into
mainfrom
sync-upstream-v2
Oct 14, 2026
Merged

smakosh merged 11 commits into
mainfrom
sync-upstream-v2

Conversation

@smakosh

@smakosh smakosh commented Oct 13, 2026

Copy link
Copy Markdown
Member

Summary

Syncs DevPass Code from opencode v1.18.10 → v2.0.28 (5,108 upstream commits) and adds the Smart Router: a model that lets an LLM Gateway decision model pick which model handles each turn.

Upstream v2 brings a new architecture (packages/cli + packages/tui instead of packages/opencode), session tabs (on by default: run several agents side by side with working / waiting / done status per tab), the mini interface, the Effect plugin system, and the background service.

Smart Router

  • New llmgateway/smart-router model, also on llmgateway-devpass. Before each user turn a decision model reads the request over /v1/decisions and picks a tier:

    Tier Default model
    fast claude-haiku-5-5
    balanced claude-sonnet-5-5
    frontier claude-opus-5-5
  • The user picks the decision model with the variant picker (ctrl+t, /variants, or the new /smart-router command). The choices are every model the gateway marks as a decision model: gpt-6-luna-decisions, microsoft-decision-1, jev-1.13.0 (the default).

  • One decision per user turn: tool steps stay on the same model, so prompt caching keeps working. Titles and compaction always use the fast tier. If the decision call fails, the turn goes to the balanced tier.

  • Smart Router is the default model until the user or their config picks another one.

  • DEVPASS_SMART_ROUTER_MODELS=fast,balanced,frontier changes the tier models. DEVPASS_SMART_ROUTER_DECISION_MODEL changes the default decision model.

Fork behavior ported to v2

  • Branding: devpass-code binary and packages. Config lives in ~/.config/devpass-code, devpass-code.json, and .devpass-code/; existing opencode.json and .opencode/ files are still read. Prompts, TUI, CLI help, and OAuth pages say DevPass Code. The sidebar onboarding points to LLM Gateway.
  • Catalog: built from LLM Gateway /v1/models (text models only), with models.dev metadata merged in for reasoning options, release dates, and output limits. The bundled snapshot (packages/core/src/models-dev/snapshot.txt, 217 models, 127 KB, was 5.3 MB) is regenerated from the gateway by script/update-models-snapshot.ts.
  • Providers: only LLM Gateway and LLM Gateway DevPass are registered, each with browser login (the key comes back through a loopback server) and paste-a-key. Upstream provider plugins stay in the tree but are not registered, which keeps future syncs simple.
  • The llmgateway theme stays the default, and the DevPass wordmark is kept.
  • Release: packages/cli builds devpass-code-<os>-<arch> packages and the release archives, and publishes to npm, the theopenco Homebrew tap, AUR, and ghcr. devpass-code upgrade now checks npm and the tap. Upstream-only @opencode/* libraries, desktop, and winget publishing are skipped.

Verification

  • bun run check (lint + typecheck across 36 packages) passes; it runs in the pre-push hook.
  • Real gateway, end to end: devpass-code run -m "llmgateway/smart-router#gpt-6-luna-decisions" "Design a sharded, multi-region event-sourcing architecture…" logged tier=frontier model=claude-opus-5-5 and returned an answer. A simple prompt routed through microsoft-decision-1 also answered. Before wiring them in, I called all three decision models directly with the routing question.
  • New tests in packages/core/test/plugin/provider-llmgateway.test.ts cover building the catalog, the decision-model variants, the browser login loopback (including a forged state being rejected), routing a turn, keeping one model across a turn's tool steps, the fast tier for titles, and the fallback when a decision fails.
  • Test suites compared with a clean v2.0.28 checkout on the same machine:
    • core: 26 fail vs 23 upstream. The 3 extra are shell oracle tests that change between runs; test/shell-scan/oracle.test.ts fails 1 test both here and upstream.
    • tui: 8 fail vs 9 upstream. No new failures.
    • server: 6 fail vs 6 upstream. Same tests.
    • cli: every new failure from rebranding and the updater was fixed and re-run file by file. The full cli suite takes more than 10 minutes and was not re-run end to end.
  • Upstream tests that only checked that now-unregistered provider plugins were registered were removed. Tests that check behavior were kept.

Not covered

  • I could not drive the interactive TUI in this headless environment, because it waits for terminal replies. The TUI changes (decision-model picker, /smart-router, sidebar copy) are covered by typecheck and the existing TUI tests only.
  • Merging to main cuts a release automatically. The checked-in version is 2.0.28, so the first release will be v2.0.29.

Upstream base for the next sync: v2.0.28.

Brings devpass-code from opencode v1.18.10 to v2.0.28 (5,108 upstream
commits): the new packages/cli + packages/tui architecture, session tabs,
the mini interface, the Effect plugin system, and the bundled app server.

Fork behavior ported to the v2 layout:
- branding: devpass-code binary, npm/brew/AUR/Docker names, config in
  ~/.config/devpass-code, devpass-code.json and .devpass-code/ (opencode
  files still read), DevPass Code in prompts, TUI, CLI, and OAuth pages
- catalog: built from LLM Gateway /v1/models with models.dev metadata
  merged in; bundled snapshot regenerated from the gateway
- providers: only LLM Gateway and LLM Gateway DevPass are registered, with
  browser login (loopback key handoff) and paste-a-key
- llmgateway theme stays the default; DevPass wordmark kept
- release pipeline: packages/cli builds devpass-code-* platform packages,
  archives for GitHub releases, npm/Homebrew/AUR/Docker publish, and the
  updater checks npm and the theopenco tap
- upstream-only @OpenCode packages, desktop, and winget publishing skipped

Smart Router:
- new llmgateway/smart-router model routes each user turn to a fast,
  balanced, or frontier model chosen by an LLM Gateway decision model
- the decision model is the model variant: gpt-6-luna-decisions,
  microsoft-decision-1, or jev-1.13.0 (default), listed from the gateway
- one verdict per turn keeps tool steps on one model and prompt cache;
  titles and compaction use the fast tier
- /smart-router command and a decision-model picker in the TUI; Smart
  Router is the default model until one is chosen
- DEVPASS_SMART_ROUTER_MODELS and DEVPASS_SMART_ROUTER_DECISION_MODEL

Upstream base for the next sync: v2.0.28.
- replace upstream Blacksmith runner labels with ubuntu-24.04, ubuntu-24.04-arm, and windows-2025; theopenco has no Blacksmith runners, so jobs queued forever
GitHub ubuntu-24.04/windows-2025 images do not ship rg, unlike the previous
Blacksmith images. Core's Ripgrep service falls back to downloading a release
archive, which the test HttpClient guard rejects, failing every Ripgrep and
search-tool test.
DevPass Code only registers the LLM Gateway provider plugins, so the
integration catalog never exposes openai/chatgpt-browser and these tests
time out waiting for it. Remove them and their now-unused helpers.
…de rebrand

packages/core/script/test.ts set OPENCODE_CONFIG_DIR to .config/opencode while
Global.Path.config is now .config/devpass-code, failing preload.test.ts under the
real test command. packages/cli/script/service-smoke.ts still looked for
dist/cli-<os>-<arch>/bin/opencode and the state/opencode registration directory,
but build.ts emits dist/devpass-code-<os>-<arch>/bin/devpass-code and the service
registers under state/devpass-code.
The rebrand renamed the shiki theme identifier passed to Pierre and the Markdown
worker to "DevPass Code", but packages/ui registers the theme as "OpenCode"
(marked-theme.tsx, marked-theme-register.tsx). Shiki threw "No valid theme
loader registered for 'DevPass Code'", so every diff, code block and Mermaid
render failed in the app e2e and session-ui component suites.
…ners

packages/core/test/npm.test.ts: the two Git-install test groups ran under Bun's
default 5s timeout; on GitHub-hosted windows-2025 runners git ls-remote/clone over
file:// took longer and were SIGTERMed (unit (windows) job 116053034578). Give them
the same 30s budget the neighbouring Git tests already use.

packages/cli/test/standalone.test.ts: cleanup rm raced the just-killed standalone
server releasing its handles (EBUSY in the same job). Retry like service-smoke.ts.
- run Windows unit and e2e suites on main pushes and manual runs, non-blocking
- trigger on main instead of upstream's dev branch
- cap Playwright at 2 workers on the 4-vCPU hosted runners
@smakosh
smakosh merged commit 98a189c into main Oct 14, 2026
5 checks passed
smakosh added a commit to theopenco/llmgateway that referenced this pull request Oct 15, 2026
## What

A blog post announcing DevPass Code 2.0:
[`apps/ui/src/content/blog/2026-10-15-devpass-code-smart-router.md`](https://github.com/theopenco/llmgateway/blob/docs/devpass-code-smart-router-blog/apps/ui/src/content/blog/2026-10-15-devpass-code-smart-router.md),
published at `/blog/devpass-code-smart-router`.

- **Smart Router**: before each message, a decision model on
`/v1/decisions` picks fast (`claude-haiku-5-5`), balanced
(`claude-sonnet-5-5`) or frontier (`claude-opus-5-5`).
- **Decision models**: users pick `jev-1.13.0` (the default),
`microsoft-decision-1` or `gpt-6-luna-decisions` with `/smart-router` or
`ctrl+t`.
- **Session tabs** from opencode v2, the tier override env vars, and
install/upgrade steps.
- The demo video is embedded from YouTube
([youtu.be/dYRPOwLP8V4](https://youtu.be/dYRPOwLP8V4)). It uses the same
`youtube-nocookie` iframe the guides use.
- The cover is a gpt-image-2 render with the official logo added by
`composite-logo.sh`, then reduced to a 256-color PNG (3.0 MB to 784 KB).

## Fact sources

- Behavior and defaults come from
`packages/core/src/plugin/provider/llmgateway.ts` and
`packages/tui/src/config/keybind.ts` in theopenco/devpass-code#4.
- Prices and context sizes come from `packages/models`.
- The demo numbers (8.9 s, 35.9 s, 12 tests, 4 clarifying questions)
come from the router logs of the recorded session.

## DevPass Code release

The install commands in the post need DevPass Code 2.x.
theopenco/devpass-code#5 fixed the release pipeline and v2.0.29 is out:
`npm view devpass-code dist-tags` returns `latest: 2.0.29`, a fresh `npm
i devpass-code@latest` runs as `devpass-code v2.0.29`, and the Homebrew
tap formula is at 2.0.29.

## Verification

- `pnpm exec turbo run build --filter=ui` passes, so the frontmatter
matches the schema.
- Rendered with `next start`: the page shows the cover, the 896×504
YouTube embed with the custom thumbnail, 3 tables, 6 sections and 5
FAQs, with Article, BreadcrumbList and FAQPage JSON-LD.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added an announcement for DevPass Code 2.0 covering Smart Router
behavior, model options and costs, routing and fallback rules, session
tabs, configuration, and installation and upgrade guidance.
  * Included a demo, FAQ, image, and links to related resources.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Luca Steeb <contact@luca-steeb.com>
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