Reported: 01huadalang has a Command Code plan, but web search offered no
searcher for it, although some of its models (gpt-6-luna) search on
their own. The picker counted a provider only when every model searched,
or when its host was a self-searching API.
Changed (internal/gateway/search.go, search_remote.go):
- partSearcher(p) holds for a provider with no Account and no
self-searching API host whose preset is in searchModels or whose base
host is in searchModelsHosts. modelSearchesAny(p, model) says whether
that model is one that searches.
- searchRank ranks such a provider 4 when one of its available models
searches. searcherReady keeps it. searchableModel offers only the
models that search, never e.g. claude-opus-5-5.
- docs/subsystems/gateway-routing.md says so.
Test: TestCommandCodeSearchesForOtherModels (search_models_test.go).
Broken by hand, each one red, then green when put back:
- search.go and search_remote.go reverted: "the picker offers [],
want Command Code's gpt-6-luna alone".
- partSearcher dropped from searcherReady's keep, and the
searchableModel case dropped: `Command Code searches with
"claude-opus-5-5"`.
Run, go1.26.8 darwin/arm64, sandbox HOME, private GOCACHE:
At this stack on origin/main df6bd3efe (head 48522d851):
gofmt -l: nothing
go vet ./... (darwin), GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok
set -o pipefail; go test -timeout 45m ./...: ok, EXIT=0
(68 ok, 19 with no test files; agent 528s, gateway 628s,
library 482s)
GUI, playwright 1.62.0, chromium and webkit, concurrency 3: the
171 files near this change (routing*, panel-routing*,
window-mask, privacy*, usage*, quota*, providers*): 2217 tests,
2183 pass, 34 fail. Every red is also red alone on origin/main:
quota-count-wrap and quota-name-translated (#2228),
usage-agents-hide (#2276), usage-checkin (#3091), usage-fold
(#2163), usage-ledger (#3104, red since df6bd3efe, green at its
parent). window-mask: 20 of 20.
At this stack on origin/main c922225f1 (head 91baa7adb), before
df6bd3efe's routing trace change:
set -o pipefail; go test -timeout 45m ./...: ok, EXIT=0
(66 ok, 20 with no test files)
the whole GUI suite (823 files, both engines, concurrency 3):
11589 tests, 11554 pass, 35 fail. The 9 files red were run again
alone at --test-concurrency=1 on the head and on origin/main
a8ecf4020. The same 7 files were red on both: the five issues
above plus s3-sync (#2448) and library-row-remove (#3099).
nav-sub-unroll (#1950) and plugin-updates (#3103) were red only
under the full run. codex-predictions (#2624) was 20 of 20.
Subsystem design references
These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.
| Subsystem | Reference |
|---|---|
| Built-in subscriptions moving to plugins | Provider and plugin ownership |
| Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) | Plugin runtime |
| Plugins that run on the gateway's requests and replies | Gateway middleware |
| Tools that plugins give, offered to every agent as an MCP server | Plugin tools |
| Plugins that await context recall and observe completed replies | Asynchronous gateway request hooks |
| Claude subscription turns across Claude Code runs | Claude subscription bridge |
| How the gateway picks a provider, key or account, and falls back | Gateway routing and fallback |
| Gateway Session Aggregation | Gateway Session Aggregation |
| Connecting an agent's config to the gateway, drift, disconnect, WSL twins | Agent wiring |
| Providers, keys, subscription accounts, refresh and allowance | Providers and accounts |
| Instructions, MCP servers, skills and RTK written into agents | Library |
Tray, panel, window, magpie web and the page's JSON API |
GUI app shell |
| Encrypted backups and setup synchronization over WebDAV, S3 or GitHub | Sync and backup |
A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.
Maintain a reference
Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.
Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.
For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.
Describe a PR's semantic changes
For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.
For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.
This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.
Review a change
- Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
- Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
- Check that changed contracts appear in the owning reference and that source links still resolve.
- Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.
A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.