feat(pr-check): make the per-PR poll comment-aware#415
Open
pmaeria wants to merge 1 commit into
Open
Conversation
The generated state/<id>.check.sh woke firstmate only on merge, so new review activity - a review, a PR issue comment, an inline review comment - sat unnoticed until someone looked. Extend the poll to also count reviews + comments via gh pr view --json and persist the last-seen total in state/<id>.pr-activity. On an increase it wakes with one "new-review-activity: +N on <url>" line; the first poll records the baseline silently, unchanged activity stays silent, and a gh error stays silent without touching the marker. Merge wins: a merged PR echoes only "merged", preserving the one-line check contract. No bot classification - any new activity wakes firstmate to triage. fm-teardown.sh removes the new marker alongside its sibling state files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The per-PR poll generated by
bin/fm-pr-check.sh(state/<id>.check.sh) woke firstmate only when the PR merged. New review activity - an AI or human review, a PR issue comment, an inline review comment - sat unnoticed until someone happened to look.This extends the poll so new review activity also wakes firstmate, within one poll cycle, while preserving the check contract (one line of stdout only when firstmate should wake, silence otherwise, bounded runtime).
Behavior
gh pr view --json reviews,comments(gh's built-in jq), consistent with the existinggh pr view --jsonusage in the script family.state/<id>.pr-activity, following the naming/lifecycle of sibling per-task state files.new-review-activity: +<n> on <url>, and advances the marker.mergedand skips the activity check, so each fire prints exactly one line.ghfailure (or any non-integer reading) stays silent and never touches the marker - retries next cycle.bin/fm-teardown.shremovesstate/<id>.pr-activityalongside its sibling state files (both the main-task and secondmate-child cleanup paths).Notes
AGENTS.mduntouched: the check-contract sentence ("print one line only when firstmate should wake, print nothing otherwise") still accurately describes the new behavior.Tests
New colocated
tests/fm-pr-check.test.shcovers baseline init, wake-on-increase, silence-on-no-change, merged-beats-activity, API-error silence (existing marker and first poll), and the fallen-count resync.shellcheck bin/*.sh bin/backends/*.sh tests/*.shis clean;fm-teardownandfm-pr-mergesuites still green.