feat(create): hard-fail BYOK-unsatisfiable models at create + SSOT model-discovery endpoint (core#2608) #2617
Reference in New Issue
Block a user
Delete Branch "fix/2608-hardfail-byok-at-create"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements the CTO's two rulings on #2608:
422 MISSING_BYOK_CREDENTIALbefore any row exists (same actionable message provisioning would emit, plus a pointer to the platform defaultmoonshot/kimi-k2.6). Platform slash-form ids stay query-free; derive/registry/global-scan failures fail open with the provision preflight as backstop (#1994 + #711-revert contracts preserved — global-scope tenant creds count for byok).GET /admin/llm/offered-models?runtime=— per-id{model, provider, platform_billed, auth_env}derived through the SAME DeriveProvider the gate enforces, so lookup can never disagree with enforcement. The concierge's pre-provision lookup; a follow-up mcp-server PR exposes it as alist_offered_modelstool + teachesprovision_workspace's model param the namespace rule.Live trigger: enter-os first-run — the concierge guessed a BYOK-form claude id, create passed, provisioning failed seconds later, the user saw dead red nodes.
Tests: 422-no-insert, global-cred satisfies, platform-id query-free, discovery payload pins. Full handlers pkg green.
Refs core#2608.
🤖 Generated with Claude Code
Requesting changes.
5-axis review on head
1bf1b2b917:globalSecretKeyNamesonly fails open whenQueryContextitself returns an error. If the query starts but iteration later fails (rows.Err()) or a row cannot scan, the function still returnsok=truewith partial keys. That can incorrectly 422 a legitimate create whose satisfying credential was omitted by a transient DB/scan failure, violating the PR's own contract that global-secret lookup blips must fail open because provision preflight is the backstop. Please checkrows.Err()after iteration and return(nil, false)on any iteration/scan failure, with a regression test.AdminAuth.Local Go tests not run:
gois unavailable in this runtime. Gitea shows Handlers Postgres Integration and several required checks green, but E2E API is pending and gate/security/SOP contexts are currently failing/pending in the API snapshot.Requesting changes on head
49d077e3f7.Blocking findings:
workspace-server/internal/handlers/model_registry_validation_2608_test.gohas an extra)immediately after the import block. This is a syntax error, so the new tests cannot compile.workspace-server/internal/handlers/offered_models.godeclaresProvider string+ 'json:"provider"' +twice in+ 'OfferedModel' + `. That is a duplicate struct field and will fail compilation.I stopped at these compile blockers. The intended behavior is on the right track, but the PR cannot be approved until the current head builds. Local verification note: this runtime does not have
+ 'go' +installed, so I could not run the package tests directly; both blockers are visible in the submitted diff.APPROVED. Reviewed current head
a6d67d7cfd. The previous blockers on older heads are addressed. The create boundary now rejects BYOK-derived models without a satisfiable workspace/org credential before inserting a workspace row, while preserving platform-derived and derive-failure behavior and failing open only on registry/global-secret scan availability where provision preflight remains the backstop. The offered-models endpoint is derived from the same provider registry/DeriveProvider path and exposes platform-billed vs BYOK auth_env consistently. Tests cover the 422/no-insert path, global credential pass, platform query-free path, discovery payload, and global_secrets query/scan/rows error handling. Required contexts are green by max-id status collapse: CI / all-required, Platform, E2E API Smoke, and Handlers Postgres; remaining reds are governance/advisory. No correctness, robustness, security, performance, or readability blockers found.