fix(worker): refuse merged or closed pull requests in worker target and block instead of release - #35
Merged
Merged
Conversation
…nd block instead of release A pr-review-fix item bound to frostyard/core#118 was requeued after the pull request merged. Its head branch had been deleted on merge, so `worker target` failed inside `git fetch` with an opaque "fetch failure"; the worker retried the helper from other directories (producing unrelated refusals), released the item, and the next worker repeated the cycle every tick. Inspect the bound pull request's state and merged flag before fetching and refuse a merged or closed pull request with an explicit conflict. Report the head branch, repository, and Git's last output line when a fetch does fail. Tell implementers and reviewers to block_work with that reason rather than release, to run the helper only from the workspace root, and never to retry or bypass a refusal. Snowcat-side prevention is frostyard/snowcat#252. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
A
pr-review-fixitem bound to frostyard/core#118 was requeued by an operator after the pull request had merged (23:57Z merge, 00:10Z requeue). The head branch was deleted on merge, soworker targetfailed insidegit fetchwith an opaque "fetch bound pull-request head" error. The worker then retried the helper from other directories (collecting "not the workspace root" / "not a Git working tree" / "not on its Cockpit branch" refusals that were all self-inflicted), released the item, and the next campaign worker repeated the whole cycle every tick — three workers in ten minutes on one undeliverable item.This PR:
internal/worker/target.go— the pull-request projection now carriesstateandmerged;PrepareTargetrefuses a merged or closed pull request with an explicitErrConflictbefore fetching, and a failed fetch now names the head branch, its repository, and Git's last output line (bounded) so the cause is visible without retrying.internal/worker/worker.go— implementer and reviewer launch prompts: when the helper reports the bound PR is merged or closed, callblock_workwith that exact reason instead of releasing (release just re-serves it); run the helper only from the workspace root; a refusal is final — do not retry from other directories or bypass with plain git.docs/specs/managed-workers.md— the target contract states the new refusal and the block-not-release rule.Snowcat-side prevention (refuse requeue / auto-cancel PR-bound items on merged or closed PRs) is filed as frostyard/snowcat#252; this change only stops each occurrence from being expensive and opaque.
Risk tier
Risk tier: high —
internal/worker/is review-required at minimum tier high underpolicies/agent-governance.json. The change adds a refusal path and diagnostic text; it grants no new authority, still fetches only the credential-freehttps://github.com/<owner>/<repo>.gitURL, and touches no credential projection or lifecycle code.Boundary check
Docs housekeeping
TEMPLATE.md(none added)docs/README.md(none added)Verification
make ciactionlint(no workflow changes)🤖 Generated with Claude Code