Repository navigation
feat(review): bounded read-only GitHub bot-review collector - #1218
hyperpolymath merged 9 commits into
Conversation
…independent verification
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Verified integration evidence for collector branch Scope limits: this is a mocked-API collector regression run, not an authenticated live GitHub collector pilot. The stacked PR base is not |
|
|
Additional semantic boundary to enforce before parity scoring: an admitted inline finding comment represents a successfully posted source event, not proof the entire external review run completed. The v0 adapter supplies |
8ba73d3
into
feat/review-observation-admission-20261123
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d0e9b1139
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| head = get_in(pr, ["head", "sha"]) | ||
| actual_repo = get_in(pr, ["base", "repo", "full_name"]) |
There was a problem hiding this comment.
Return an error for malformed nested PR objects
When GitHub returns a top-level object whose head or base.repo field has an unexpected non-map shape, these get_in/2 calls raise FunctionClauseError or ArgumentError instead of satisfying collect/3's {:error, term()} contract. This bypasses the collector's documented fail-closed handling for unexpected API shapes and crashes callers such as the Mix task; validate each nested value as a map before traversing it.
Useful? React with 👍 / 👎.
| case System.cmd( | ||
| "gh", | ||
| ["api", "--hostname", "github.com", "--method", "GET", path], |
There was a problem hiding this comment.
Bound the gh subprocess runtime
When gh api stalls during network or credential access, System.cmd/3 waits indefinitely, so the page budget cannot make this collector bounded and the Mix task hangs instead of returning its documented unavailable result. The gh api flag list provides no request-timeout option, so run the child under an explicit deadline and terminate it when that deadline expires.
Useful? React with 👍 / 👎.
| # stderr; the failure branch discards it without echoing secrets. | ||
| stderr_to_stdout: true | ||
| ) do | ||
| {body, 0} when byte_size(body) <= @max_response_bytes -> |
There was a problem hiding this comment.
Enforce the response limit while reading output
When an API page is larger than @max_response_bytes, System.cmd/3 has already captured the entire stdout value before this guard runs, so the advertised 4 MB limit only prevents decoding and does not bound memory use. A page containing many large review bodies or diff hunks can therefore allocate well beyond the intended cap; stream into a bounded collector and terminate the child as soon as the limit is exceeded.
Useful? React with 👍 / 👎.
| env: [{"GH_PROMPT_DISABLED", "1"}], | ||
| # Capture error text rather than relaying it into the caller's | ||
| # stderr; the failure branch discards it without echoing secrets. | ||
| stderr_to_stdout: true |
There was a problem hiding this comment.
Keep gh diagnostics out of the JSON stream
When the caller has GH_DEBUG enabled, GitHub CLI emits verbose diagnostics on standard error as documented in gh help environment, but stderr_to_stdout: true merges those diagnostics into the successful JSON response and makes Jason.decode/1 return :invalid_github_api_json for every request. Update-notifier or telemetry messages can corrupt the response for the same reason; capture or suppress stderr separately instead of combining it with stdout.
Useful? React with 👍 / 👎.



Stack relationship and scope
Base:
feat/review-observation-admission-20261123(draft #1216), notmain. This branch depends onHypatia.ReviewObservation.admit/2; do not merge it independently before the base is integrated. Tracked by #1217.Implements the first read-only GitHub collector for external-review observations. It does not trigger paid review, alter branch settings, persist receipts, dispatch any bot or authorise merges.
Contract
Hypatia.ReviewGithubCollector.collect/3fetches PR head, paginated inline review comments and review submissions, then re-reads the head; moving head/failed page/partial pagination => error, never "clean."gh api --method GETwithout shell evaluation. Tests inject a pure API stub (no token needed).APPROVED; no code-review approval becomes a Hypatia merge approval. No comments is not evidence of safety.mix hypatia.review_collect --repo OWNER/REPO --pr NUMBERprints a bounded inspection summary (no raw bot text or JSON receipts).Explicit limitations
Only the GitHub REST bot review-comment/review-submission surfaces are covered. CodeRabbit/Codex issue-comment summaries and quotas require versioned source-specific adapters; pre-commit.ci results need a GitHub check-run adapter. Source bot account identity comes from GitHub API metadata, not a cryptographic claim signature. Existing
ReviewObservationoutput remainsunverified/unqualifiedand is not proof or evidence for learning. No store or I-JSON/JCS canonical output is written here. All unknown/failed cases remain non-authorising.Verification and merging
New branch contents have been compared to parent: six files (two new Elixir modules, one test file, one document, README and CI), no pre-existing code paths rewritten. Tests/format/CI have not yet been verified for this branch. Verify CI, then run a read-only live pilot at a pinned PR head and check API event ID parity before promoting. Keep this a draft and preserve the independent security/CI blockers. Do not merge until parent #1216 accepted and integration checks pass.