Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 3s
CI / Detect changes (pull_request) Successful in 4s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 15s
E2E API Smoke Test / detect-changes (pull_request) Successful in 5s
E2E Chat / detect-changes (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 4s
E2E Staging SaaS (full lifecycle) / pr-validate (pull_request) Successful in 28s
E2E Staging SaaS (full lifecycle) / E2E Staging SaaS (pull_request) Has been skipped
Handlers Postgres Integration / detect-changes (pull_request) Successful in 5s
Harness Replays / detect-changes (pull_request) Successful in 5s
CI / Platform (Go) (pull_request) Successful in 4m59s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 49s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
gate-check-v3 / gate-check (pull_request) Successful in 4s
qa-review / approved (pull_request) Failing after 2s
security-review / approved (pull_request) Failing after 3s
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request) Successful in 2s
sop-tier-check / tier-check (pull_request) Successful in 4s
CI / Canvas (Next.js) (pull_request) Successful in 6m34s
CI / Python Lint & Test (pull_request) Successful in 6m28s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 1s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 36s
Harness Replays / Harness Replays (pull_request) Successful in 2s
CI / all-required (pull_request) Successful in 6m23s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 1s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2m3s
E2E Chat / E2E Chat (pull_request) Failing after 4m58s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CTO-approved scope-narrowing to the four maintained runtimes (claude-code, openclaw, hermes, codex) plus autogen/langgraph legacy. RFC molecule-ai/internal#483. - provisioner/registry.go: drop the 3 from knownRuntimes (kept alphabetical ordering; count pin updated 9 -> 6 in registry_test.go). - handlers/admin_workspace_images.go: drop the 3 from AllRuntimes so imagewatch stops pulling now-removed template images. - models/runtime_defaults.go: doc-comment list updated; drop the 3 explicit drift-detection rows from runtime_defaults_test.go. - localbuild_test.go RepoNotFound fixture switched crewai -> hermes (post-removal crewai is no longer a known runtime, so the test would hit the "unknown runtime" branch instead of the intended 404 path). - provisioner_test.go error-classification fixture string crewai -> hermes (no removed-runtime names in fixtures). Live-workspace safety gate cleared first: zero workspaces on the 3 runtimes across the production fleet (per-tenant DB query on hongming/go-to-market/chloe-dong + CP tenant_resources provisioning ledger covering reno-stars). Registry/pin row removal handled by a separate controlplane migration PR, landed after this merges. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1.8 KiB
Go
40 lines
1.8 KiB
Go
package models
|
|
|
|
// runtime_defaults.go — single source of truth for per-runtime defaults
|
|
// the platform applies when the operator/agent didn't supply a value.
|
|
//
|
|
// Why this lives in models/ (not handlers/): default selection is a
|
|
// pure data fact about the runtime, not handler logic. Multiple
|
|
// callers (Create-workspace handler, org-import handler, future
|
|
// auto-provision paths) need the same answer; concentrating the
|
|
// rule here means one edit when a runtime's default changes.
|
|
//
|
|
// Related work (RFC #2873): this is the seed for a future
|
|
// `RuntimeConfig` interface that will also expose `ProvisioningTimeout()`,
|
|
// `CapabilitiesSupported()`, and other per-runtime facts. For now the
|
|
// surface is one helper — extracted from the duplicate branch in
|
|
// workspace_provision.go:537 and org_import.go:54 that diverged silently
|
|
// during refactors before this consolidation.
|
|
|
|
// DefaultModel returns the model slug to use when a workspace is
|
|
// created without an explicit model and the runtime can't infer one
|
|
// from its own config.
|
|
//
|
|
// - claude-code: "sonnet" — Anthropic's CLI accepts the short
|
|
// name and resolves it via the operator's anthropic-oauth or
|
|
// ANTHROPIC_API_KEY chain.
|
|
// - everything else (hermes, langgraph, autogen, codex, openclaw,
|
|
// external, ""): a fully-qualified
|
|
// vendor:model slug that the universal MODEL_PROVIDER chain in
|
|
// molecule-core PR #247 can route via per-vendor required_env.
|
|
//
|
|
// The function never returns an empty string; an unknown runtime
|
|
// gets the universal default rather than failing closed (matches the
|
|
// pre-refactor behavior — both call sites used the same fallback).
|
|
func DefaultModel(runtime string) string {
|
|
if runtime == "claude-code" {
|
|
return "sonnet"
|
|
}
|
|
return "anthropic:claude-opus-4-7"
|
|
}
|