Skip to content

fix(opencode): use same-repo status credential - #1227

Merged
seonghobae merged 13 commits into
mainfrom
fix/opencode-same-repo-status-token
Sep 1, 2026
Merged

fix(opencode): use same-repo status credential#1227
seonghobae merged 13 commits into
mainfrom
fix/opencode-same-repo-status-token

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Outcome

Use the job-scoped github.token for OpenCode commit-status publication when the repository_dispatch target is the central .github repository. Cross-repository targets retain the existing PAT/App credential chain.

Root cause

Run 32560612401 declared statuses: write but selected the separate OpenCode App token for a same-repository POST /statuses/{sha}; GitHub returned HTTP 403 because that installation token did not have commit-status write permission.

Verification

  • TDD contract reproduced the old credential ordering before the workflow change
  • 1,350 passed, 1 skipped, 16 subtests passed
  • 100% statements and branches: 8,318 statements, 3,208 branches
  • Production docstrings: 740/740
  • test_strix_quick_gate: PASS
  • Compilation, bash syntax, and diff checks: PASS
  • Doctoring includes APA 7th references to current official GitHub token and App-permission documentation

No new credential, permission, retry, or fallback path is introduced.


Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 70502345-94bf-40f6-9bd9-08cfb1a74dfe


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae seonghobae added the bug Something isn't working label Aug 22, 2026 — with ChatGPT Codex Connector
@opencode-agent opencode-agent Bot added merge: urgent-review Central or critical pull request requiring immediate review attention priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks type: bug Defect or incorrect behavior labels Aug 22, 2026
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@opencode-agent opencode-agent Bot added priority: critical Immediate blocker, P0, urgent deadlock, or critical incident status: needs-update Pull-request branch is behind its current base and removed priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks labels Aug 22, 2026
…s credential

Resolve CHANGELOG and the opencode-review-dispatch blob pin after a
normal merge of origin/main. The job-scoped github.token same-repo
status path remains the PR change; the dispatch workflow pin now
matches the merged blob SHA.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review current-head review for 5974bee1c2f0ae4b7a2f6a5e4f8e7a1c9f3b2d4e.

Wait — re-read live SHA. This comment is for the merge commit that lands origin/main into #1227 without dropping the same-repo github.token status path. Independent current-head approval is required; the inventory SHA is not merge authorization.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review current-head review for 5974bee1dbc2f28b33f69f1aab08066bdedaab70.

Normal merge of origin/main resolved CHANGELOG and the opencode-review-dispatch.yml blob pin. The same-repo github.token status publication path is preserved. Previous comment SHA was not the live head — use this exact 40-character SHA. Not merge authorization.

seonghobae added a commit that referenced this pull request Aug 23, 2026
Refresh the SHA-bound snapshot after #1258-#1261 opened and #1257/#1227
heads advanced. The inventory remains a snapshot, not merge authorization.
@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review current-head review for 5974bee1dbc2f28b33f69f1aab08066bdedaab70.

Same-repo github.token status path after merging current main. Independent current-head approval is required; BLOCKED/MERGEABLE metadata is not merge authorization.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Independent current-head review request for exact HEAD 5974bee1dbc2f28b33f69f1aab08066bdedaab70.

Gap G-03: required Strix still fail-closes 0-vuln complete scans on MODEL QUALITY WARNING and openai-direct/ LiteLLM LLM Provider NOT provided until #1263 (b05edc069cba461ad1d641ce8809027ad909c14b) is independently approved and merged. Predecessor-head reviews are not merge evidence. Do not self-approve. COPILOT_GITHUB_TOKEN is not used.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 5974bee1dbc2f28b33f69f1aab08066bdedaab70.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review-dispatch.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review-dispatch.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file: CHANGELOG.md"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file: CHANGELOG.md"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: opencode-same-repository-status-credential.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: opencode-same-repository-status-credential.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["Test (2 files)"]
  S4 --> I4["regression suite"]
  I4 --> R4["Review risk: Test (2 files)"]
  R4 --> V4["targeted test run"]
Loading

@opencode-agent

opencode-agent Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 5974bee1dbc2f28b33f69f1aab08066bdedaab70
  • Workflow run: 32647397409
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 5974bee1dbc2f28b33f69f1aab08066bdedaab70.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review-dispatch.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review-dispatch.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file: CHANGELOG.md"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file: CHANGELOG.md"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: opencode-same-repository-status-credential.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: opencode-same-repository-status-credential.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["Test (2 files)"]
  S4 --> I4["regression suite"]
  I4 --> R4["Review risk: Test (2 files)"]
  R4 --> V4["targeted test run"]
Loading

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 5974bee1dbc2f28b33f69f1aab08066bdedaab70.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review-dispatch.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review-dispatch.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file: CHANGELOG.md"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file: CHANGELOG.md"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: opencode-same-repository-status-credential.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: opencode-same-repository-status-credential.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["Test (2 files)"]
  S4 --> I4["regression suite"]
  I4 --> R4["Review risk: Test (2 files)"]
  R4 --> V4["targeted test run"]
Loading

seonghobae added a commit that referenced this pull request Aug 23, 2026
Record GitHub CLEAN #1265 as snapshot metadata, not merge
authorization, and keep #1162/#1227/#1215 as BEHIND after #1252.
seonghobae added a commit that referenced this pull request Aug 24, 2026
* docs: refresh gap baseline after #1252 merged to main

Bind the live 95-PR inventory to protected main
9f8f840. The SHA table is a snapshot,
not merge authorization.

* docs: align G-02 with BEHIND inventory and bind 99 live PRs

Record GitHub CLEAN #1265 as snapshot metadata, not merge
authorization, and keep #1162/#1227/#1215 as BEHIND after #1252.

* docs: bind live 98-PR inventory while #1265 waits for OpenCode

Keep GitHub CLEAN #1265 as snapshot metadata, not merge
authorization, and record that required Strix CRs remain G-03.

* docs: correct live PR 1263 head evidence
claude added 2 commits August 30, 2026 09:54
…o-status-token

# Conflicts:
#	CHANGELOG.md
#	tests/test_pr_review_autofix_nvidia_nim_contract.py

Copy link
Copy Markdown
Contributor Author

Resolved the stale merge conflict against current main (this branch was already merged with main once at dc2ed58f/head 1a197fe0, but main has moved on to 1d8e872 since then, reopening mergeable_state: dirty).

1 conflicting file — purely mechanical, a pinned-blob-hash test constant:

  • tests/test_pr_review_autofix_nvidia_nim_contract.py: REVIEW_DISPATCH_BLOB_SHA pins the exact git blob hash of .github/workflows/opencode-review-dispatch.yml as a byte-for-byte trust-boundary check (both HEAD and main had bumped it to their own respective post-merge blob hash for that file). opencode-review-dispatch.yml itself and CHANGELOG.md both auto-merged cleanly — the PR's core same-repository github.token status-publication logic (GH_TOKEN: ${{ needs.validate-pr-metadata.outputs.target_repository == github.repository && github.token || ... }} and the matching OPENCODE_STATUS_TOKEN_SOURCE) is untouched and intact. Recomputed git hash-object on the actually-merged file (7ba32d1c1c59a3e3a64f99302d53cb16b684177c) and used that instead of either side's stale recorded value.

Verified the merge is otherwise a clean fast-forward-style catch-up: git merge-base <new-head> <main-tip> equals main's tip exactly, and the only files differing from main are this PR's own five files (opencode-review-dispatch.yml, CHANGELOG.md, the new docs/doctoring/opencode-same-repository-status-credential.md, and the two touched test files).

Test evidence (worktree, head c9599573):

  • PYTHONPATH=. python3 -m pytest tests/test_opencode_agent_contract.py tests/test_pr_review_autofix_nvidia_nim_contract.py tests/test_opencode_rust_coverage_toolchain_contract.py -q → 85 passed, 1 skipped
  • PYTHONPATH=. python3 -m pytest tests -q (full suite) → 1897 passed, 1 skipped, 21 subtests
  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/opencode-review-dispatch.yml'))" → OK
  • No scripts/ci/** or .sh files are touched by this PR's diff vs. main, so the 100%-coverage/100%-docstring gate and bash -n are not applicable here

Note on mechanics: the previous manual merge left this branch mid-merge in an unusual worktree state (branch-ref switch during an in-progress merge discarded MERGE_HEAD/MERGE_MSG before the commit was made); I recovered by manually constructing the merge commit with git commit-tree against the already-resolved, already-staged tree with parents 1a197fe0 (this branch's prior head) and 1d8e8724 (current main tip) — verified identical to running git merge --no-edit and committing normally, and confirmed the working tree matched the index exactly before doing so. Pushed as merge commit c9599573 onto fix/opencode-same-repo-status-token (no rebase/force-push). Ready for fresh exact-head review.


Generated by Claude Code

seonghobae added a commit that referenced this pull request Sep 1, 2026
…tern (#1499)

Bypass-merged per explicit owner authorization: opencode-review is blocked by a pre-existing, org-wide opencode-app credential 403 (fix pending in #1227) and an org-wide Actions queue backlog, neither caused by this PR's diff. Fully validated locally: test_strix_quick_gate PASS, coverage run -m pytest tests 2126 passed/1 skipped, 100% coverage, 100% docstrings.

Copy link
Copy Markdown
Contributor Author

@claude Please refresh this root-cause fix non-destructively onto current protected main@2436454e3a969a282b5edc7303a485ccd37c3e9f. Do not force-push or discard the 49 commits of central governance evolution since this branch diverged. The unique product/control-plane intent remains valid and current main explicitly names #1227 as the pending fix for the org-wide OpenCode App commit-status 403: when repository_dispatch targets ContextualWisdomLab/.github itself, exact-head status publication must use job-scoped github.token (the job already declares statuses: write); cross-repository targets retain the reviewed PAT/App credential chain. Merge current main into fix/opencode-same-repo-status-token, reconcile the now-expanded opencode-review-dispatch.yml by intent rather than old line positions, update the current contract tests/doctoring/CHANGELOG without reverting later OIDC, wake, required-verdict, sidecar, model-pool, security, or timeout work, and run the focused OpenCode contract tests plus the repository's current coverage/docstring gates. Preserve ordinary protected merge flow and report the resulting exact head; no self-approval, administrative bypass, stale evidence transfer, or gate weakening.

…o-status-token

# Conflicts:
#	CHANGELOG.md
#	tests/test_pr_review_autofix_nvidia_nim_contract.py
The merge conflict resolution left a placeholder in REVIEW_DISPATCH_BLOB_SHA
pending a fresh git hash-object of the merged opencode-review-dispatch.yml
(neither side's pinned value was still correct once both changes combined).
Filled in with the actual post-merge blob hash.

Copy link
Copy Markdown
Contributor Author

Refreshed non-destructively as requested — no force-push, all 49 commits of central governance evolution since divergence preserved via a real merge (95e93f56), not a rebase.

What happened

Merged current protected main@2436454e into fix/opencode-same-repo-status-token. Only two files had real conflicts (both additive, resolved by keeping both sides):

  • CHANGELOG.md — this branch's ### Fixed entry alongside main's newer entries in the same section.
  • tests/test_pr_review_autofix_nvidia_nim_contract.py — the REVIEW_DISPATCH_BLOB_SHA pin; neither side's value was still correct once both changes combined, so recomputed it fresh via git hash-object on the merged workflow file (3395548c49d6880de216db56297b510cf9e896f3), then confirmed the assertion.

.github/workflows/opencode-review-dispatch.yml itself — the "now-expanded" file you flagged — auto-merged cleanly by content, reconciling by intent rather than needing manual line-position surgery: this branch's same-repo github.token fix at the "Publish repository_dispatch OpenCode status" step (OPENCODE_STATUS_TOKEN_SOURCE) combined without conflict with main's independent application of the identical same-repo-credential pattern to two other token sites in the same file (WAKE_TOKEN_SOURCE, SCHEDULER_READ_TOKEN) that had landed separately since this branch diverged. Confirmed #1227's own specific fix — the commit-status-publishing step — was not among those already-fixed sites, so this PR remains non-redundant and still the one place closing the exact #1227 gap.

tests/test_opencode_agent_contract.py (the direct contract assertion for this fix) also auto-merged cleanly with no manual reconciliation needed.

Verification on the new head (b910a152)

  • coverage run -m pytest tests: 2203 passed, 1 skipped, 21 subtests
  • coverage report --show-missing: 100% statements/branches on scripts/ci/
  • interrogate: 100% docstrings
  • Targeted: test_opencode_agent_contract.py, test_pr_review_autofix_nvidia_nim_contract.py, test_opencode_rust_coverage_toolchain_contract.py — 86 passed, 1 skipped
  • bash scripts/ci/test_strix_quick_gate.shPASS
  • YAML syntax on all 5 touched workflow files: OK
  • bash -n on all 3 touched shell scripts: OK
  • git diff --check: clean

Neither self-approved nor bypassed — left for the ordinary protected-branch review/merge flow. mergeable_state briefly showed behind right after the push; confirmed locally that main@2436454e is a direct ancestor of b910a152 (git merge-base --is-ancestor — clean merge), so that should resolve once GitHub recomputes.


Generated by Claude Code

claude and others added 4 commits September 1, 2026 08:38
…o-status-token

# Conflicts:
#	tests/test_pr_review_autofix_nvidia_nim_contract.py
Protected main regressed to 99% scripts/ci coverage after #1546 added
live_head_matches, a no-active/no-stale fall-through in
prepare_autofix_slot, and an "already queued or running" wait branch
to pr_review_fix_scheduler.py without covering them, while the
pre-existing inspect_pr conflicted-draft/conflicted-unauthorized
returns and pr_review_merge_scheduler.py's
fetch_workflow_names_by_check_suite_rest pagination/filtering/
permission-denied paths stayed untested. Every PR rebasing onto main
inherits this via the coverage-evidence required check regardless of
its own diff. Test-only change; no production code touched.

(cherry picked from commit db106d5)
Raise scoped docstring coverage for the newly added scheduler REST regression helpers to 100% without changing test behavior or production code.

(cherry picked from commit 6f40a06)
RCA: the #1567 exact-head Hourly NVIDIA NIM Review Repair run failed in test_scheduler_wake_reuses_trusted_receipt_predicate with exit 141. The production block pipes jq JSON into gh api --input -, while the test fake exited without reading stdin. Under pipefail that can SIGPIPE jq. Reuse the already RED/GREEN-verified #1569 fixture blob and drain stdin before recording the fake dispatch. This makes #1567 self-contained so the central 100% coverage repair no longer depends on a separate PR that itself inherits the coverage failure.
(cherry picked from commit 6948175)

Copy link
Copy Markdown
Contributor Author

Resolved the merge conflict against current main (5686de41 → now includes #1546 and later): merged base into this branch with a normal merge commit, resolving a single conflict in tests/test_pr_review_autofix_nvidia_nim_contract.py::REVIEW_DISPATCH_BLOB_SHA — neither side's pinned blob SHA matched the merged opencode-review-dispatch.yml content, so recomputed it with git hash-object against the actual merged file.

That merge inherited the same pre-existing, org-wide scripts/ci coverage regression from #1546 documented in (not-yet-merged) #1567: pr_review_fix_scheduler.py 97%, pr_review_merge_scheduler.py 99%. Ported #1567's exact test-only fix commits (db106d50, 6f40a063, 69481751 — the last also closing the scheduler-wake SIGPIPE flake) rather than reinventing them; this application is a no-op once main carries an equivalent fix.

Verification on the new head (933cf53c):

PYTHONPATH=. coverage run -m pytest tests -q   # 2251 passed, 1 skipped, 21 subtests
coverage report                                 # TOTAL 100%
interrogate                                     # 100.0%

This PR's own scope (2-line same-repo status token credential precedence fix + tests/changelog/doctoring) is unchanged.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Resolved another merge conflict against current main (now 035269a7, through merged #1586): merged base into this branch with a normal merge commit, resolving one CHANGELOG.md conflict (both sides added independent Unreleased entries — kept both).

Main now already carries the scripts/ci coverage fix directly (no port needed this time, unlike the previous round).

Verification on the new head (cb3fc86d):

PYTHONPATH=. coverage run -m pytest tests -q   # 2268 passed, 1 skipped, 21 subtests
coverage report                                 # TOTAL 100%
interrogate                                     # 100.0%

This PR's own scope (2-line same-repo status token credential precedence fix) is unchanged.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (035269a794ca3077, covering through fc335f84) — the branch had gone stale after ~80 commits landed on main since its last update, which is what GitHub's dirty mergeable_state reflected. The merge itself was clean apart from CHANGELOG.md (the routine two-independent-## [Unreleased]-entries conflict, resolved by keeping both); every other file — including the several .github/workflows/*.yml, scripts/ci/*.py, and doc files main had moved on since — merged automatically with no conflicts.

Verified on the merged head: coverage run -m pytest tests → 2350 passed, 1 skipped, 21 subtests; coverage report → 100%; interrogate → 100%; test_opencode_workflow_shell_syntax.py and bash -n scripts/ci/test_strix_quick_gate.sh → clean; git diff --check → clean. This PR's own change (same-repo github.token for OpenCode commit-status publication) is otherwise untouched by the rebase.


Generated by Claude Code

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment thread .github/workflows/opencode-review-dispatch.yml
@seonghobae
seonghobae dismissed stale reviews from opencode-agent[bot] and opencode-agent[bot] September 1, 2026 14:32

Stale infrastructure-only review evidence: this review is bound to predecessor head 5974bee and cites only a failed Strix infrastructure check. The live PR head is 5c7eb11; no source/security finding is stated in the review body. Retiring it without converting it to approval so current-head review/check evidence can govern.

@seonghobae
seonghobae merged commit aa150dd into main Sep 1, 2026
27 of 46 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in naruon Platform Roadmap Sep 1, 2026
@seonghobae
seonghobae deleted the fix/opencode-same-repo-status-token branch September 1, 2026 14:32
seonghobae pushed a commit that referenced this pull request Sep 1, 2026
Bring the mention-router PR current with main (advanced via #1227,
#1617, and other independently merged fixes) so its stalled/queued
checks re-run against an up-to-date head instead of a stale one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPmJErfkcHer4UVEgrQxUX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working merge: urgent-review Central or critical pull request requiring immediate review attention priority: critical Immediate blocker, P0, urgent deadlock, or critical incident status: needs-update Pull-request branch is behind its current base type: bug Defect or incorrect behavior

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants