Repository navigation
Conversation
Co-authored-by: Juan Fernando Huenchun Barra <jhuenchunbarra@gmail.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
✅ Deterministic PR hygiene checks passed. |
Pi now receives a raw nested selector only when the serving proxy's own configuration and inventory prove it reaches the encoded key's model and account, Fast row included, with no other row claiming it. Cold, ambiguous, colliding and wrong-model routes keep the encoded key. ocx export --client pi takes its document from /api/client-config, and a managed Pi write refuses when a captured selector stopped proving.
Maintainer judgment: hold (not merging)The rework at
Fixing either one means choosing who owns Pi's catalog, and each choice changes something users see:
The branch is left as a draft at |
…ws in Codex Direct Pi may carry raw nested selectors that only the serving proxy can prove (#8172), but ocx sync rebuilt the Pi file in the CLI process from the CLI's saved configuration and router cache, and the write guard re-proved against the same snapshot. ocx sync now leaves Pi out of its local refresh and asks the running proxy to refresh an owned Pi file through POST /api/client-integrations/pi/sync, which builds it from that process's own configuration, router and roster; a refusal or an older proxy is reported as a Pi outcome with no local fallback. The Pi export moved onto the serving proxy's roster, which kept native OpenAI rows in Codex Direct mode; Direct forwards the caller's own bearer and Pi sends a placeholder key, so those rows only answered 401. The Pi builder now drops them in Direct mode, as the CLI-built export did.
Summary
Pi exports routed models under the proxy's encoded key, so OpenRouter's nested
openrouter/freeis exported asopenrouter/openrouter-free. That key routes only while the router's inventory can decode it; with a cold inventory the proxy forwardsopenrouter-freeand the upstream rejects it (#8172).Following the owner decision on #8172 (the serving proxy is authoritative; ambiguous, colliding, wrong-model and cold-inventory routes are refused), Pi now gets the raw selector only where the serving proxy proves it:
src/clients/config-export/nested-selectors.tsruns insideloadExportModelsagainst the admitted configuration and router inventory of that load. The raw selector, and its--fastform for a Fast row, must reach the encoded key's provider, model and account, and no other row of the full roster may claim it. The proof is the alias proof, factored out ofalias-selectors.tsintoproveExportSelectoranduniqueExportCandidates.acme/org/modelnext toorg/model), a policy or combo result, or a collision keeps the encoded key, which is today's output.ocx export --client pifetches its document from/api/client-config, the route the dashboard download already uses, so the CLI's saved configuration never proves a selector.model-name-guard.ts) and refuses withconflictif one changed.structure/clients/export-model-names.mddescribe the rule.Carries the approach from #8171; the first commit includes the original author's
Co-authored-bytrailer.Closes #8172
Verification
All runs used Bun 1.4.4 with
env -iand temporaryHOME,OPENCODEX_HOME,CODEX_HOMEandCLAUDE_CONFIG_DIR.tests/cli/cli-export-command.test.ts"the serving proxy proves the raw selector…" (serving config knowsorg/free, saved config does not) fails with either the CLI routing change or theloadExportModelsattachment reverted, and passes with both. The guard case intests/clients/client-export-model-names.test.tsfails withmodel-name-guard.tsreverted.tests/config/client-config-export.test.ts: proven with Fast, cold inventory, self-namespaced collision, roster collision, explicit alias and a stale candidate on reload.client-config-export100/0,cli-export-command33/0,client-export-model-names12/0,management-client-config-route43/0,api-catalog-route9/0,loopback-listener-integration38/0.tests/clientsplus the export and management route files in one process: 3029 pass, 9 fail. All nine pass when their files run alone (cross-file state in a single process).bun run typecheck,bun run structure:check,bun run privacy:scanandgit diff --checkpass.bun run test, the docs-site build, and a live Pi client against OpenRouter.--no-verify; the repository has no pre-push hook.Checklist