feat(contracts): vendor + consume provider_registry SSOT from CP (RFC internal#580 Phase 2a consumer) #34
Open
core-be
wants to merge 1 commits from
feat/contracts-provider-registry-consumer-580 into main
pull from: feat/contracts-provider-registry-consumer-580
merge into: molecule-ai:main
molecule-ai:main
molecule-ai:bump/runtime-0.3.54
molecule-ai:bump/runtime-0.3.53
molecule-ai:bump/runtime-0.3.52
molecule-ai:bump/runtime-0.3.51
molecule-ai:bump/runtime-0.3.50
molecule-ai:bump/runtime-0.3.49
molecule-ai:bump/runtime-0.3.48
molecule-ai:bump/runtime-0.3.47
molecule-ai:bump/runtime-0.3.46
molecule-ai:ops/ecr-lifecycle-iac
molecule-ai:fix/platform-agent-mcp-binary-path
molecule-ai:bump/runtime-0.3.44
molecule-ai:fix/162-auto-promote-platform-agent-pin
molecule-ai:bump/runtime-0.3.43
molecule-ai:feat/3082-capture-loaded-mcp-tools
molecule-ai:fix/123-stale-push-contexts-on-main
molecule-ai:fix/3082-log-ignored-settings-mcp
molecule-ai:bump/runtime-0.3.42
molecule-ai:bump/runtime-0.3.41
molecule-ai:ssot/extend-mcp-plugin-delivery-contract
molecule-ai:bump/runtime-0.3.40
molecule-ai:fix/123-stale-push-contexts
molecule-ai:fix/2919-platform-agent-entrypoint-fallback
molecule-ai:bump/runtime-0.3.38
molecule-ai:core-3080-mcp-plugin-delivery-contract
molecule-ai:devops/load-plugin-mcp-under-strict-config
molecule-ai:bump/runtime-0.3.37
molecule-ai:bump/runtime-0.3.36
molecule-ai:bump/runtime-0.3.35
molecule-ai:fix/adapter-model-namespace-drift-iss143
molecule-ai:bump/runtime-0.3.34
molecule-ai:fix/t4-validate-fork-only-skip
molecule-ai:bump/runtime-0.3.33
molecule-ai:bump/runtime-0.3.32
molecule-ai:bump/runtime-0.3.31
molecule-ai:bump/runtime-0.3.30
molecule-ai:bump/runtime-0.3.29
molecule-ai:bump/runtime-0.3.28
molecule-ai:feat/docs-local-build-flow-iss5
molecule-ai:chore/wire-gitea-credential-safety
molecule-ai:fix/surface-cli-stream-errors
molecule-ai:fix/secret-scan-dead-github-exclude
molecule-ai:bump/runtime-0.3.27
molecule-ai:bump/runtime-0.3.26
molecule-ai:bump/runtime-0.3.25
molecule-ai:fix/memory-reinject-on-overflow-heal
molecule-ai:fix/kimi-context-window-prevents-overflow-wipe
molecule-ai:fix/2748-surface-resultmessage-detail
molecule-ai:bump/runtime-0.3.24
molecule-ai:bump/runtime-0.3.23
molecule-ai:bump/runtime-0.3.22
molecule-ai:bump/runtime-0.3.21
molecule-ai:bump/runtime-0.3.20
molecule-ai:bump/runtime-0.3.19
molecule-ai:bump/runtime-0.3.16-manual
molecule-ai:bump/mcp-server-1.6.1
molecule-ai:fix/pa-smoke-fstring-quote
molecule-ai:bump/mcp-server-1.6.0
molecule-ai:chore/bump-runtime-0.3.11
molecule-ai:bump-runtime-0.3.14
molecule-ai:fix/platform-agent-runtime-env
molecule-ai:feat/platform-mcp-symlink
molecule-ai:feat/mcp-1.5.0-and-fragment-merge
molecule-ai:chore/runtime-0.3.13
molecule-ai:chore/bump-runtime-0.3.12
molecule-ai:chore/content-security-102-prose-cleanup
molecule-ai:fix/platform-agent-pythonpath-adapter
molecule-ai:bump/runtime-req-0.3.10
molecule-ai:fix/concierge-mcp-session-reset
molecule-ai:fix/runtime-pin-phase2
molecule-ai:fix/claude-code-provider-projection-subset
molecule-ai:bump-runtime-0.3.10
molecule-ai:chore/bump-runtime-0.3.9
molecule-ai:fix/platform-agent-ecr-provenance
molecule-ai:fix/providers-remove-stale-colon-byok-forms
molecule-ai:fix/platform-agent-ecr-repo-path
molecule-ai:feat/platform-agent-image-rehome
molecule-ai:feat/platform-agent-extra-mcp
molecule-ai:fix/context-overflow-autoheal
molecule-ai:fix/keystone-runtime-pin-autopromote-gate
molecule-ai:fix/template-publish-promote-staging-pin
molecule-ai:bump/runtime-0.3.9
molecule-ai:fix/2204-reasoning-model-thinking-blocks
molecule-ai:chore/runtime-0.3.9
molecule-ai:fix/dockerfile-fail-closed-install
molecule-ai:fix/ci-aggregate-hardening
molecule-ai:fix/template46-adapter-only
molecule-ai:fix/template46-surface-cli-error-to-user
molecule-ai:fix/75-76-claude-install-t4-gate
molecule-ai:fix/75-fail-closed-claude-install
molecule-ai:chore/runtime-0.3.8
molecule-ai:chore/bump-runtime-0.3.7
molecule-ai:chore/runtime-0.3.7
molecule-ai:feat/internal-718-p4-pathb-registry-projection
molecule-ai:fix/internal-702-harness-model-env-passthrough
molecule-ai:feat/secondary-volume-restore
molecule-ai:feat/expand-platform-model-catalog
molecule-ai:fix/display-native-tools
molecule-ai:fix/claude-code-2.1.150-success-as-error-hotfix
molecule-ai:fix/platform-provider-proxy
molecule-ai:chore/runtime-0.3.6
molecule-ai:chore/runtime-0.3.5
molecule-ai:chore/runtime-0.3.4
molecule-ai:chore/runtime-0.3.3
molecule-ai:chore/runtime-0.3.2
molecule-ai:chore/runtime-0.3.1
molecule-ai:chore/runtime-0.3.0
molecule-ai:feat/desktop-control-prompt
molecule-ai:chore/runtime-0.2.5
molecule-ai:chore/runtime-0.2.4
molecule-ai:fix-53-runtime-pin-bump-templates
molecule-ai:chore/runtime-0.2.3
molecule-ai:chore/runtime-0.2.2
molecule-ai:fix-no-response-generated-tool-summary
molecule-ai:chore/runtime-0.2.1
molecule-ai:fix/1689-source-secrets-at-boot
molecule-ai:chore/gitea-only-ci
molecule-ai:chore/runtime-v0.2.0
molecule-ai:chore/gitea-pypi-pip-index-url
molecule-ai:fix/runs-on-docker-host-pin-t390
molecule-ai:fix/377-stop-all-propagation
molecule-ai:fix/t4-conformance-create-agent-home
molecule-ai:chore/ssot10-ecr-registry-var
molecule-ai:chore/ci-delete-dead-github-workflows
molecule-ai:rfc-529-layer-a-auto-promote-pin
molecule-ai:ci/docker-host-pin-validate-runtime-and-t4
molecule-ai:feat/t4-conformance-uniform-contract
molecule-ai:fix/task-214-channels-flag-swallows-print
molecule-ai:fix/publish-image-pin-linux-publish-runner
molecule-ai:fix/issue212-surface-cli-is-error-result
molecule-ai:fix/t4-conformance-concurrency-safe-port-206
molecule-ai:feat/t4-escalation-leg-claude-code
molecule-ai:fix/de172b55-claude-perms-fail-fast-smoke
molecule-ai:fix/claude-code-template-permissions-and-identity
molecule-ai:feat/coding-discipline
molecule-ai:runtime-bump-0.1.131
molecule-ai:infra/main-red-fix-ci-validate
molecule-ai:ci-rename-github-to-gitea
molecule-ai:fix/item-13-stderr-surfaces-in-a2a-error
molecule-ai:fix/yaml-provider-alias-map
molecule-ai:fix/dispatch-alias-map-followup
molecule-ai:fix/dispatch-on-model-env-task-181
molecule-ai:fix/180-explicit-provider-validation
molecule-ai:chore/runtime-version-file
molecule-ai:fix/lowercase-org-slug
molecule-ai:fix/install-path-gitea
molecule-ai:test/log-boot-context-bash-coverage
molecule-ai:feat/per-vendor-env-routing-task-244
Dismiss Review
Are you sure you want to dismiss this review?
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
agent-dev-a
agent-dev-b
agent-pm
agent-researcher
agent-reviewer
agent-reviewer-1
agent-reviewer-cr2
app-fe (Molecule AI · app-fe)
app-lead (Molecule AI · app-lead)
app-qa (Molecule AI · app-qa)
claude-ceo-assistant
claude-ci-reader
core-be (Molecule AI · core-be)
core-devops (Molecule AI · core-devops)
core-fe (Molecule AI · core-fe)
core-lead (Molecule AI · core-lead)
core-offsec (Molecule AI · core-offsec)
core-qa (Molecule AI · core-qa)
core-security (Molecule AI · core-security)
core-uiux (Molecule AI · core-uiux)
cp-be (Molecule AI · cp-be)
cp-lead (Molecule AI · cp-lead)
cp-qa (Molecule AI · cp-qa)
cp-security (Molecule AI · cp-security)
cui (Zhanlin Cui)
dev-lead (Molecule AI · dev-lead)
devops-engineer
documentation-specialist (Molecule AI · documentation-specialist)
fullstack-engineer (Molecule AI · fullstack-engineer)
godwin
hongming
hongming-ceo-delegated
hongming-codex-laptop
hongming-kimi-laptop
hongming-pc2
hongming-personal
infra-lead (Molecule AI · infra-lead)
infra-runtime-be (Molecule AI · infra-runtime-be)
infra-sre (Molecule AI · infra-sre)
integration-tester (Molecule AI · integration-tester)
molecule-code-reviewer
molecule-runtime-release-bot (Molecule Runtime Release Bot)
plugin-dev (Molecule AI · plugin-dev)
pm
publish-runtime-bot
pypi-publisher (Molecule AI PyPI Publisher (RFC#596))
release-manager (Molecule AI · release-manager)
sdk-dev (Molecule AI · sdk-dev)
sdk-lead (Molecule AI · sdk-lead)
sop-tier-bot (SOP Tier-Check Bot)
technical-writer (Molecule AI · technical-writer)
triage-operator (Molecule AI · triage-operator)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-ai-workspace-template-claude-code#34
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feat/contracts-provider-registry-consumer-580"
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?
Summary
Pilot consumer-side wiring for RFC internal#580 Phase 2a (CTO Option C, comment 40358 — 2026-05-19). Paired with molecule-controlplane#224 which adds the Go-side
gen-provider-registrycodegen pipeline.This template is the pilot — claude-code is the most-used workspace runtime, so it's the right place to prove the read-through-cache pattern (
feedback_unified_credentials_file) before extending to codex / hermes / openclaw / langgraph in subsequent phases.What this PR adds
contracts/provider_registry.py: vendored snapshot of the AUTO-GENERATED CP-side registry (frozenset KNOWN_PROVIDER_NAMES+is_known_provider()helper mirroring Go-side semantics — case-insensitive, whitespace-trimmed).contracts/contracts.lock: sha256 pin of the vendored snapshot + upstream source URL.adapter.py: defensive import of the vendored module + new_audit_ssot_registry()logging the YAML-vs-SSOT divergence asssot=ok/ssot=drift/ssot=unavailable. Soft-gate by design — Phase 2a is observability-only on the consumer side; the CP-side hard-gate (cp#220) is the load-bearing primitive..gitea/workflows/ci.yml: newcontracts-drift-checkjob. Fetches the canonical file frommolecule-controlplanemain HEAD and asserts byte-equality with the vendored snapshot.tests/test_ssot_provider_registry.py: 6 unit tests pinning vendored module shape, Go-side semantics parity, lock-vs-file sha parity, and audit log assertions.Three-way parity enforcement
contracts/make verify-contractsin molecule-controlplane (#224)contracts.lockshatest_contracts_lock_sha_matches_vendored_file(pytest)contracts.locksha ↔ CP main HEADcontracts-drift-checkCI job (this PR)Drift in any link goes red somewhere.
Why a soft-gate on the consumer side
The CP-side hard-gate (cp#220) already rejects bad provider names at
POST /workspaces. The consumer-side check is observability — it surfaces drift indocker logsBEFORE the CP-side rejects the next save+restart. Until every template repo ships the vendored snapshot (Phase 2c per RFC#580 §5), this layer must degrade gracefully on older images: the fallback null-objectis_known_providerreturnsFalsefor everything, audit emits a singlessot=unavailablewarning, and the workspace boots via the existing YAML path unchanged.Test plan
python3 -m pytest tests/— 92/92 pass (86 prior + 6 new)contracts.locksha matchesprovider_registry.pybyte-for-bytecontracts-drift-checkjob goes green (depends on #224 landing first)validateaggregator +tests+t4-conformancestay greenCross-links
KnownProviderNames()exported)config.yaml:44-118 providers:section vs CPknownProviderNames)feedback_unified_credentials_file(read-through cache),feedback_proper_robust_ssot_obs_fixes_no_go_ask,feedback_surface_actionable_failure_reason_to_user(audit log is the actionable signal)Do NOT merge before molecule-controlplane#224 lands — the
contracts-drift-checkjob here points at CP main and needs the upstream file to exist first.Phase 2b candidates (queued for after Phase 2a soaks)
Per internal#580 §2 (top-5 concrete drift instances):
deriveProviderFromModelSlug30-case Go switch (molecule-core/workspace-server/internal/handlers/workspace_provision.go:676-766) — the doc-comment at line 673 literally self-flags drift. Promote to consume the sameKnownProviderNames()registry as a Go-side helper. Lowest-friction.WorkspaceConfigdataclass fork (~80-line drift betweenmolecule-core/workspace/config.py:194-356andmolecule-ai-workspace-runtime/molecule_runtime/config.py:194-230) — flagged P0 in RFC §7 for a stand-alone fast-track de-fork RFC before broader contract work.delegate_taskMCP tool defined in 3 mutually-incompatible places with different arg shapes + tool names — needs JSON Schema canonical owner undermolecule-core/workspace/contracts/mcp-tools.yamlper RFC §3 Option C.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
5-axis review on
e66a852:Correctness: REQUEST_CHANGES. This PR introduces the contracts-drift-check as a load-bearing guard for the vendored provider registry, but that exact
CI / Contracts SSOT drift check (pull_request)status is failing on the current head. The aggregate validate/T4 contexts are also red, so the consumer contract is not yet proven in CI.Robustness: The soft audit path and lock-file tests are sensible, but the upstream-vs-vendored parity gate must pass before merge.
Security: No secrets or auth expansion found; fallback on missing vendored registry avoids boot wedging.
Performance: Import-time registry load and one setup audit are negligible.
Readability: The comments explain Phase 2a and the soft-gate clearly. Fix/rerun the failing drift and validate gates.
Cross-author LGTM — implementation is clean and CI-green.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.