Repository navigation
fix: report the gateway's refusals honestly - #175
Merged
Merged
Conversation
Replace docs/improvement-plan.md with the plan of record. It now holds: - the owner's decisions (D1-D11); - what the DeepSeek Harness host supports, with references into packages/llm, llm-pi-ai, session-controller, gateway and ui-settings-models; - the defects this audit found that are not yet fixed; - the target architecture and the phases, one PR each, with a status table that each PR updates. The decisions that change the code: - Settings offers the whole catalog, and the composer offers only the declared models. - The plugin never writes the user's profile and follows the user's configuration at dispatch. - The adapter patch exists to merge provider modes and nothing else. It is generalized to every mode, and its catalog fill is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Investigation of the host's source and of the pi catalog it pins (1.1.0) changed the routing design. - llm-pi-ai resolves `api` and `baseUrl` per model, and pi's installed `opencode` catalog already spans Anthropic, Google, Completions and Responses with per-protocol endpoints. One route serves every mode for every model pi knows. - The plugin fills only three gaps: models newer than pi's catalog (including all Gemini on Go), endpoint drift, and profile-level `api`/`baseURL` collapsing the modes. - The new design is one unregistered catalog adapter per plane, keyed by the user's route id, and the adapter patch (merge-modes) delegates only gap models to it. That deletes the hidden routes, the listing hide, the stream redirect, the child mount and the Gemini bridge registration. - A real-host test harness (P-T1) comes before any of it. - One upstream change (per-entry `api`/`baseURL` in llm-pi-ai, U1) would remove the routing layer entirely. It would also let Settings save a model pi doesn't know, which pi-ai's strict write validation rejects today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
pi-ai registers exactly the providers in its resolved config, and the fiber keeps whatever the internal/config waterfall returns, while the config editor writes the raw value. A prepended listener that resolves pi-ai's config without opencode/opencode-go therefore keeps pi-ai from claiming them, without touching the user's file, and the plugin registers its own PiAiAdapter under the same ids through the public API. Measured on the real host with pi 1.1.0 and the harness's patch: both routes held by the plugin, pi-ai's other routes unchanged, every protocol on both planes (Gemini on Go included) sent to its own endpoint, a catalog-unknown model id saved, listed and dispatched, and both routes handed back to pi-ai on release. Replaces the upstream asks (no upstream changes) and the save-gate design, which is kept only as the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
A nine-lens review of the routing design, with two independent skeptics per finding (78 of 82 upheld), changed five things before any code moves: - Settings reads pi-ai's resolved config, so a read-only wrapper on settings.describe puts the plane entries back into the displayed value; writes were never affected, the Models page edits by path. - The route claim gets an explicit lifecycle: commits are told from validations by identity, reconcile runs on commit, mount and teardown are ordered, and pi-ai restarts at most once per transition. - The plugin's adapter is built from public pieces only, with pi-ai's credential rule and no captured keys on the adapter path. - The protocol comes from the catalog map, never from a guess at the model's name; metadata and levels are catalog first. - Releases stay on 1.x, phases land as stacked pull requests, and a real host harness plus a binary e2e job pin the behaviour first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
- The deprecated @viztor/dsh-opencode wrapper re-exported a `default` the
barrel does not have, an ESM link error on every host load. It now
forwards `export *` only, written by one shared helper that a test links
against the built barrel in a real Node process.
- isZenProvider("opencode-google") answered false: "go" inside "google"
read as the Go plane. It now uses the plane rule the catalog already has.
- enrichModelsResponse answered a 401, 403, 429 or 5xx with a 200 catalog.
Those statuses now pass through; a 404 is still filled from the catalog,
because the Go plane's inference base has no /models of its own.
- The warning colour named a token the host does not define, so warnings
rendered as caption text. They now use --dsw-alias-state-warn-label.
- The settings spinner only animated while the meter was mounted; the
settings surface now carries its own keyframes.
- The stream hook wrote debugFile with debug off. debug is the switch and
debugFile only where it writes, the same gate the fetch patch uses.
- The purge row reported the host's own { ok: false } failure as "not a
purge result" and cast the answer; it now shows the host's message and
parses through the contract's whitelisting parser.
- The endpoint copy described modern as /inference/v1, which the plugin
never sends. It now names the per-protocol inference family, and auto as
its alias, which is what the code already did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
- Delete adapter-replacement.ts and its test. Nothing imported it, and deleting another plugin's registry entry is not a host API; the engineering notes record why, and what the plugin does instead. A gate fails the build if src/ writes the llm registry map directly. - Delete the stream hook's `prepared` handling: the host passes the prepared dispatch as its own argument and never reads options.prepared. - Untrack .freebuff/ and ignore it. - The settings partition test walks Config.dict, which is how debugFile went missing from it; a manifest test checks cordis.patch.yml against the schema and the field registry, and the manifest's phantom showUsagePrice, wrong marker text and incomplete lists are fixed. - utils/retry.ts takes its timer and logger as parameters, and the utils purity gate now also rejects console and global timers, walking the folder recursively. - tool-fallback reads free-tier ids from the request's own plane (Go iff opencode-go or opencode-go-*) and loses its unreachable Anthropic branch. A Zen-only free model is no longer treated as free on Go. - test/support/src.ts is the one door tests use into src/, so later module moves touch one file; CONTRIBUTING.md states the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The barrel is the host's contract and nothing more: apply, Config, inject, name and the config types. Everything else is internal, and test/public-api.test.ts pins the list, so widening it is a reviewed change. The 1.x line keeps its version scheme: nobody consumes the removed exports (D6). - Every test reaches src through test/support/src.ts, importing each name from the module that defines it; a gate rejects a static src import anywhere else outside its named exemptions. - package.json no longer exports ./src/*, and check.ts fails when an exports target is outside the published files. - resolveRoutedKey is deleted: it was exported and never called. - The internalRoutes setting is deleted; the per-protocol routes always mount until the plugin owns the plane routes. A row that still carries it validates and the key is ignored. - @viztor/dsh-opencode is no longer published. The deprecation message already on npm stays as its final word, and check.ts asserts that the release workflow verifies exactly what publish-scoped.ts publishes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The test install now runs the host users run. - pi is pinned to 1.1.0, the version the harness's own lockfile pins, with the harness's patch applied verbatim (patches/, hash recorded by pnpm). A pnpm override holds every copy in the tree to it, not just the direct devDependency. - The @deepseek-ai packages move from 0.2.1-alpha.5 to 0.2.1-rc.2, the version a registry install of the published dsh resolves (cordis 4.0.5, loader 1.0.6, schemastery 3.18.5). The boot-tier packages the real-host harness needs next (dsh-llm, dsh-app-boot, dsh-config-editor, dsh-settings, cordis-plugin-loader) are added as devDependencies. - test/support/host-versions.ts names those versions once. test/host-versions.test.ts checks that the pi the plugin loads at runtime is 1.1.0 and the same copy the tests import, that the patch is applied, and that the installed cluster matches. - mount-protocols now checks that every catalog SDK maps to a protocol pi's exported api modules implement, and records as a characterization row that pi 1.1.0's opencode-go provider has no Google API. No src/ behaviour changes: the rc.2 builds of llm-pi-ai, cordis and schemastery are code-identical to alpha.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Add an in-process harness that runs the plugin inside the real host,
so the routing work that follows can be measured against today's
behaviour rather than against fakes. Additive only: no src/ change.
test/support/host.ts gives two tiers. Tier A is a bare cordis Context
with LlmRuntime and llm-pi-ai mounted with { providers }, for the
config waterfall and pi-ai's credential paths. Tier B is dsh-app-boot's
boot() with a temporary HOME, a test bundle, a fake credentials service
and a launch-environment snapshot, for the config editor,
settings.describe and the volatile commit. Tier B's rows carry package
names through a stub module loader, and it fixes the apply order,
because the loader starts rows in parallel.
On top of it:
- contract tests for the waterfall, the profile and Config shapes,
credentials, and the config editor (host-waterfall, host-shapes,
host-credentials, host-editor-contracts), plus a tier A smoke test;
- a characterization of today's behaviour on pi 1.1.0, each row tagged
where P-R1 is expected to flip it, with S0_TODAY shared by the
binary e2e;
- the keyless 401-vs-404 matrix: a pure classifier, its unit test and
a gated live run;
- a binary e2e gated on DSH_HOST_E2E=1 with its probe bundle, the
e2e-host CI job (a pinned, patched cell on PRs that touch the host
seams or vite.config.ts, and a floating cell nightly and on
dispatch), and the test:e2e:host script.
The binary e2e now reports why a run failed: a timeout only when its
own deadline killed the host, the signal for a crash, and the probe's
fatal message whenever there is one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Add src/host/patch-method.ts (patchMethod), now the only way the plugin wraps a method on a host object, and move the four instance patch sites in src/models-discovery.ts onto it: the three listings hidden by hideResponsesRoute, decorateModelDiscovery, decorateModelInfo and decoratePlaneAdapters. On the real host the three llm-level disposers never restored: ctx.llm is cordis's traceable proxy, every method read returns a new shadow proxy, so the `===` identity checks were never true and each reload stacked a wrapper over the last. The helper reads identity from own descriptors instead. A dispose restores only while its wrapper is still current (otherwise it becomes a pass-through), deletes the own property when the original was inherited, and a same-site reinstall wraps the unpatched method rather than the earlier install, so either disposal order ends at the exact original. decoratePlaneAdapters becomes one patch per (adapter, method) that composes the adapter's plane routes in registry order, which keeps today's nesting on pi-ai's shared adapter. rewrapOnAdaptersUpdated is built and tested but wired to no site yet. test/reload.test.ts runs apply A, apply B, dispose A, dispose B (and the reverse order) for every site on own and inherited originals, on the real host (tier A) and through apply(); test/patch-method.test.ts covers the helper's contract. The existing per-site pins in test/models-discovery.test.ts stay unchanged; five new cases there record the deliberate edge changes on hosts that refuse the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor added kimi-k3.1-pro to the Go plane, so `catalog freshness` went red on every branch of this stack. This takes the two generated files exactly as the nightly refresh produced them (#111), with no hand edits, and updates the counts that hard-code the catalog's size: the Go shim test (28 -> 29), the plane table in redirect-planes.md (Go served 28 -> 29, the no-SDK Go cell 17 -> 18), and the Go completions list in both READMEs. The listed half of "29 served / 33 listed" is models.dev's count, inferred from the one added entry, because models.dev cannot be reached from here. It no-ops once main carries #111. P-T2 turns these counts into invariants so a refresh stops needing this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The plugin now serves the opencode and opencode-go routes itself, through supported host paths only, and the hidden-route workaround is gone. A prepended internal/config listener hands pi-ai a copy of its config without the two plane entries, so pi-ai keeps every other route. On a commit the plugin reconciles: it builds one plane adapter, a subclass of the host's PiAiAdapter, over pure profiles (utils/plane-profile, plane-model, model-metadata and protocols) and registers only the planes that are declared. A Settings candidate has the plane entries it changes validated strictly. A read-only settings.describe graft puts the committed plane entries back, so the host still sees them. Deleted: responses-provider, responses-routes, google-bridge, pi-provider and utils/google-replay; the listing hide and the discovery decoration; the stream redirect; the D19 settings; and the hidden ids in DEFAULT_PROVIDERS and cordis.patch.yml. What users see: any saved id is accepted and served, and an id no catalog knows dispatches as completions. The protocol comes from the catalog and model info follows the user's own row first. A model whose reasoning is only on or off offers Off/On. The default endpoint is the per-protocol inference family. Keys resolve by pi-ai's own rule, and a plane lists its declared ids even when no key resolves. When several pi-ai rows declare planes, the row the plugin serves stays the same while it is live and still declares one, so no row is left stripped with nobody serving it. If the host's pi-ai module cannot be read, the plugin steps aside even before any plane is declared, so a later Settings save goes to pi-ai's own check. The characterization rows this changes are flipped to new baselines; every other row stays green unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
# Conflicts: # README.md # README.zh-CN.md # docs/redirect-planes.md
A measurement phase: the default endpoint family stays `modern`, so no plugin behaviour changes and no characterization row flips. - Name the default in one constant, AUTO_ENDPOINT_FAMILY in src/utils/plane-model.ts, which is what `auto` resolves to, and pin it in test/endpoint-family.test.ts. - Extend the keyless matrix to three URL shapes (legacy, root, modern) over four protocols and two planes, add LEGACY_DISPATCH, and add one keyless free-model probe with its own pure classifier. - Add minimal keyed probes (pure test/support/keyed-probes.ts and its e2e): one tiny request per plane, protocol and shape, sent with the plane's own key and the plugin's identity from one shared constant, PROBE_IDENTITY. Only the cells the default sends to are asserted; the rest are recorded. - Gate the live job by tier with OPENCODE_E2E_KEYED (none, probes, full; unset means full). CI arms `probes` on a pull request that touches what the probes send, `full` nightly and on dispatch, and passes the secrets only when the tier is not `none`. - Write a dated endpoint-family record from both live suites to the run summary and an `endpoint-families` artifact, and add §13 to docs/redirect-planes.md with every cell pending the first CI run. The live part runs in CI only; no live result is invented here. A failing keyed modern cell in CI is the evidence for a later `fix:` that flips the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
For the opencode and opencode-go routes, the Settings model list now shows pi-ai's own rows first, in pi's order, and then every model the plane's catalog can serve that pi does not list and the catalog has not retired. Ids that pi's registry has retired are dropped, a field a row lacks is filled from the catalog, and every row is cut down to the five fields the host's discovery contract accepts, with absent values omitted rather than set to undefined. While pi-ai restarts and its discovery is withdrawn (NO_DISCOVERY), the list answers the catalog rows alone instead of the error. This rewrites the existing discoverModels wrapper rather than adding a second one. Other routes keep today's enrich-only merge, because pi-ai serves them and cannot serve an id it does not list. The plugin's own model-discovery namespaces, which Settings never asked, are deleted with their lifecycle tests, and RouteClaim gains a claiming() seam. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Phase P-T2 of docs/improvement-plan.md. Test-only: no source file changes and no behaviour changes. - Every socket-bound case is in the mock suite. The nine unit files that booted the mock gateway through testing-kit.ts are merged into test/mock/request-shapes.mock.ts and a new protocol-endpoints.mock.ts table. The two offline e2e files that bind a port (patched-fetch-headers, refusal-classification) moved there too. The device-login routes left the gateway mock. - createMockContext, HarnessSimulator and the rest of testing-kit.ts are gone. Services are built on a real cordis Context, and lifecycle.test.ts mounts the plugin the way the Loader does (test/support/composition.ts). degradedHost remains only for the degraded-composition diagnostics. - 43 cases that tested only the harness or the mock gateway are deleted. 33 duplicated cases are merged and 16 restatements are deleted; the plan names each one. - Hard-coded catalog counts and vendor ids are now invariants, or a row picked by shape, so a vendor catalog refresh no longer breaks the suite by construction. - The seven largest test files are split by subject, the live suites read their environment through test/support/e2e-env.ts, and the duplicated helpers and hard-coded ses_ ids are removed. - src/utils/session-id.ts, src/opencode-store-contract.ts and the e2e environment reader have their own tests, and src/lifecycle.ts, src/stream-hook.ts and src/fetch-patch.ts have per-file coverage floors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor renamed the Go plane's one Gemini model (dropping its contributor suffix, halving its price and publishing an allowance for it where the limits table had none) and added a free model with no SDK, so `catalog freshness` went red on every branch of this stack. This takes the two generated files exactly as the nightly refresh produced them (#111), with no hand edits, and follows them: - the Go Gemini fixtures in six test files (attachment-services, catalog, go-google, go-google-prepare, models-discovery, responses-routes) now name the renamed id, since each means "the Go Gemini model the catalog serves"; - the usage panel test built its unknown allowance from the table's one unpriced row, which the vendor has now priced, so it builds the `Number.NaN` allowance the generator emits itself; - the Go shim count in catalog.test.ts (29 -> 30); - redirect-planes.md: Go 29 -> 30 served, the no-SDK Go cell 18 -> 19, and "0 of 29" -> "0 of 30" in the prose; - both READMEs: the renamed Gemini id, and the new model in the Go completions list, since it declares no SDK. The listed half of "30 served / 34 listed" is models.dev's count, inferred from one rename (no change) and one addition (+1), because models.dev cannot be reached from here. The dated S0 measurement row in improvement-plan.md keeps the id it was measured with. It no-ops once main carries #111. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The live routing suite picks its free-tier subjects from the catalog by asking the gateway, but it counted "400 Upstream request failed: Model is unavailable" as an observable answer. The upstream withdrew nemotron-3-ultra-free while the catalog still lists it, so the picker chose it and two cases asserted on a model the gateway no longer serves; the reachability case also failed on a 429 throttle. A withdrawn model (that 400, or a 410) is now skipped like a throttled one. The free-tier routing case only accepts a candidate whose answer is the free-tier gate it asserts, so an unmetered model cannot become its subject, and the reachability walk moves past gated, withdrawn and throttled candidates before it reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The review ran three rounds through the correctness, rules and matrix lenses. What it found, and what changed: - The binary e2e's beforeAll budget was smaller than the blocking subprocess deadlines it serializes. Each plugin install now has its own deadline, the hook's budget is derived from the installs and the boot, and afterAll stops a host a failed hook left running. - providerWithApiKey claimed to be a line-for-line restatement but skipped upstream's credentialRef(ref) check. It now throws the same TypeError for a ref outside the grammar (a host-editor-contracts case pins it), and its comment names the deliberate differences. - The pinned e2e-host cell let cordis and the loader float at patch level. The overrides now force both, the cache key includes them, and the job asserts them against HOST_VERSIONS. - The pi-ai-first characterization asserted every facet under one KNOWN_DEFECT title. Each apply order now generates one test per row and facet, titled with that order's own tags. - CONTRIBUTING said the contract tests pin F11-F20, and the plan said P-T1 pins every fact. Both now give the same accounting: which facts are pinned by number, which P-R1 exercises first, and why F9 and F17 are not pinned. - CONTRIBUTING put the e2e's dummy keys in the profile's credentials file; they are in the temporary home's credentials document. - F5 had no real-host pin: host-shapes now pins that a route-level api and baseURL collapse pi's protocols onto one. F6 is recorded as first exercised by P-R1. - The credential-mapping row pinned only the api-key branch of toPiCredential. host-credentials now covers all three branches, and the env branch is asserted through pi's Models.getAuth, so the case fails without it. - The plan's reason for restating hasProviderApiKey was inaccurate; it now says no installed copy reaches the function. - The new credential cases cited toPiCredential at the wrong lines; they now cite auth.ts:74-84. - F4's listing and dispatch halves were pinned only by KNOWN_DEFECT rows P-R1 flips. A plugin-less tier-A case in host-shapes now pins that an id pi cannot place is not listed and that a turn on it is INVALID_CONFIG with no request; the save and deferred-read halves are tagged F4 too. - The one facet that depends on the apply order lost its tag when the pi-ai-first block was split. The fixture case now checks only structure (the facets whose value moves are the facets whose tag moves), and the exact pin is its own KNOWN_DEFECT case that boots no host. CONTRIBUTING and the plan say P-R1 drops todayRowsFor's override and turns that case into a BASELINE check in the same diff. Nothing under src/ changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…claude/vigilant-mendel-bctz9n-p3 Brings in the nightly catalog refresh (#171: Zen 87 -> 88, adds gemini-4-hydrogen; Go unchanged at 32) as P-R2 carries it, with P-R1's follow-up of the docs and tests. Resolution: no textual conflicts. git auto-merged README.md, README.zh-CN.md, docs/protocol-routing-and-merge.md, docs/redirect-planes.md and test/catalog.test.ts, where P3's own edits and the refresh's count and list edits touch different lines. The merged tree is exactly P3's own change (d563282..8b2fa44) applied on top of 65b8443: the two diffs differ only in blob ids and in the one context line of docs/protocol-routing-and-merge.md that carries the Zen count (87 -> 88). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…aude/vigilant-mendel-bctz9n-p-t2 Brings the nightly catalog refresh (#171: Zen 87 -> 88, adds gemini-4-hydrogen on @ai-sdk/google; Go unchanged at 32) through P3 into P-T2's test layout. Resolution: - test/catalog.test.ts (the one conflict): P3 re-pinned the Zen shim length from 87 to 88; P-T2 had replaced that pinned count with an invariant (non-empty, ids unique), and the per-SDK counts are compared with the docs by catalog-docs.test.ts. Kept P-T2's invariant; the file is P-T2's text unchanged. - docs/protocol-routing-and-merge.md, docs/redirect-planes.md: merged cleanly. P3's count refresh (88 Zen, Google 10, 2026-11-13, #171) sits beside P-T2's renamed guard references (catalog-docs.test.ts, catalog-routing.test.ts, the host-planes*.test.ts files). - README.md, README.zh-CN.md, src/catalog-data.ts: P3's side only (the generated file and both READMEs in step). - test/thinking-levels.test.ts: P3's side only (the gemini-4-hydrogen xhigh exception); P-T2 did not move or touch this file, so it stays where it is in P-T2's layout. The parent added no new test titles (git diff 8b2fa44 285aeaf -- test/ adds no it/test/describe line), so nothing needed relocating. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Phase P-T3 of docs/improvement-plan.md. CI now runs the unit suite once per install (the coverage run, in the required check job), builds lib/ before any test that reads it, type-checks test/**/*.tsx, and sets up every job through one composite action (checkout, pnpm, node, install). The catalog job's fork condition and the stale pnpm comments are fixed, and the paid keyed e2e runs only on a schedule or a dispatch, apart from the minimal keyed probes on pull requests that touch src/host/**. scripts/check.ts keeps the lib freshness check (once), the consumer install (now loading the client half too) and the size tripwire; its pure file checks moved to vitest. The generator scripts share helpers and one staleness rule, every verify-* script exits non-zero on a mismatch, scripts/capture-ui.sh carries no machine paths, and the no-local-paths test also covers .github/ and *.sh files. The CLI-version script reads the registry's dist-tags and the 2.x User-Agent format, and the nightly host-drift report now proposes a bump pull request from a tokenless planning step; a test pins every build approval the pinned pnpm acts on so that step cannot run a dependency's install script unseen. The plan gains a "Lessons from @opencode/console" section (OC1-OC13, each with its verdict, evidence and phase). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Brings in #172 (the live e2e job signs in with the runner's OIDC identity). Merged against 9be88d6, the tree this branch was cut from; ci.yml keeps the composite setup action and adds the sign-in step after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The chat UI replaces an AUTH failure with "API key is invalid" and a QUOTA one with "Request quota exhausted.", so a plane turn the gateway refused for its own reasons (free tier, usage cap, region, retired model, unsupported protocol) read as a bad key or an empty quota. A new pure module, src/utils/gateway-refusal.ts, reads the gateway's typed refusal from pi's failure text and finishes the turn as FREE_TIER or MODEL_UNAVAILABLE instead: neither code is replaced by the UI and neither is retried by default, so the user sees the gateway's own words and, except on Google-protocol models, its status. The plane adapter applies it in prepareCall and stream; pi-ai's own routes and stepped-aside planes keep the bridge's codes. The free-tier tool fallback now treats a read or bash tool without properties as missing, replacing it rather than adding a duplicate, and sends tool_choice "none" on a free chat-completions body that carried no tools. The keyed probes gain recorded rows for a raw session id, session-only headers and the harness User-Agent, plus a free baseline; a keyless usage-cap 429 now reads as free-usage-limited and is left out of the Retry-After record. The README gains the remaining bullets of its "With OpenCode Console installed" section. The rate-limit and reasoning-effort lessons land no code: the recorded run answered no keyed 429 and never measured the field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Takes #174 (the Console client id from a repository variable), #167 (the Go limits page read by its tab labels) and #160 (pnpm/action-setup 6.1.1). The workflows keep the composite setup action, which now carries the 6.1.1 pin, the one site that holds it; generate-go-limits.ts reads its sources through #167's firstDoc/docFrom/chooseTables inside generator-kit's arguments, staleness rule and outcome, with go-limits-render's renderer; AGENTS.md and docs/testing.md carry both sides' text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…s it was withReadmePolicy rewrote one field at a time over text earlier fields had already edited, so a field's new value could be read as a later field's old one: a bridge raising its pi floor to the pi the record holds while pi moves on wrote the new pi where the floor belongs, and named nothing for review. Every plan's replacements are now decided against the original paragraphs and applied in one pass; two fields that would rewrite one value apart are both left for review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…ep guards A pnpmfile's updateConfig hook can set the allow-all, and the pinned pnpm loads one from the root (.pnpmfile.cjs or .pnpmfile.mjs) or wherever the workspace's pnpmfile names, so adding one turned every dependency build on in the plan step's installs while the guard stayed green. The guard now fails on a root pnpmfile, the workspace keys that load one (pnpmfile, globalPnpmfile, configDependencies), .npmrc's and a --pnpmfile flag, each a known answer; ci.yml, CONTRIBUTING, AGENTS.md and the plan name it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…verify-session-band failing The spawned catalog-generator and verify-catalog cases fed only made-up ids, which the old rules called stale too, and neither script had a spawned current answer. A payload that reproduces the shipped shim (the inverse of the parser, held by the pure case) now runs both: current, then the same ids with only the Go plane's endpoint or one Zen family endpoint moved, stale, and each mutant that drops the endpoints from the comparison fails. verify-session-band was spawned only in its passing state; a scratch copy of it beside a src/session.ts whose derivation leaves the band now prints the MISMATCH line, no CONFIRMED, and exits 1, which fails once the script stops setting its exit code. The docs drop the "no seam" and "no payload reproduces the shim" reasons, which did not hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…request The parity plan still credited scripts/check.ts with keeping lib/client.js free of host-only imports, which it never scanned; the import-graph walk in test/architecture.test.ts is what enforces it, as AGENTS.md and docs/credentials.md already say. Its coverage floors, four numbers behind the ratchet, now point at vite.config.ts. The plan's phase table names #173. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…ings The tokenless plan step's build-approval guard named a root pnpmfile and three global spellings that no case exercised: the known answer handed buildApprovals a ready-made pnpmfile list, and it carried none of globalPnpmfile, .npmrc's global-pnpmfile or a --global-pnpmfile flag, so emptying the probe or dropping a spelling left the file green. The probe is now pnpmfilesIn(root), read for the repository and for a scratch root (empty, one file planted, both planted, a missing directory), and the known answer carries each global spelling with its expected line. Emptying PNPMFILES, either global key or the regex's global group now turns the file red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD # Conflicts: # docs/improvement-plan.md
The keyless-label assertion read only the first row picked by its own "a free model" prefix, so it held by construction and tied nothing to `keyed: false`. Walk every printed variant row instead: it contains "no key" exactly when its variant is keyless, and the keyless rows are the known six (three free variants on each plane). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
No file conflicted. Resolutions, file by file:
- test/freshness-scope.test.ts: auto-merged; main's new es-module-lexer 3
case ("reads a file off every loading form...") sits beside this
branch's rewritten cases, both kept.
- scripts/freshness-scope.ts: main's es-module-lexer 3 port taken as is
(this branch does not touch the file).
- package.json, pnpm-lock.yaml, channels/rc/pnpm-lock.yaml,
pnpm-workspace.yaml: main's, unchanged (#177).
- src/catalog-data.ts, src/go-limits-data.ts: main's generated tables,
unchanged (#178).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Brings in p-t3's merge of main: the #177 toolchain bump (vite-plus 1.5.0 with vitest 5.1.0 and the dev-dependency group, the es-module-lexer 3 port of scripts/freshness-scope.ts and test/freshness-scope.test.ts) and the #178 refresh of the generated catalog and limits tables. No file conflicted: p-r3's own change touches none of the files p-t3 changed, so every file merged automatically. - package.json, pnpm-lock.yaml, channels/rc/pnpm-lock.yaml, pnpm-workspace.yaml: taken from p-t3 (main's #177) unchanged; p-r3 does not touch them. - scripts/freshness-scope.ts, test/freshness-scope.test.ts: taken from p-t3 unchanged (#177's es-module-lexer 3 port). - src/catalog-data.ts, src/go-limits-data.ts: taken from p-t3 (main's #178) exactly; generated, never hand-edited. The merged tree is p-r3's own change (its diff against 9911b30) on top of the new parent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Owner
Author
|
This phase's earlier reviews ran without the dedicated reviewer, so it has now had a second review on that reviewer. The branch moved fast-forward to Re-review:
Merges: the re-reviewed P-T3 ( Gate:
Generated by Claude Code |
The nightly refresh (#182) added hy4-flash-free to both planes (Zen 88 -> 89, Go 32 -> 34 with qwen4-max on @ai-sdk/anthropic) and qwen4-max to the Go limits (29 -> 30). test/catalog-docs.test.ts held five doc counts to the old catalog; the docs follow it: - README.md, README.zh-CN.md: the per-SDK routing table's no-SDK row 27 -> 28, the stated total 88 -> 89 (twice) and its date 2026-11-16; the Go plane's Chat Completions list gains hy4-flash-free and its Anthropic Messages list gains qwen4-max, so the lists stay the whole Go catalog. Kept in step for the docs-pairing gate. - docs/protocol-routing-and-merge.md: every "N of 88" becomes "of 89", the no-SDK row 27 -> 28, the count date 2026-11-16, and the refresh history names #182. - docs/redirect-planes.md: the served halves 88 -> 89 (Zen) and 32 -> 34 (Go); the shapes table's no-SDK row 27/21 -> 28/22 and Go Anthropic 5 -> 6; "0 of 89 on Zen, 0 of 34 on Go"; the Go non-completions sentence 11 -> 12; both count dates and histories name #182. The listed halves stay the ones #156 recorded, since the registry was not re-read. No test pins a count any more (the catalog tests assert invariants), the Go limits count appears in no document, and no fixture names a moved row, so no test changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The catalog refresh added hy4-flash-free and qwen4-max to Go, and the newest host cell's pi lacks both, so Settings' fetch on Go now appends them there too. Three test comments still described an empty Go gap on the newest cell; they now say what holds on every refresh. The phase record in docs/improvement-plan.md keeps its statement, marked as true at the time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The parenthetical beside the per-plane gap assertion said the newest cell's pi lacks the catalog's newest ids. Nothing asserts that, and it moves with pi's releases, so it now says only that which ids a cell's pi lacks moves with the catalog and with pi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…claude/vigilant-mendel-bctz9n-p-t3 No file conflicted. Twelve files came in from the parent; P-T3 had touched two of them, in hunks git merged on its own: - docs/redirect-planes.md: P-T3 rewrote the section 7 paragraph on the OPENCODE_E2E_KEYED tiers (a dispatch's `keyed` input, the composite setup action); the refresh moved the section 1 and 2 counts (Zen 89, Go 34, the no-SDK row 28/22, Go Anthropic 6, Go non-completions 12) and their #182 stamp. Both kept: P-T3's paragraph, the parent's counts. - docs/improvement-plan.md: P-T3 rewrote the phase table and its own P-T3 entries; the refresh reworded one P-PD1 restack bullet (the newest cell's pi then listed every Go catalog model). Both kept. Taken from the parent unchanged, P-T3 did not touch them: README.md, README.zh-CN.md, docs/protocol-routing-and-merge.md, pnpm-workspace.yaml (vite-plus and vite-plus-core 1.6.0), pnpm-lock.yaml and channels/rc/pnpm-lock.yaml, src/catalog-data.ts and src/go-limits-data.ts (generated), test/host-discovery.test.ts, test/host-planes-foreign.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…to claude/vigilant-mendel-bctz9n-p-r3 Brings in the parent's merge of main's toolchain bump (#181: vite-plus and vite-plus-core 1.6.0, oxlint 1.93, oxfmt 0.78, both lockfiles relocked, two test helpers moved to .then().catch()) and the nightly refresh (#182: Zen 89 and Go 34 catalog models with hy4-flash-free and qwen4-max, Go limits 30), followed through the README pair, the protocol, redirect-planes and improvement-plan docs and two host tests. No conflicts. README.md, README.zh-CN.md, docs/improvement-plan.md and docs/redirect-planes.md were changed on both sides and merged cleanly in separate hunks: this branch's refusal reporting rows and plan entries beside the parent's catalog counts. The merged tree is this branch's own change (ef74a26..0f97615) applied unchanged on top of the parent (f36e849); the lockfiles and pnpm-workspace.yaml are the parent's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
History only: main's tree equals the p-t3 tree (f36e849) this branch already contains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
viztor
changed the base branch from
claude/vigilant-mendel-bctz9n-p-t3
to
main
November 16, 2026 17:43
viztor
pushed a commit
that referenced
this pull request
Nov 16, 2026
History only: main's tree equals the p-r3 tree (71316be) this branch already contains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase P-R3 of docs/improvement-plan.md, on main (P-T3, #173, is merged).
What changed
src/utils/gateway-refusal.ts. It reads the gateway's typed refusal from pi's failure text and maps it to one of two codes.FREE_TIERcoversFreeTierErrorandFreeUsageLimitError.MODEL_UNAVAILABLEcoversRegionError,ModelDeprecatedandModelProtocolUnsupported. Neither code isAUTH,QUOTAorACCOUNT_QUOTA, so the chat UI shows the gateway's own words instead of replacing them with "API key is invalid" or "Request quota exhausted.". Neither code is in the host's default retryable set. pi's message is kept unchanged, andstatusis read only from the head of the text.PlaneAdapter.prepareCallandstream()wrap the prepared stream and rewrite the finalfinishfailure. pi-ai's own routes and stepped-aside planes (D27) keep the bridge's codes.src/tool-fallback.tsnow treats areadorbashtool without non-emptypropertiesas missing, and replaces it rather than adding a duplicate. A free chat-completions body that had no tools getstool_choice: "none". Responses bodies are never touched.test/support/keyed-probes.tsadds four kinds of row: OC9 (a raw, non-ses_session id, keyed and free), OC8 (session-only headers, keyed), OC6 (the harness User-Agent, keyed and free), and a free baseline. A keyless 429 from the usage cap now reads asfree-usage-limited, notrate-limited, and is left out of theRetry-Afterrecord. They are formatted into the variants table indocs/redirect-planes.md§13.Retry-Afterto act on. L10'sreasoning_effort: "none"was never measured: the reasoning model was refused both with and without the field.AGENTS.md,CONTRIBUTING.md,docs/testing.mdand the CI comments now describe the above. New tests:test/gateway-refusal.test.ts,test/mock/plane-refusals.mock.ts, and new cases in the plane-provider, tool-fallback, keyed-probes and endpoint-record tests.Behaviour changes
AUTH,QUOTA,INVALID_REQUESTorPI_AI_ERROR, depending on how the bridge read the text. It now finishes asFREE_TIERorMODEL_UNAVAILABLE, and is not retried by default. The conversation shows the gateway's words and its status. Google-protocol models are the exception: their failure text carries no status, so none is shown.readorbashthat has no properties instead of adding a second copy. It sendstool_choice: "none"on a free chat-completions turn that had no tools.Retry-Afterline now reads "Retry-Afteron a keyed 429: no keyed 429 was answered." (it was "no 429 was answered."). The old wording appeared to contradict keyless free rows that answerfree-usage-limited (429)in the variants table.Review
The chain ran three rounds, each with correctness, tests and rules lenses, and a verify pass after each fix round.
Those rounds ran on the general model, because the dedicated reviewer was unavailable. The dedicated reviewer then re-reviewed the phase: round 1 upheld one finding, which is fixed, and round 2 was clean. Each merge of
main(#177, #178, #181, #182 and #173) was reviewed for faithfulness, and found nothing.Verification
At the current head (main through #173), on Node 26.12.1:
pnpm run checkscripts/check.tsCI is green on every check,
catalog freshnessincluded.🤖 Generated with Claude Code
https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD