mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 03:39:52 +00:00
agent queue: fix review findings in replies, verification and issue forms
From independent review of the queue follow-up: - Bot replies echoed user text (/blocked reasons, /reassign logins, file patterns) verbatim. Markers count when the bot posts them, so a reason containing an approval or done marker became a bot marker and could approve an acceptance command or hide another user's claim. Echoed text now has angle brackets and backticks escaped. - /verified accepted a 7-character prefix and ignored extra arguments; a commit with the same short prefix is cheap to make. Require exactly one full 40-character SHA, with one parser shared by decide and the check. - After a verification, the job looked up the check run by the pull request head SHA, but pull_request_target runs carry the base branch SHA, so it found nothing and || true hid it. The verify job now evaluates the same advisory check itself and no longer needs actions: write. - The issue form renders Files inside a ```text fence and the parser took "text" as a path, so any two form-created tasks overlapped. Fence lines are skipped. - A command still unanswered after lease_hours now gets a "Not decided" reply (window 2 x lease_hours) instead of being dropped silently. Each fix has a test shown to fail with the fix reverted. Refs #210, #211 Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
1 parent
e70780f30a
commit
6b479a6617
13 files changed
+143
-55
No files matched your search
@@ -58,12 +58,11 @@ jobs:
|
||||
verify:
|
||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/verified')
|
||||
runs-on: ubuntu-24.04-arm
|
||||
# issues: write posts the reply; actions: write re-runs the check after a recorded verification.
|
||||
# issues: write posts the reply.
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
actions: write
|
||||
concurrency:
|
||||
group: agent-verify-${{ github.event.issue.number }}
|
||||
cancel-in-progress: false
|
||||
@@ -71,7 +70,7 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Record verification and re-run the check
|
||||
- name: Record verification and check again
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
@@ -83,9 +82,21 @@ jobs:
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --pr "$number" > "$RUNNER_TEMP/state.json"
|
||||
python3 -m agent_queue decide --event "$RUNNER_TEMP/event.json" --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/actions.json"
|
||||
python3 -m agent_queue apply --repo "$GH_REPO" --actions "$RUNNER_TEMP/actions.json"
|
||||
# Re-run only after an accepted verification of the current head: refused, stale,
|
||||
# Check again only after an accepted verification of the current head: refused, stale,
|
||||
# malformed or unauthorized /verified comments get a reply and nothing else.
|
||||
if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi
|
||||
sha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["pr"]["head_sha"])' "$RUNNER_TEMP/state.json")
|
||||
run=$(gh run list --workflow agent-pr-checks.yml --commit "$sha" --event pull_request_target --limit 1 --json databaseId -q '.[0].databaseId // empty')
|
||||
if [ -n "$run" ]; then gh run rerun "$run" || true; fi
|
||||
# pull_request_target runs are recorded against the base branch, not the pull request
|
||||
# head, so the earlier check run cannot be found by head SHA. Evaluate the same check here.
|
||||
status=0
|
||||
python3 -m agent_queue pr-check --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/result.json" || status=$?
|
||||
{
|
||||
echo '## Agent PR check after verification'
|
||||
echo '```json'
|
||||
cat "$RUNNER_TEMP/result.json"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "::warning title=Agent PR check (advisory)::problems found; see the run summary"
|
||||
elif [ "$status" -ne 0 ]; then
|
||||
exit "$status"
|
||||
fi
|
||||
Reference in new issue
Block a user