OpenCode 2 can request /ctx-status without a model key. The shared status builder then displays the default 65% even while the transform correctly uses a per-model token threshold.
Fall back to the session model already read from storage before resolving model-specific status values. Explicit caller models still win, and sessions with no known model keep the existing default. This is a one-line implementation change plus three regression cases.
Design approved in #705; the issue now carries design-approved.
Validation
Regression reproduced before the fix: persisted model with a 250000-token override and a 500000-token context reported 65% instead of 50%.
After the fix: 94 tests pass across RPC handlers, status view/checks, cache TTL, V2 threshold wiring, and V2 dialog fallback.
bun run --cwd packages/plugin typecheck passes.
git diff --check passes.
Both changed files pass Biome formatting with the repository's formatter settings in an isolated config. The normal Biome command cannot load the existing linter.rules.preset key; the identical config error reproduces on untouched upstream 03b5ba51. No repository lint configuration is changed here.
Pi status dialog tests: 23 pass, 1 fails (harness already locked to pi; cannot change to omp). The same failure reproduces in an untouched upstream worktree.
Local installed-bundle runtime check after restart: a status-detail request without modelKey returned tokens mode / 250000 / 50%; subsequently changing the setting to 180000 returned 36%. Runtime verification used Magic Context 0.47.0 with OpenCode v2.0.31; source tests use upstream 03b5ba51.
Harness coverage (required)
OpenCode 1: shared buildStatusDetail handler is fixed; explicit model keys retain precedence.
OpenCode 2: its status caller omits modelKey; the shared handler now resolves the recorded model. V2 threshold and dialog-fallback tests pass.
Pi: reviewed the separate status builder; it obtains the key directly from ctx.model and does not use this OpenCode RPC path. No Pi source change needed. Status test limitation noted above.
OMP: uses the Pi-plugin host/status implementation and the same current-context model lookup; no OpenCode RPC fallback to patch. The existing mixed-harness test failure is documented above.
Rust module: reviewed the OpenCode Rust-status merge into this same shared handler; module-supplied context limits are used by the regression fixture, and existing Rust-status merge/provenance tests pass. No Rust code or module protocol changes; no full Rust build/runtime test performed.
Risk and scope
Read-only status reporting: no writes, new database queries, dependencies, permissions, or authentication/routing changes. The fallback reuses metadata already read for this session. It also makes existing per-model window-geometry, TTL, and toast-duration status lookups use the recorded model when the caller omits one. Runtime compaction policy and native model limits are unchanged. No full monorepo suite or all-harness end-to-end run was performed.
Confidence Score: 5/5
The PR appears safe to merge.
Summary
buildStatusDetail now uses the session’s recorded model when the caller omits modelKey.
Status details use the session’s recorded model when callers omit one.