Skip to content

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

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

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

Conversation

@johntmyers

@johntmyers johntmyers commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a Gator review team (bin/review-team) that operators can choose at launch with --option reviewer=team, and a replay harness that measures reviewer recall on past PRs with known later fixes. Make Gator check fixes for its own findings, and keep critical-only reviews looking for Warnings. Let operators run Gator as the gator-review-bot GitHub App with --option github=app, in which mode Gator approves maintainer-authored PRs. The defaults stay the single principal-engineer-reviewer and the operator's GitHub account.

Related Issue

Closes #5778

Changes

Review team

  • bin/review-team runs the generalist reviewer plus focused members chosen by review mode and changed code, in parallel through the harness subagent adapter. A merge subagent combines findings, and a deterministic check requires every member finding to be merged or dropped with a reason. A member or merge failure (after one retry) fails the run without output.
  • Members:
    • review-networking runs when changed paths or added code touch networking, and must give a verdict on each of the 35 rules in networking-checklist.md.
    • review-contracts runs in initial and follow-up reviews.
    • review-compatibility runs in initial and follow-up reviews and checks for breaking changes to existing public contracts (Rust SDK, API behavior, CLIs, configuration, policy, Helm, persisted state) under the 0.x release train policy. Its prompt is separate from the CI compatibility review, and a maintainer accepts a break by waiving the finding. It was added after the replay runs below, which do not include it; none of the 27 cases is a compatibility break.
    • review-correctness and review-security run by default in critical-only reviews (default_modes). In other modes they are opt-in through REVIEW_TEAM_MEMBERS.
  • Focused members must report the scenarios they checked; the config runs them at high reasoning.
  • The subagent adapter accepts OPENSHELL_SUBAGENT_REASONING, so the team does not depend on a specific harness's reasoning setting.

Choosing the reviewer at launch

  • Agent manifests can declare runtime options under runtime.options, each with allowed values and a default. scripts/agents/run.sh accepts --option NAME=VALUE, rejects undeclared names and values before building or launching, and passes the choice 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 identical for every choice.
  • Gator declares reviewer: single | team (default single). With team, the review step saves the mode-appropriate diff to review.diff and runs review-team instead of the principal-engineer-reviewer subagent. A team failure returns the same transient reviewer_subagent_failed result; there is no silent fallback to the single reviewer.
  • The Gator image installs review-team. The Gator README, scripts/agents/README.md, and the launch-openshell-gator skill document the option.

Running as the GitHub App

  • Gator declares github: user | app (default user). user keeps the github-gator provider from gh auth token. app attaches a github-gator-app provider (profile providers/github-app-gator.yaml, the same endpoint policy plus github_app_installation refresh) whose installation token the gateway mints and rotates, scoped to ai-openshell/openshell with the permissions in agent.yaml. The operator supplies the PEM path in GATOR_GITHUB_APP_PRIVATE_KEY_FILE; the gateway keeps the key and the sandbox sees only a placeholder.
  • Launcher additions: providers selected by an option value, a file credential source with path_env, credential_mode: runtime for refresh-only providers, and secret refresh material passed to the CLI through its environment (--secret-material-env) instead of its command line. The last also covers the Codex refresh token.
  • Installation tokens cannot call GET /user. The gate skill uses a repository probe for its health check and explains the app identity, and approve-gator-workflow skips the user permission lookup as the app, where GitHub enforces the installation's actions permission.
  • As the app, Gator posts its gator:approval-needed handoff as an approving review on the current head when MAINTAINERS.md on the default branch lists the PR author; other PRs keep the handoff comment. The gh wrapper refuses an approval under the user identity, on a stale head, on a closed or draft PR, or for an author MAINTAINERS.md does not link. Gator never treats its own approval as maintainer approval. Whether it counts toward merging is left to OpenShell / Maintainer Approval, which this PR does not change, so for now the approval is informational.
  • The app installation grants every permission agent.yaml requests.

Fix checks and critical-only reviews

Both come from a review of past Gator misses.

Replay harness

  • evals/ holds 27 pinned cases (Gator review misses and networking escapes). run-replay checks out each PR head without later history, builds the reviewer task from the gator-gate skill, runs the reviewer or the team, and grades findings with a judge model. score compares runs.
  • agent.yaml adds the member prompts (prompts/review-*.md), member rules, checklist, and team config to the payload.

On the 19 small and medium replay cases (21 known bugs), each graded by the same judge:

Reviewer Caught as blocker Tokens
Generalist only 5 2.5M
Generalist + networking 6 3.7M
Generalist + networking + contracts 8 7.8M
All four focused members 9 14.4M

Each configuration ran once, so differences of one or two catches are within run-to-run noise.

Networking checklist rules 34 and 35 and the contracts member's claims-against-the-diff check come from #2373, which closed every relay on each policy reload, and #5361, whose credential revalidation raced policy publication. Three runs of the default team on each, before and after these rules:

Case Before After
#2373 partial in 3/3 (reviewers asked for more cancellation) caught in 3/3
#5361 caught in 3/3 caught in 3/3

Testing

  • mise run test:gator suite passes: all .agents/agents/gator/tests/*_test.sh, plus run_test.sh, image_test.sh, launch_test.sh, supervisor_test.sh, and Codex exec_test.sh
  • Unit tests added (review_team_test.sh, replay_test.sh, held Warnings in validate_review_findings_test.sh, runtime options and option-selected providers in run_test.sh and supervisor_test.sh, app-identity workflow approval, and the PR approval guard in gh_guard_test.sh)
  • Live Gator run with --option reviewer=team on a real PR (not yet run)
  • Live Gator launch with --option github=app (not yet run)

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.

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>
…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>
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>
@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.

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>
…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>
@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
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>
@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
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>
… 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>
@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

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