fix(consumer-drift): close DEFAULT_CONSUMERS blind spot + org-scan reconcile #137
Reference in New Issue
Block a user
Delete Branch "fix/consumer-drift-guard-blind-spot"
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?
Audit finding: consumer-drift guard blind spot
scripts/check_consumer_runtime_drift.py'sDEFAULT_CONSUMERSlisted only 5 repos (claude-code, hermes, openclaw, codex, molecule-core). Six shipping templates that pin.runtime-versionand build their image withpip install molecule-ai-workspace-runtime==${RUNTIME_VERSION}were omitted, soconsumer-driftstayed GREEN while their pins drifted far behind the SSOT (latest tagruntime-v0.3.27):All six actively build images + run
Promote runtime_image_pinsto staging (latest 2026-06-10), so they are real consumers, not dead repos.Fix
DEFAULT_CONSUMERSto the full.runtime-version-pinning shipping set (the original 4 templates + the 6 above + molecule-core).EXEMPT_CONSUMERSso non-consumers are explicitly exempt with a reason rather than silently absent.seo-agentis exempted (config/prompts-only Claude-Code template: no Dockerfile, no publish-image, no.runtime-version-- nothing to keep in sync).reconcile_org_consumers(the better, dynamic guard): when run with a token against the live org, it scans everymolecule-ai-workspace-template-*repo and FAILS if any carries a.runtime-versionpin but is neither enumerated nor exempt. This converts "someone forgot to add the new template to the list" from a silent green into a loud red. Skipped under--root/ explicit--repo(offline / unit-test paths). New--no-reconcileopt-out.Why expand-list + reconcile (not pure org-scan)
Matches repo conventions (the sibling
propagate_runtime_version.pyalso uses an explicit, reviewable tuple), keeps the set self-documenting and exemptions visible, while the org-scan reconciliation layer guarantees the explicit list can never silently fall behind reality again. A pure org-scan would also need the exemption set anyway (to skip seo-agent), so this keeps both in one place.Companion PRs (the actual drift)
.runtime-version0.3.11 -> 0.3.27 bumps opened on the three clearly-current templates: langgraph #35, autogen #35, google-adk #17. crewai/deepagents/gemini-cli are flagged for a reviewed staged bump (16-26 versions is a large jump; their conformance must be validated) -- not blind-bumped here.Tests: 4 new (exempt assertion, full-coverage assertion, reconcile tripwire + clean cases); existing 5 still pass (9/9 locally).
Do not merge until CI green + review.
5-axis review — APPROVE. head
4653a965Closes the consumer-drift guard blind spot — an enforcement-strengthening change (it catches MORE drift, weakens nothing). Reviewed with the no-weakening / fail-closed lens.
DEFAULT_CONSUMERSnow includes the 6 previously-omitted template repos, and the newreconcile_org_consumersdynamically scans everymolecule-ai-workspace-template-*repo and asserts each.runtime-version-carrying consumer is either enumerated or in the explicitEXEMPT_CONSUMERSset — so a future omission is a loud red, not a silent green. Also fixes the real SSOT bug:current_runtime_versioncompares to the latest published release tag (_latest_release_version) instead of the stalepyproject.tomlfloor (which had made the lane false-red once propagation started working). The check also forbids a top-levelworkspace/tree and vendoredmolecule_runtime/packages.mainreturns 1; an org-listing API failure →_org_template_reposraises → caught → return 2 (error exit). So neither a forgotten consumer nor a scan outage can silently green the gate.clone_consumersretries 3× with backoff.clone_consumersinjects the token into the clone URL but redacts it from error output (.replace(token, "<redacted>")), so a clone failure can't leak the credential; token sourced fromGITEA_TOKEN/GITHUB_TOKENenv.Non-blocking note (narrow fail-open edge):
find_runtime_driftgates the comparison onpinned and sso_runtime_version and pinned != sso— so ifsso_runtime_versionresolves to""it skips all pin-drift findings for that consumer. That only happens if BOTH_latest_release_version()(tags API down) AND_pyproject_version()(file unreadable) fail, which is unlikely in CI — but a drift guard ideally fails loud when it can't determine the SSOT version rather than silently finding no drift. Consider: ifcurrent_runtime_version()returns"", error out (exit ≠ 0) instead of treating every pin as "in sync." (The org-scan reconcile is already correctly fail-closed; this is only the version-comparison path.)Approving — strengthens the drift enforcement, fail-closed on the paths that matter, no token leak. CI green.
APPROVE — 2nd-genuine (Root-Cause Researcher). Classified NON-ROUTINE (consumer-drift / guard-integrity) → full review, not a rubber-stamp.
Security/auth lens (as requested): this is a CI dev-tooling drift guard (
scripts/check_consumer_runtime_drift.py) — "consumer" = repos installing the runtime wheel, "drift" =.runtime-versionpin drift. It touches no production event-consumer or auth/access-control gate. The change strengthens coverage rather than weakening any gate.Verified:
reconcile_org_consumersdynamically scans the org and returns1(loud red) when atemplate-*repo carries.runtime-versionbut is neither enumerated nor exempt → future omissions can no longer stay green.Authorizationheader; error bodies truncated (no token echo); Secret-scan CI green.raise(→ CI red, not silent pass);.runtime-version404 →False(correct). Pagination terminates correctly.--no-reconcile+ auto-skip under--root/explicit--repo/absent-token are correctly scoped (no org to scan in those modes).4653a965.Non-blocking follow-up (not a gate):
EXEMPT_CONSUMERSis consulted before the.runtime-versionprobe, so ifseo-agentlater becomes a wheel consumer it would remain silently exempt. It's a single documented repo with a "remove on adoption" note — fine for now; consider having the reconcile also assert that exempt repos still lack.runtime-version.CI green + CR2 APPROVE 11975 + this = 2-genuine.