fix(opencode): fail closed when visibility and base SHA are missing - #1055
Draft
cursor[bot] wants to merge 3 commits into
Draft
fix(opencode): fail closed when visibility and base SHA are missing#1055cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 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.
Export validate-pr-metadata is_private as OPENCODE_REPOSITORY_IS_PRIVATE next to PR_BASE_SHA so public reviews keep the governed free catalog without a credential-free ls-remote probe. Keep ls-remote as fallback only when that trusted signal is absent. Add hook-level visibility contracts and pin the updated review-dispatch blob.
Strip preconfigured opencode-free aliases when both trusted visibility and the PR base SHA are absent, and never forward COPILOT_GITHUB_TOKEN into an OpenCode child process. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
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 and RCA
#830 at
943b8040now exports trustedOPENCODE_REPOSITORY_IS_PRIVATEinto the live model pool. That closes the public-pathls-remotegap, but two source defects remain:apply_private_free_model_policystill returns early when both visibility andPR_BASE_SHAare unset, keeping every preconfiguredopencode-free/*alias. A missing production export is therefore fail-open. The comment called this a unit-test convenience.GH_TOKENandGITHUB_TOKENbut still forwardsCOPILOT_GITHUB_TOKENto anonymous and keyed OpenCode children.Solution
OPENCODE_REPOSITORY_IS_PRIVATE=falseor a successful public probe keeps the governed catalog.COPILOT_GITHUB_TOKENfor every OpenCode child process.OPENCODE_REPOSITORY_IS_PRIVATE=falseinstead of relying on the exemption.Next action
Prefer this branch over #830 at
943b8040and over #1046 for the same slice. After merge, keep #833 as the operational canary. Do not add.github/opencode-private-free-models.jsonon the same pull request that introduces the checker.Sources
Joint Task Force. (2020). Security and privacy controls for information systems and organizations (NIST SP 800-53 Rev. 5). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-53r5