-
Notifications
You must be signed in to change notification settings - Fork 624
fix(combos,pi): keep unknown-ladder models selectable and Pi loopback models visible #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee580a6
db7c6f0
634390d
033db63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,15 +107,9 @@ export const OPENCODE_API_KEY_ENV = "OPENCODEX_OPENCODE_API_KEY"; | |
| /** Env reference shared by apiKey and the dedicated proxy admission header. */ | ||
| export const OPENCODE_API_KEY_ENV_REF = `{env:${OPENCODE_API_KEY_ENV}}`; | ||
|
|
||
| /** Env var Pi interpolates. Pi takes bare `$NAME`, not opencode's `{env:NAME}`. */ | ||
| export const PI_API_KEY_ENV = "OPENCODEX_API_KEY"; | ||
|
|
||
| /** Pi's reference form for the admission key. Never the value. */ | ||
| export const PI_API_KEY_ENV_REF = `$${PI_API_KEY_ENV}`; | ||
|
|
||
| /** | ||
| * Hermes interpolates `${VAR}` anywhere in config.yaml, so the credential stays | ||
| * in the environment exactly as it does for OpenCode and Pi. | ||
| * in the environment exactly as it does for OpenCode. | ||
| */ | ||
| export const HERMES_API_KEY_ENV = "OPENCODEX_HERMES_API_KEY"; | ||
| export const HERMES_API_KEY_ENV_REF = `\${${HERMES_API_KEY_ENV}}`; | ||
|
|
@@ -125,12 +119,12 @@ export const OPENCLAW_API_KEY_ENV = "OPENCODEX_OPENCLAW_API_KEY"; | |
| export const OPENCLAW_API_KEY_ENV_REF = `\${${OPENCLAW_API_KEY_ENV}}`; | ||
|
|
||
| /** | ||
| * Kimi Code reads credentials ONLY from its config file — it never falls back | ||
| * to the shell environment. A loopback bind needs no real admission key, so we | ||
| * emit the same placeholder the Grok managed block uses rather than a user | ||
| * secret; a non-loopback bind is refused by the writer instead of papered over. | ||
| * Placeholder credential for loopback-only clients (Kimi, Pi). A loopback | ||
| * bind needs no real admission key, so we emit the same placeholder the Grok | ||
| * managed block uses rather than a user secret. Pi resolves `apiKey` before | ||
| * building its model list and hides the provider when an env reference is unset. | ||
| */ | ||
| export const KIMI_LOOPBACK_PLACEHOLDER = "opencodex-loopback"; | ||
| export const LOOPBACK_API_KEY_PLACEHOLDER = "opencodex-loopback"; | ||
|
|
||
| /** | ||
| * Gajae's `apiKeyEnv` is env-name-only and fail-closed. Its sibling `apiKey` | ||
|
|
@@ -728,7 +722,7 @@ function buildPiClientConfig(ctx: ExportContext): PiGeneratedConfig { | |
| [OPENCODE_PROVIDER_ID]: { | ||
| baseUrl: ctx.baseUrl, | ||
| api: PI_API_DIALECT, | ||
| apiKey: PI_API_KEY_ENV_REF, | ||
| apiKey: LOOPBACK_API_KEY_PLACEHOLDER, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After Pi starts serializing this literal placeholder, the shipped guidance still documents the removed environment-reference contract: AGENTS.md reference: AGENTS.md:L231-L232 Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Pi uses one of the exported native bare OpenAI rows while the canonical AGENTS.md reference: src/AGENTS.md:L20-L20 Useful? React with 👍 / 👎. |
||
| models, | ||
| }, | ||
| }, | ||
|
|
@@ -808,7 +802,7 @@ function buildKimiClientConfig(ctx: ExportContext): KimiGeneratedConfig { | |
| [OPENCODE_PROVIDER_ID]: { | ||
| type: "openai", | ||
| base_url: ctx.baseUrl, | ||
| api_key: KIMI_LOOPBACK_PLACEHOLDER, | ||
| api_key: LOOPBACK_API_KEY_PLACEHOLDER, | ||
| }, | ||
| }, | ||
| models, | ||
|
|
@@ -949,15 +943,14 @@ export const EXPORT_CLIENTS: Record<ExportClientId, ExportClientSpec> = { | |
| id: "pi", | ||
| filename: "pi-models.json", | ||
| destination: () => join(homedir(), ".pi", "agent", "models.json"), | ||
| apiKeyEnv: PI_API_KEY_ENV, | ||
| exportHint: `export ${PI_API_KEY_ENV}=<your key>`, | ||
| apiKeyEnv: "", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the dashboard has no generated API keys, Useful? React with 👍 / 👎. |
||
| exportHint: "Pi reads a non-secret placeholder from models.json; loopback needs no key.", | ||
| build: buildPiClientConfig, | ||
| format: "json", | ||
| summarize: summarizePi, | ||
| buildContribution: buildPiContribution, | ||
| // No header field in Pi's provider block (and the schema is unverified | ||
| // against a real install), so there is nowhere to put the dedicated | ||
| // admission header a remote bind requires. | ||
| // No header field in Pi's provider block, so there is nowhere to put the | ||
| // dedicated admission header a remote bind requires. | ||
| loopbackOnly: true, | ||
|
Comment on lines
+946
to
954
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
ast-grep outline src/clients/config-export.ts --items all
rg -n -C 10 --glob '*.ts' \
'buildClientConfig|buildPiClientConfig|EXPORT_CLIENTS|apiKeyEnv|isLoopback|loopback|admission|baseUrl' \
src testsRepository: lidge-jun/opencodex Length of output: 50376 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# Inspect the export spec definitions and management route usage without exceeding output limits.
wc -l src/clients/config-export.ts src/server/management/model-routes.ts src/routes.ts src/server/routes.ts src/server/.*
printf '\n--- config-export outline relevant symbols ---\n'
ast-grep outline src/clients/config-export.ts | sed -n '1,220p'
printf '\n--- relevant config-export sections ---\n'
sed -n '700,750p' src/clients/config-export.ts
sed -n '920,970p' src/clients/config-export.ts
rg -n --glob '*.ts' -C 3 'export type |api-spec|EXPORT_CLIENTS|buildClientConfig|exportClient|spec\|specs|client:\s*\{' src/clients/config-export.ts
printf '\n--- management route relevant sections ---\n'
sed -n '150,210p' src/server/management/model-routes.ts
rg -n --glob '*.ts' -C 4 'buildClientConfigText|model-routes|specs|client' src/server/management/model-routes.tsRepository: lidge-jun/opencodex Length of output: 392 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '--- relevant config-export sections ---\n'
sed -n '1,180p' src/clients/config-export.ts
sed -n '680,760p' src/clients/config-export.ts
sed -n '910,990p' src/clients/config-export.ts
printf '\n--- targeted config-export refs ---\n'
rg -n --glob '*.ts' -C 3 'buildClientConfig|buildClientConfigText|buildPiClientConfig|EXPORT_CLIENTS|exportClient|specs|client:' src tests 2>/dev/null | sed -n '1,260p'
printf '\n--- management route relevant sections ---\n'
sed -n '1,230p' src/server/management/model-routes.ts
printf '\n--- routing files ---\n'
git ls-files src | rg 'route|management|config' | sed -n '1,200p'
printf '\n--- targeted route/management refs ---\n'
rg -n --glob '*.ts' -C 4 'config-export|model-routes|model-config|export|client' src/server src/routes tests 2>/dev/null | sed -n '1,340p'Repository: lidge-jun/opencodex Length of output: 248 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- relevant config-export sections ---'
sed -n '1,180p' src/clients/config-export.ts
sed -n '680,760p' src/clients/config-export.ts
sed -n '910,990p' src/clients/config-export.ts
printf '%s\n' '--- targeted config-export refs ---'
rg -n --glob '*.ts' -C 3 'buildClientConfig|buildClientConfigText|buildPiClientConfig|EXPORT_CLIENTS|exportClient|specs|client:' src tests 2>/dev/null | sed -n '1,260p'
printf '%s\n' '--- management route relevant sections ---'
sed -n '1,230p' src/server/management/model-routes.ts
printf '%s\n' '--- routing files ---'
git ls-files src | rg 'route|management|config' | sed -n '1,200p'
printf '%s\n' '--- targeted route/management refs ---'
rg -n --glob '*.ts' -C 4 'config-export|model-routes|model-config|export|client' src/server src/routes tests 2>/dev/null | sed -n '1,340p'Repository: lidge-jun/opencodex Length of output: 50375 Block non-loopback Pi exports from the shared exporter. In 🤖 Prompt for AI AgentsSource: Path instructions |
||
| }, | ||
| hermes: { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a selected target has no effort metadata, this branch now preserves the other targets' efforts—or offers every effort when all ladders are unknown—but
gui/src/i18n/en.tsstill tells users that targets without metadata “offer none.” The visible explanation therefore contradicts the picker; revise the hint consistently across the locale files to explain the wildcard behavior.AGENTS.md reference: gui/AGENTS.md:L14-L18
Useful? React with 👍 / 👎.