Repository navigation
fix(hosted-review-sitter): wait out a running GitHub workflow before rerunning it - #124
Merged
Merged
Conversation
…rerunning it
GitHub refuses rerun-failed-jobs with "This workflow is already running
(HTTP 403)" until every job in the run finishes. The sitter fired the rerun
as soon as one job failed, the refusal settled as indeterminate, and the
decision then emitted a landing-failed deviation every tick for that head.
- Decline with awaiting-workflow-run while any other check in the same
workflow run is pending.
- Classify the "already running" 403 as not-landed (reason
workflow-run-in-progress), unless an earlier workflow in the same action
already reran.
- Fold the run's other check observations into the rerun evidence key, so a
not-landed rerun gets a fresh fingerprint once the run moves and the gate
lets it retry.
check-runs/{id}/rerequest has no run-level lock, so it keeps its current
handling. GitLab job retries are per job and are unaffected.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
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.
ELI5
When a CI job fails, the PR sitter asks GitHub to rerun it. If other jobs in that same workflow run are still going, GitHub says no ("This workflow is already running"). The sitter read that "no" as "maybe it worked", then gave up on the PR for good. Now it waits for the run to finish before asking, and if GitHub still says no, it knows nothing happened and tries again later.
What Changed
Before: on #121 the sitter called
rerun-failed-jobswhile other jobs in the run were pending. GitHub answered 403 "already running", the attempt settled as indeterminate, and every later tick raised alanding-failed: rerun disposition never settleddeviation for that head. It never retried.After:
awaiting-workflow-runreason while any other check in the same GitHub workflow run is pending. It reruns once the run settles.workflow-run-in-progress). It only does that when no earlier workflow in the same action had already rerun, since a partial rerun really is uncertain.Why
Waiting for the run is what GitHub requires, and it avoids burning attempts on calls that are known to fail. The 403 classification is the backstop for races the snapshot can't see, like a dependent job that hasn't been created yet. Re-keying evidence was the smallest way to make that backstop actually retry without changing the kernel's "retry needs new evidence" rule.
Not changed:
check-runs/{id}/rerequesthas no run-level lock. Its 403/422 means the check isn't rerequestable, which is permanent, so the owner deviation is still the right surface.unresolvedhandling indecision.tsis untouched. That keeps this clear of the sibling bug-317 fix.Compatibility: the new decline reason is a plain string with no wire schema. Only GitHub workflow-run reruns get the evidence-key change. Existing completed or in-flight attempts are looked up by their stored action, so they don't refire. A previously not-landed rerun gets one fresh retry.
Linked Issue
Orca ledger bug-318.
Visual Proof
N/A. Background watcher behavior with no UI change.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
decision-workflow-run.test.ts: waits on a pending sibling in the same run (not another run), doesn't wait on GitLab, and retries a not-landed rerun with a new fingerprint once the run moves.provider-github-rerun.test.ts: the "already running" 403 is not-landed, a 403 after an earlier workflow reran stays indeterminate, and other 403s stay indeterminate.Watched the new assertions fail first. Then the sandbox ran
src/main/fork-heimdall,src/main/fork-hosted-review-sitterandsrc/shared: 14,425 passed.pnpm typecheck:nodeandcheck:code-quality:changedare clean.AI Disclosure
Claude (Opus 5.5) via Claude Code.
Review
Agent skill upstream boundary
Notes
All of this is fork-owned code under
**/fork-hosted-review-sitter/**, so there are no manifest changes. SSH: the provider runs on the execution host, so nothing changes there.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)