Skip to content

Commit c4cbcb2

Browse files
committed
fix(gator): drop gh wrapper /ok to test guard
Keep the change to the gator-gate skill instructions only. Signed-off-by: Jim Meyer <jimeyer@nvidia.com>
1 parent b28b110 commit c4cbcb2

4 files changed

Lines changed: 3 additions & 70 deletions

File tree

‎scripts/agents/gator/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The launcher:
4141
- For `--harness codex`, configures gateway-managed refresh for `CODEX_AUTH_ACCESS_TOKEN` and rotates it before launching the sandbox.
4242
- Enables `agent_policy_proposals_enabled` and `proposal_approval_mode=auto` at gateway scope.
4343
- Uses the gator image policy copied to `/etc/openshell/policy.yaml`.
44-
- Installs the gator-specific `gh` wrapper from `gator/bin/gh` as `/usr/local/bin/gh` to fail closed when same-head-SHA history cannot be checked, prevent duplicate dispositions, require versioned review payloads, and reject `/ok to test` comments that do not carry the full current head SHA.
44+
- Installs the gator-specific `gh` wrapper from `gator/bin/gh` as `/usr/local/bin/gh` to fail closed when same-head-SHA history cannot be checked, prevent duplicate dispositions, and require versioned review payloads.
4545
- Installs `gator/bin/review-feedback-ledger` as `/usr/local/bin/review-feedback-ledger` so reviews receive tree- and patch-aware scope, prior summaries and findings, resolution state, convergence telemetry, and the three-round Warning budget.
4646
- Installs `gator/bin/resolve-gator-review-threads` so a follow-up commit that
4747
demonstrably fixes a Gator inline finding can resolve the corresponding

‎scripts/agents/gator/bin/gh‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -201,39 +201,6 @@ guard_duplicate_gator_disposition() {
201201
fi
202202
}
203203

204-
# copy-pr-bot only accepts `/ok to test` with the full 40-character commit SHA.
205-
# Require the comment to be exactly that command for the current PR head.
206-
guard_ok_to_test_command() {
207-
local owner="$1"
208-
local repo="$2"
209-
local number="$3"
210-
local body="$4"
211-
212-
local lowered="${body,,}"
213-
[[ "$lowered" =~ ^[[:space:]]*/ok[[:space:]]+to[[:space:]]+test ]] || return 0
214-
215-
local pull_json head_sha
216-
if ! pull_json="$($REAL_GH api "repos/$owner/$repo/pulls/$number" 2>/dev/null)"; then
217-
echo "openshell-agent: blocked /ok to test because current PR head lookup failed for $owner/$repo#$number" >&2
218-
return 21
219-
fi
220-
head_sha="$(printf '%s' "$pull_json" | jq -r '.head.sha // empty' 2>/dev/null || true)"
221-
if [[ ! "$head_sha" =~ ^[0-9a-f]{40}$ ]]; then
222-
echo "openshell-agent: blocked /ok to test because current PR head was missing for $owner/$repo#$number" >&2
223-
return 21
224-
fi
225-
226-
if [[ "$body" != "/ok to test $head_sha" ]]; then
227-
echo "openshell-agent: blocked /ok to test for $owner/$repo#$number; post exactly: /ok to test $head_sha" >&2
228-
echo "openshell-agent: copy-pr-bot requires the full 40-character current head SHA and no other text" >&2
229-
return 22
230-
fi
231-
}
232-
233-
if [[ "${method^^}" == "POST" && "$endpoint" =~ ^repos/([^/]+)/([^/]+)/issues/([0-9]+)/comments$ ]]; then
234-
guard_ok_to_test_command "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" "$(read_body)"
235-
fi
236-
237204
if [[ "${OPENSHELL_GATOR_ALLOW_SAME_SHA_COMMENT:-}" != "1" && "${method^^}" == "POST" ]]; then
238205
request_body="$(read_body)"
239206
if [[ "$endpoint" =~ ^repos/([^/]+)/([^/]+)/issues/([0-9]+)/comments$ ]]; then

‎scripts/agents/gator/bin/gh_guard_test.sh‎

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -179,45 +179,11 @@ Head SHA: `0e4d7af7722fbedce2307d571b0c937a1eb3250f`
179179
Gator payload: `5`' \
180180
0
181181

182-
run_case "allows /ok to test with the full current head SHA" \
182+
run_case "allows unmarked comment" \
183183
"$same_sha_body" \
184184
'/ok to test 0e4d7af7722fbedce2307d571b0c937a1eb3250f' \
185185
0
186186

187-
run_case "blocks /ok to test with an abbreviated SHA" \
188-
'' \
189-
'/ok to test 0e4d7af' \
190-
22
191-
192-
run_case "blocks /ok to test with a stale full SHA" \
193-
'' \
194-
'/ok to test 1111111111111111111111111111111111111111' \
195-
22
196-
197-
run_case "blocks /ok to test without a SHA" \
198-
'' \
199-
'/ok to test' \
200-
22
201-
202-
run_case "blocks /ok to test with extra text" \
203-
'' \
204-
'/ok to test 0e4d7af7722fbedce2307d571b0c937a1eb3250f
205-
206-
Mirroring for E2E.' \
207-
22
208-
209-
OPENSHELL_GATOR_ALLOW_SAME_SHA_COMMENT=1 run_case "blocks an abbreviated /ok to test SHA even with the same-SHA override" \
210-
'' \
211-
'/OK to test 0e4d7af' \
212-
22
213-
214-
run_case "fails closed for /ok to test when the PR head lookup fails" \
215-
'' \
216-
'/ok to test 0e4d7af7722fbedce2307d571b0c937a1eb3250f' \
217-
21 \
218-
false \
219-
pull
220-
221187
run_case "allows terminal cleanup" \
222188
"$same_sha_body" \
223189
'> **gator-agent**

‎scripts/agents/gator/skills/gator-gate/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ If a mirror is missing or stale and you have maintainer authority, post:
938938
gh api repos/NVIDIA/OpenShell/pulls/<number> --jq .head.sha
939939
```
940940

941-
The `/ok to test <full-head-sha>` comment must contain only that command. Do not include the `> **gator-agent**` marker, explanations, Markdown fences, or any other text in the same comment. The `gh` wrapper rejects `/ok to test` comments that do not exactly match the current full head SHA.
941+
The `/ok to test <sha>` comment must contain only that command. Do not include the `> **gator-agent**` marker, explanations, Markdown fences, or any other text in the same comment.
942942

943943
If you do not have maintainer authority, move to `gator:blocked` and state that a maintainer must post `/ok to test <full-head-sha>` with the full current head SHA written out.
944944

0 commit comments

Comments
 (0)