Skip to content

fix(opencode): fail closed when visibility and base SHA are missing - #1055

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-febdf43e-f318-4e67-ba61-f79492055f8a-804d
Draft

fix(opencode): fail closed when visibility and base SHA are missing#1055
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-febdf43e-f318-4e67-ba61-f79492055f8a-804d

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Problem and RCA

#830 at 943b8040 now exports trusted OPENCODE_REPOSITORY_IS_PRIVATE into the live model pool. That closes the public-path ls-remote gap, but two source defects remain:

  1. apply_private_free_model_policy still returns early when both visibility and PR_BASE_SHA are unset, keeping every preconfigured opencode-free/* alias. A missing production export is therefore fail-open. The comment called this a unit-test convenience.
  2. The provider guard unsets GH_TOKEN and GITHUB_TOKEN but still forwards COPILOT_GITHUB_TOKEN to anonymous and keyed OpenCode children.

Solution

  • Evaluate the private free-model policy on every hook invocation. Missing visibility and missing base SHA strip anonymous aliases; only OPENCODE_REPOSITORY_IS_PRIVATE=false or a successful public probe keeps the governed catalog.
  • Unset COPILOT_GITHUB_TOKEN for every OpenCode child process.
  • Local model-pool fixtures that need the public catalog now set OPENCODE_REPOSITORY_IS_PRIVATE=false instead of relying on the exemption.

Next action

Prefer this branch over #830 at 943b8040 and over #1046 for the same slice. After merge, keep #833 as the operational canary. Do not add .github/opencode-private-free-models.json on 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

Open in Web View Automation 

github-actions Bot and others added 3 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.
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>
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