Skip to content

fix(opencode): pass trusted visibility into the private free-model hook - #1046

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/bc-9fd846c1-0cf0-4d06-9964-ed9b659612f7-f459
Draft

fix(opencode): pass trusted visibility into the private free-model hook#1046
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/bc-9fd846c1-0cf0-4d06-9964-ed9b659612f7-f459

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Problem

#830 adds a fail-closed trusted-base opt-in so a private repository can use governed opencode-free/* review models only after an unchanged base policy classifies the tree as public_equivalent.

The live runner already knows repository privacy from validate-pr-metadata.outputs.is_private, but #830 never exported that signal as OPENCODE_REPOSITORY_IS_PRIVATE. Public eligibility then depended on a credential-free git ls-remote. A timeout or transport failure would strip the free pool from a public repository and send the run down the private policy path.

The hook contract also asserted only that the runner sourced the hook. It did not execute public catalog filtering, private preconfigured-free removal, or trusted-base re-enable.

Solution

  • Pass OPENCODE_REPOSITORY_IS_PRIVATE from the trusted validate-pr-metadata output into the live model-pool runner.
  • Keep the local unit-test escape that omits both visibility and PR_BASE_SHA, and lock the live workflow so that escape cannot fire in production.
  • Add hook-level contracts for public catalog filtering, private fail-closed stripping, eligible-base prepend, and invalid visibility.
  • Protect .github/opencode-private-free-models.json in CODEOWNERS.
  • Record the visibility wire and control-plane flow in AGENTS.md, ARCHITECTURE.md, CHANGELOG.md, and docs/doctoring/opencode-private-free-model-policy.md (APA 7th).

Next action

Land this successor instead of #830 at f449a8de. After merge, a later PR can add the canonical policy on an authoritatively classified private canary (#833). Do not add the policy file on this PR; a head cannot opt itself in.

Verification

  • python3 -m pytest tests/test_opencode_private_free_model_hook_contract.py tests/test_opencode_private_free_model_policy_1.py tests/test_opencode_private_free_model_policy_2.py tests/test_opencode_private_free_model_policy_3.py tests/test_opencode_provider_guard.py tests/test_opencode_agent_contract.py tests/test_required_workflow_queue_contract.py — 151 passed
  • python3 -m pytest tests/test_opencode_model_pool_runner.py::test_free_provider_runtime_cap_preserves_queue_budget tests/test_opencode_model_pool_runner.py::test_nvidia_nim_combined_budget_preserves_fallback_attempt tests/test_opencode_model_pool_runner.py::test_free_provider_gets_one_bounded_schema_repair_attempt — 3 passed
Open in Web View Automation 

github-actions Bot and others added 2 commits August 17, 2026 00:58
Do not replace the current model-pool implementation. Source a thin
hook that opt-in enables governed anonymous free candidates from an
unchanged trusted-base policy and wraps opencode with a provider
credential guard. Unit tests that pass candidates directly are left
alone unless PR_BASE_SHA or visibility is set.
The live runner already knew repository privacy from validated PR
metadata but never exported it, so public eligibility depended on a
credential-free ls-remote. Wire that signal, lock CODEOWNERS on the
policy path, and add hook-level public/private candidate contracts.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant