Skip to content

fix: verify Noema GitHub App identity - #1480

Merged
seonghobae merged 2 commits into
mainfrom
docs/noema-independent-runtime-proof
Aug 31, 2026
Merged

fix: verify Noema GitHub App identity#1480
seonghobae merged 2 commits into
mainfrom
docs/noema-independent-runtime-proof

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • verify installation-token reviewer identity via the GitHub /installation app slug when /user is unavailable
  • retain fail-closed empty identity behavior
  • document the independent Noema review contract

Runtime evidence

The first post-merge independent run reached the LLM review step without OpenCode approval and failed closed because a GitHub App installation token cannot resolve /user. This patch uses the installation identity returned by GitHub itself.

Verification

  • focused Noema/workflow tests: 34 passed
  • actor fallback branch plus related Noema coverage tests: 47 passed

Acceptance still requires an actual current-head Noema review body.

Signed-off-by: Seongho Bae <me@seonghobae.me>
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 58 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7bb8585d-b799-4b87-adec-5c8730e4895a

📥 Commits

Reviewing files that changed from the base of the PR and between a643d8a and eebaa06.

📒 Files selected for processing (3)
  • docs/doctoring/noema-orchestrator-free-zdr.md
  • scripts/ci/noema_review_gate.py
  • tests/test_noema_review_gate.py

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 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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae seonghobae changed the title docs: record independent Noema review contract fix: verify Noema GitHub App identity Aug 31, 2026
@seonghobae
seonghobae merged commit 71633cd into main Aug 31, 2026
42 of 44 checks passed
@seonghobae
seonghobae deleted the docs/noema-independent-runtime-proof branch August 31, 2026 05:45
seonghobae pushed a commit that referenced this pull request Aug 31, 2026
… cap no-op bug

Rebases this branch onto main's provider_account/account_cap rename (#1468)
and Noema-independence work (#1477/#1480), then fixes a real bug this
branch's own batched-preflight merge introduced: _catalog_family_cap()
defaulted to REVIEW_PREFLIGHT_MAX_TOTAL_ROUTES (24) whenever
ORCHESTRATOR_CATALOG_FAMILY_CAP was unset, silently disabling per-account
diversification. Live production evidence: probed_count 12, ready_count 2,
rejected_count 10 (83% rejected via 429/404/timeout), with the admitted
free-pool catalog 100% nvidia_nim/nvidia_nim_sub -- two credentials sharing
one rate-limited upstream jointly occupying the entire 12-slot preflight
batch. Reported at
#1415 (comment)

Fix (mirrors the pattern in open main PR #1487's diff, not yet merged):
renamed the helper to _catalog_account_cap(default), which now requires the
caller to supply contextual_orchestrator_review_policy.DEFAULT_ACCOUNT_CAP
(4) as the default instead of hand-typing/defaulting to a total-routes-scale
constant. An explicit ORCHESTRATOR_CATALOG_ACCOUNT_CAP override remains
honored. The sidecar shell script's equivalent CATALOG_FAMILY_CAP default
(also baked to the total 24-route budget) is renamed to CATALOG_ACCOUNT_CAP
and restored to a real, smaller cap (8, main's existing operational value).

Also corrects CHANGELOG.md and docs/adr/0003 prose that had described the
no-op 24-route cap as an intentional fix, and updates two contract tests
(test_contextual_orchestrator_review_runtime_preflight.py,
test_contextual_orchestrator_review_sidecar_contract.py) that pinned the old
family_cap naming and the buggy default.

Verification: coverage run -m pytest tests -> 2122 passed, 1 skipped, 21
subtests; coverage report -> 100% on scripts/ci; interrogate -> 100%
docstrings; bash -n on the touched shell script; git diff --check clean.
Red-then-green: reverting _catalog_account_cap's default back to
REVIEW_PREFLIGHT_MAX_TOTAL_ROUTES makes the new regression tests fail;
restoring the fix makes them pass again.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPmJErfkcHer4UVEgrQxUX
seonghobae pushed a commit that referenced this pull request Aug 31, 2026
Devin's follow-up review of PR #1500 found a real remaining gap: the
whole-line MULTILINE anchor on NOEMA_BODY_HEAD_RE narrowed the collision
surface from "anywhere in the body" to "any full line before the end
marker" — but that still lets LLM-generated summary/findings text spoof a
rejection if it happens to contain a complete, correctly-formatted
standalone "- Head SHA: `<sha>`" line of its own (plausible in exactly the
self-referential scenario that makes the underlying bug likely: Noema
discussing or quoting this exact review-body format).

A content pattern can never fully close this off, since nothing stops the
LLM's own unsanitized text from reproducing any fixed string. So instead of
tightening the pattern further, submit_review() now wraps the start of its
fixed-format footer in a second, purpose-specific HTML marker
(NOEMA_REVIEW_FOOTER_MARKER) that — like the existing closing
"noema-review-gate head_sha=..." comment — only submit_review() itself ever
emits. noema_review_state() (via the new _isolate_trusted_footer() helper)
now isolates the footer by *position*: the span strictly between that
footer-start marker and the closing marker, both machine-emitted and never
reachable by the LLM's own generated text. Only that trusted span is
searched for the "- Head SHA:" bullet, so no amount of LLM text anywhere
else in the body — mid-sentence or a complete standalone bullet, a
different SHA or the same one — can ever count. The MULTILINE whole-line
anchor is kept as defense-in-depth inside that now-trusted span.

The dual-binding property #1480/#1483 introduced is unchanged: the marker
comment and the human-readable bullet must still independently agree with
the live head, exactly as before.

Extended the regression tests: the existing mid-sentence-prose case is
updated for the new required footer marker, and a new parametrized test
(test_noema_state_ignores_standalone_body_head_bullet_before_footer) proves
a complete standalone bullet line before the real footer — the exact case
Devin flagged, both a different SHA and the same SHA — no longer causes a
false rejection. The negative-control tests (missing/stale/duplicate/
conflicting bindings) are extended to exercise those failure modes from
inside the new trusted footer span and still correctly reject.

Also updates the two other hand-rolled Noema review body fixtures
(test_repository_branch_coverage_review_schedulers.py) to include the new
footer marker so they keep testing the intended happy path rather than
incidentally exercising the new fail-closed missing-marker case.

Full suite (2122 tests) passes; 100% coverage and 100% docstrings on
scripts/ci/ maintained.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant