Skip to content

feat(agents): add a Gator review team, GitHub App identity, and a review replay harness - #5779

Open
johntmyers wants to merge 12 commits into
mainfrom
feat/5778-gator-review-team/johntmyers
Open

johntmyers wants to merge 12 commits into
mainfrom
feat/5778-gator-review-team/johntmyers

Conversation

@johntmyers

@johntmyers johntmyers commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Gator can run a single reviewer or a generalist with budgeted specialist consults, and can act as the operator or the gator-review-bot GitHub App. The defaults remain single reviewer and user identity.

Related Issue

Closes #5778

Run Gator

Use the launch-openshell-gator skill, or run the launcher from a checkout of this branch. The reviewer and GitHub identity are independent options.

Option Values Default
reviewer single runs only the generalist; team lets the generalist consult specialists when useful. single
specialist_budget Maximum distinct specialists per team review. 0 skips consults; any or -1 allows every eligible specialist. 1
github user uses the operator’s gh auth token; app uses the GitHub App and a repository-scoped installation token. user

Default reviewer and identity:

./.agents/agents/gator/run.sh --gateway docker-dev --watch \
  'Review and monitor PR #1234 through the gator-gate workflow.'

Team review with up to two specialists, using the App:

GATOR_GITHUB_APP_PRIVATE_KEY_FILE=/secure/path/gator-review-bot.pem \
  ./.agents/agents/gator/run.sh --gateway docker-dev --watch \
  --option reviewer=team --option specialist_budget=2 --option github=app \
  'Review and monitor PR #1234 through the gator-gate workflow.'

For Kubernetes image delivery or a prebuilt image, see the Gator README. Use --once for one reconciliation cycle. To give OK to test, explicitly authorize relevant test labels and approval of current-head GitHub Actions runs in the assignment. PRs changing .github/ still require manual workflow approval.

Changes

  • Selective team review. The generalist reviews first and can ask a specialist a concrete question or request broader coverage of a sensitive change. Each consult gets selected changed paths, and multiple consults run in parallel. Gator validates and combines the findings into one PR review, whose collapsed metadata records the specialists that ran. The budget is a cap, not a target or token limit. It is separate from the three-round budget for posting new Warnings.
  • GitHub identity and approvals. User mode attributes review activity to the operator and does not approve PRs. App mode uses a gateway-minted token scoped to ai-openshell/openshell. The App installation needs GitHub Contents and Pull requests write permissions to resolve fixed threads; the sandbox policy keeps push and merge routes closed. For an eligible maintainer PR, Gator can submit a separate current-head approval after review and CI. The required OpenShell / Maintainer Approval check from ci: accept Gator approvals for maintainer-authored PRs #6113 verifies the bot, current head, maintainer author, and verified maintainer commits. Required CI and CODEOWNER gates still apply; the author decides whether to merge.
  • Follow-up review. Reviewers verify fixes for unresolved findings and flag regressions introduced by those fixes. After the Warning budget is exhausted, new Warnings surfaced in critical-only review are held for a maintainer decision. A GitHub thread-resolution denial waits for human action without repeatedly reviewing the same head.
  • Replay. The replay harness tests pinned historical PRs in isolated sandboxes and reports recall, extra findings, elapsed time, and tokens. Use the default for single review, --team --specialist-budget N for selective consults, or --full-team for the original parallel roster.
  • Runtime. The default reviewer model is gpt-6.2-sol. Runtime options do not require different tooling images. The launcher reuses gateway-managed credential refresh state. Relaunch older immutable watchers for payload 19.

Testing

  • mise run test:gator, Python format/lint/type checks, and the 47 maintainer approval tests.
  • Live App team reviews: #6074 consulted security, and #6080 consulted contracts. Both recorded the consult in review metadata.
  • Live App thread resolution on #6107 and a separate current-head App approval on #6147. fix(e2e): import kubectl_json in kubernetes_shared_supervisor_ha #6147 also received a human approval.
  • Two compatibility replays with the same model: single used 200k tokens and 357s; selective team with budget 1 used 484k tokens and 987s. Team partially matched both expected findings; neither mode recovered an expected finding as a blocker.

Checklist

  • Follows Conventional Commits.
  • Commits are signed off (DCO).

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 19, 2026
@johntmyers
johntmyers force-pushed the feat/5778-gator-review-team/johntmyers branch from 6bdfcd7 to 81127e6 Compare November 21, 2026 00:24

@Karthik-Chowdary Karthik-Chowdary left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bound reviewer shutdown after the replay timeout

At b46f31f, the watchdog in .agents/agents/gator/evals/run-case:91–105 sends SIGTERM once and exits, while the parent still waits without a deadline. A reviewer that ignores SIGTERM or stalls during shutdown therefore keeps its case running and prevents run-replay from reaching scoring.

I reproduced this with the unmodified run-case and its real task-builder helpers, using an offline reviewer command and a 1-second timeout: the cooperative control finished in about 2.6 seconds; the TERM-resistant reviewer was still alive after 6 seconds, with the timeout message already logged but no result.json. Only external SIGKILL let the case finish. This tests the documented custom-reviewer path, not normal Codex signal handling.

Could timeout shutdown escalate after a bounded grace period and cover a TERM-resistant reviewer in the offline replay test? The unchanged review_team_test.sh and replay_test.sh pass with jq 1.8.1 and Ruby 3.0.2.

@johntmyers
johntmyers force-pushed the feat/5778-gator-review-team/johntmyers branch from b46f31f to abfeb43 Compare November 30, 2026 20:21
@johntmyers

Copy link
Copy Markdown
Contributor Author

@Karthik-Chowdary thanks for the repro. Fixed in abfeb43.

When the timeout expires, the watchdog now sends SIGTERM to the reviewer's process group and waits REPLAY_KILL_GRACE_SECONDS (default 10). If the reviewer is still running after that, it sends SIGKILL to the group and logs reviewer ignored SIGTERM for Ns; sent SIGKILL to reviewer.stderr. The case is then recorded as reviewer_failed, and the run continues to scoring.

tests/replay_test.sh now runs a reviewer that traps TERM (trap "" TERM; sleep 60; sleep 60) with a 2s timeout and a 1s grace period. It checks that the case finishes within 30s, is recorded as reviewer_failed, and logs the SIGKILL.

@johntmyers johntmyers changed the title feat(agents): add a Gator review team and review replay harness feat(agents): add a Gator review team, fix checks, and a review replay harness Nov 30, 2026
@johntmyers johntmyers changed the title feat(agents): add a Gator review team, fix checks, and a review replay harness feat(agents): add a Gator review team with fix checks and a review replay harness Nov 30, 2026
@johntmyers johntmyers changed the title feat(agents): add a Gator review team with fix checks and a review replay harness feat(agents): add a Gator review team, GitHub App identity, and a review replay harness Nov 30, 2026
@johntmyers
johntmyers requested a review from a team as a code owner December 1, 2026 00:03
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

johntmyers and others added 10 commits December 2, 2026 13:08
Add bin/review-team, which runs the generalist reviewer plus focused
members chosen by review mode and changed code, merges their findings,
and checks that every member finding is accounted for. Networking and
contracts members run by default; correctness and security are opt-in.

Add a replay harness that reruns a reviewer on pinned past PRs with
known later fixes and grades the findings, to measure reviewer changes.

Gator's review step is unchanged until the team is wired in.

Closes #5778

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
…reviews

Add networking checklist rules: control-plane changes such as policy
reloads, approvals, and credential rotations disrupt only the
connections they affect, and a targeted check that replaces a
conservative one reads consistent, fully published state with versions
that change on every transition. The contracts member now compares the
pull request description's claims with the behavior the diff changes.

Add replay cases for #2373, which closed every relay on each policy
reload, and #5361, whose credential revalidation raced publication.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Send SIGKILL to the reviewer's process group when it is still running
REPLAY_KILL_GRACE_SECONDS (default 10) after the timeout SIGTERM, so a
reviewer that ignores SIGTERM cannot keep a case from finishing. Point
replay tasks and the default remote at ai-openshell/openshell.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Add review-compatibility, which checks pull requests for breaking changes
to existing public contracts (Rust SDK, API behavior, CLIs, configuration,
policy, Helm, persisted state) under the 0.x release train policy. It runs
on initial and follow-up reviews. Its prompt is separate from the CI
compatibility review and uses Gator's finding format; maintainers accept a
break by waiving the finding.

The contracts member no longer verifies CI compatibility review findings
and leaves public-interface breaks to the new member.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
…uns out

Follow-up and critical-only reviews now return a fix check for every open
Gator finding. The reviewer treats each fix as new code, checks it against
the finding's invariant, and reports a defect the fix introduces as a new
finding. Gator resolves a finding only when its fix check says it is
fixed. review-team requires the generalist to cover every open finding and
carries the fix checks through the merge.

Critical-only reviews now report Warnings the latest delta introduces. The
validator marks supported Warnings in that mode as held rather than
blocking, so Gator still posts only Criticals and asks a maintainer about
held Warnings. The correctness and security members now run by default in
critical-only mode.

Bump payload_version to 17 for the skill, reviewer contract, and validator
changes.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Agent manifests can declare runtime options under runtime.options, each
with allowed values and a default. The launcher accepts
--option NAME=VALUE, rejects undeclared names and values, and passes the
choice to the sandbox as OPENSHELL_AGENT_OPTION_<NAME>. The supervisor
renders it into the prompt as {{OPTION_<NAME>}}, and fails closed when a
template uses an option the launcher did not pass. Options are launch
inputs, so the tooling image is the same for every choice.

Gator declares reviewer=single|team, defaulting to single. With team, the
review step saves the mode-appropriate diff to review.diff and runs
review-team in place of the principal-engineer-reviewer subagent. A team
failure is the same transient reviewer_subagent_failed result. The image
now installs review-team.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Gator declares a github=user|app runtime option. user keeps today's
github-gator provider from `gh auth token`. app attaches a github-gator-app
provider whose installation token the gateway mints and rotates for the
gator-review-bot app, scoped to ai-openshell/openshell with the
permissions listed in agent.yaml. The operator supplies the PEM private key
path in GATOR_GITHUB_APP_PRIVATE_KEY_FILE; the gateway keeps the key and
the sandbox sees only a placeholder token.

The shared launcher gains what this needs:
- providers can be selected by a runtime option value;
- a file credential source, and path_env to read a source path from the
  host environment;
- credential_mode runtime for providers whose only credential comes from
  gateway refresh;
- secret refresh material passed to the CLI through its environment with
  --secret-material-env instead of on its command line, which also covers
  the Codex refresh token.

Installation tokens cannot call GET /user, so the gate skill uses a
repository probe for its health check, and approve-gator-workflow skips the
user permission lookup under the app identity, where GitHub enforces the
installation's actions permission.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
… App

When a PR reaches gator:approval-needed and Gator runs as the
gator-review-bot app, Gator posts its handoff as an approving review on
the current head if MAINTAINERS.md on the default branch lists the PR
author. Other PRs keep the existing handoff comment, so a bot approval
never invites a merge of a contributor's change on Gator's word.

The gh wrapper enforces this: it refuses an approval under the user
identity, where the approval would be the operator's own maintainer
approval, and refuses one on a stale head, a closed or draft PR, or for
an author MAINTAINERS.md does not link. Gator never treats its own
approval as maintainer approval; the OpenShell / Maintainer Approval
check decides what it counts for.

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
@johntmyers
johntmyers force-pushed the feat/5778-gator-review-team/johntmyers branch from 985a835 to cd81f33 Compare December 2, 2026 21:13

@gator-review-bot gator-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

I reviewed the rebased patch and found three issues that need changes. @johntmyers, I checked your replay timeout follow-up against the rebased runner and its regression test. The remaining gap is how the production path stops the reviewer group and bounds sandbox cleanup.

Action required: Please address the three inline findings.

Blocking findings:

  • GATOR-cd81f335-01 · Require completed review and CI at the App approval boundary
  • GATOR-cd81f335-02 · Verify that Gator authored threads before requiring fix checks
  • GATOR-cd81f335-03 · Bound reviewer shutdown and replay sandbox cleanup

Carried findings:

  • None.
Gator metadata
  • Validation: The PR carries state:accepted and links the Gator review team and replay work in #5778.
  • Docs: The Gator and launcher guides cover the maintainer tooling changes. Fern navigation is unaffected.
  • Checks: Required Branch Checks are pending. Other required CI is green. The separate Maintainer Approval check has not passed.
  • E2E: The required E2E gate reports success. No test suites are selected by label.
  • Head SHA: cd81f33566daebd254d45c3041baab16eebb5450
  • Base SHA: 6686f2ce2110fce293399302ca90acf6f220dc39
  • Merge base SHA: 6686f2ce2110fce293399302ca90acf6f220dc39
  • Patch ID: b3eafad72ebfa24b0e3a8b038713906ccdf7b50b
  • Gator payload: 19
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:in-review

- allow: { method: POST, path: "/repos/{NVIDIA,ai-openshell}/{openshell,OpenShell-ghsa-*}/labels" }
- allow: { method: PATCH, path: "/repos/{NVIDIA,ai-openshell}/{openshell,OpenShell-ghsa-*}/labels/*" }
- allow: { method: POST, path: "/repos/{NVIDIA,ai-openshell}/{openshell,OpenShell-ghsa-*}/pulls/*/comments" }
- allow: { method: POST, path: "/repos/ai-openshell/openshell/pulls/*/reviews" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

Warning · GATOR-cd81f335-01 · Require completed review and CI at the App approval boundary

Summary: When Gator reviews a maintainer-authored PR in App mode, the review endpoint can record an approval while required CI is pending or review feedback is still open. The wrapper checks the current head, author eligibility, and presence of the maintainer check. The review and CI requirements are enforced by instructions inside the reviewing sandbox. An early approval can still satisfy the App approval requirement when CI later passes.

Fix: Keep ordinary comment reviews available. Allow App approval for the exact head only after a trusted check outside the reviewing sandbox confirms a clean Gator review, resolved feedback, and passing required CI other than the approval check itself.

Verify: Use fixtures with a missing review, unresolved feedback, or pending required CI. Each must produce zero approval writes. A fully eligible fixture should produce one approval for the reviewed head.

Agent context
  • Location: .agents/agents/gator/providers/github-app-gator.yaml:64

else .[0] end
| $ledger[0].review_scope as $scope
| (if $scope.mode == "initial" then []
else [$ledger[0].threads[] | select(.is_resolved == false) | .finding_id] | unique

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

Warning · GATOR-cd81f335-02 · Verify that Gator authored threads before requiring fix checks

Summary: On a follow-up review, the validator requires a verdict for every open thread identified by the Gator text marker. A thread from another reviewer can be classified as Gator's, so correctly omitting it makes validation fail. The resolver relies on the same ownership assumption when selecting threads to close.

Fix: Use GitHub-reported author identity to identify Gator App or verified operator-authored threads. Use the resulting set in the ledger, team runner, validator, and resolver. Keep legacy threads with ambiguous ownership out of mandatory checks and automatic resolution.

Verify: Give the ledger one genuine Gator thread and one unrelated thread in a fixture. An envelope checking only the genuine thread should pass, and the unrelated thread should produce no resolution call.

Agent context
  • Location: .agents/agents/gator/bin/validate-review-findings:48

Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>

@gator-review-bot gator-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

@johntmyers, I checked your replay timeout fix in the guest watchdog and the cleanup path. The reviewer now gets a bounded TERM-to-KILL grace period, and stalled sandbox deletion has its own deadline. I resolved that thread after checking the code and regression fixture. The follow-up found two regressions.

Action required: Please address the two inline findings and the remaining obligations below.

Blocking findings:

  • GATOR-17acfcf8-01 · Keep open Gator findings across identity handoffs
  • GATOR-17acfcf8-02 · Keep the offline replay fixture independent of Codex auth

Carried findings:

  • GATOR-cd81f335-01 · The trusted App approval boundary still needs to enforce completed review and passing required CI.
  • GATOR-cd81f335-02 · The ledger now verifies the first comment's author. The identity-handoff regression must be addressed before closing this finding.
Gator metadata
  • Validation: The PR carries state:accepted and links the Gator review team and replay work in #5778.
  • Docs: The replay guide describes the watchdog and cleanup behavior. Fern navigation is unaffected.
  • Checks: Required Branch Checks failed in the ARM macOS Rust test job. Other required CI passed. The separate Maintainer Approval check has not passed.
  • E2E: The required E2E gate passed. No test suites are selected by label.
  • Head SHA: 17acfcf8d8267c2a7818e2253ca2292f4c81c619
  • Base SHA: 6686f2ce2110fce293399302ca90acf6f220dc39
  • Merge base SHA: 6686f2ce2110fce293399302ca90acf6f220dc39
  • Patch ID: 13b8f7cba40365414742d637e53a483d9e571b29
  • Gator payload: 19
  • Review mode: follow_up
  • Previous reviewed SHA: cd81f33566daebd254d45c3041baab16eebb5450
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:in-review

| select($first.replyTo == null and (($first.body // "") | is_gator_body))
# GitHub reports the App author as gator-review-bot in GraphQL.
# Match the stable numeric identity, or the authenticated user.
| select($first.author.databaseId |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

Warning · GATOR-17acfcf8-01 · Keep open Gator findings across identity handoffs

Summary: When a team switches an active review from a user account to the App or to another operator, the ledger drops open findings from the original operator. A follow-up can then advance the PR even though an earlier blocker is still open.

Fix: Carry forward findings with verified Gator provenance. If the new reviewer cannot verify that provenance, require the original operator or a maintainer to reconcile the handoff. Keep ambiguous threads out of automatic resolution.

Verify: Use an offline fixture with an open finding from operator A and an unrelated marked thread. Switch to the App or operator B. The genuine finding must carry forward or require a maintainer handoff. The unrelated thread must stay out of automatic resolution.

Agent context
  • Location: .agents/agents/gator/bin/review-feedback-ledger:310

shift
done
cd "$(cat "$MOCK_GATEWAY/$name/input")"
exec env -i PATH="$PATH" "${env_args[@]}" "${@:2}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

gator-agent

Warning · GATOR-17acfcf8-02 · Keep the offline replay fixture independent of Codex auth

Summary: On a developer machine with a Codex account configured, the fake gateway forwards the account ID into the guest bootstrap. The bootstrap tries to load a sandbox-only auth script on the host, so the test can stop before it exercises timeout or cleanup.

Fix: Clear CODEX_ACCOUNT_ID after applying the forwarded environment at the fake gateway's exec boundary. Keep the test running the production watchdog.

Verify: Run the offline fixture with a dummy account ID on a host without the guest payload mount. The success, timeout, and cleanup cases should reach their assertions without loading account setup.

Agent context
  • Location: .agents/agents/gator/tests/replay_test.sh:98

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agents): add a Gator review team and review replay harness

2 participants