fix(opencode): pass trusted visibility into the private free-model hook - #1046
Draft
cursor[bot] wants to merge 2 commits into
Draft
fix(opencode): pass trusted visibility into the private free-model hook#1046cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
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>
This was referenced Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 aspublic_equivalent.The live runner already knows repository privacy from
validate-pr-metadata.outputs.is_private, but #830 never exported that signal asOPENCODE_REPOSITORY_IS_PRIVATE. Public eligibility then depended on a credential-freegit 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
OPENCODE_REPOSITORY_IS_PRIVATEfrom the trustedvalidate-pr-metadataoutput into the live model-pool runner.PR_BASE_SHA, and lock the live workflow so that escape cannot fire in production..github/opencode-private-free-models.jsonin CODEOWNERS.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 passedpython3 -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