Serialize issue lifecycles in the job queue#16
Merged
Conversation
The FIFO queue allowed interleaved execution across issues, risking branch contamination on the single repo checkout. Now branch-touching stages (implementation, review_round, final_verdict, merge_conflict_resolution) acquire a per-repo issue lock; jobs for other issues are deferred until the active issue reaches final_verdict or fails. Non-branch stages (dev_sync, issue_request, issue_followup) bypass the lock entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If _run_job propagates an unexpected exception (e.g. storage failure on the success path), the worker now catches it, marks job.status as failed, and always runs _after_job via try/finally so the active-issue lock is released and deferred jobs are not stranded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If _after_job raises (e.g. queue.put fails during flush), the worker now catches the exception, logs it, and force-releases the active issue lock so the repo is not permanently blocked. join_all() now checks for deferred jobs that were never flushed and logs a warning, making silent job loss visible. Co-Authored-By: Claude Opus 4.6 (1M context) <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
RepoQueueManager를 리팩토링dev_sync,issue_request,issue_followup)는 lock 없이 즉시 실행_after_job예외 시에도 issue lock이 영구 잠금되지 않도록 방어 로직 추가join_all()에서 flush되지 않은 deferred job이 있으면 warning 로그 출력Test plan
test_different_issues_serialized— 다른 이슈의 impl이 인터리브되지 않는지 검증test_dev_sync_bypasses_issue_lock— dev_sync가 lock을 bypass하는지 검증test_issue_request_not_locked— issue_request가 lock 없이 실행되는지 검증test_failed_job_releases_lock— 실패한 job이 lock을 해제하는지 검증test_handler_exception_releases_lock— handler 예외 시 lock 해제 검증test_deferred_jobs_requeued_on_terminal— terminal 후 deferred jobs 재투입 검증test_join_all_warns_on_orphaned_deferred_jobs— orphan deferred 경고 검증🤖 Generated with Claude Code