Repository navigation
fix(subprocess): stop the whole process group and bound every wait after a timeout (#2533) - #2534
Merged
Merged
Conversation
…ter a timeout (#2533) run_with_graceful_timeout (#2397) signalled only the direct child and, after SIGKILL, called communicate() with no timeout. A descendant of the claude CLI (an MCP server) that inherited stdout/stderr kept the pipes open, so the caller waited forever — daegyo's 2026-10-26 weekly bench stopped at q23 and stayed pinned until the phone rebooted 35 minutes later. - Start the child in its own session (callers may pass start_new_session=False) and send SIGTERM, then SIGKILL after the grace, to that whole group via os.killpg. The #2397 order is unchanged: TERM first, KILL only after the grace. - Bound the drain after SIGKILL by the grace; if a descendant escaped the group and still holds the pipes, close them and raise TimeoutExpired. - The BaseException path stops the group the same way. - All three byte-identical copies updated (nunchi.py, judge-batch.py, ccc-skill-promotion.py); auto-distill stays out of scope (receipt surface). Tests (scripts/graceful_timeout_copies_test.py): in-group descendant holding the pipes, descendant escaped via setsid, SIGTERM reaching descendants first, and the start_new_session opt-out. Against origin/main the three descendant tests fail with the caller pinned 60.3 s; with this change all 11 pass in 11.7 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…non node-name ratchet) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jinon86
approved these changes
Oct 26, 2026
jinon86
left a comment
Contributor
There was a problem hiding this comment.
Approved after exact-head validation and fresh operator authorization using the relay-held jinon86 credential.
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.
Closes #2533
문제
run_with_graceful_timeout(#2397)은 시간 제한 시 직계 자식에게만 SIGTERM과 SIGKILL을 보냈다. 그리고 SIGKILL 뒤proc.communicate()를 시간 제한 없이 호출했다. claude CLI의 자손(MCP 서버 등)이 stdout/stderr를 물려받아 쥐고 있으면 호출자는 무기한 멈춘다. daegyo의 10-26 주간 bench가 q23에서 멈춰 판정 없이 끝난 사례가 이 경로로 추정된다(정황 근거, 세부 내용은 #2533).변경 (3개 사본 동일하게 —
nunchi.py,judge-batch.py,ccc-skill-promotion.py)start_new_session=True로 실행한다(호출자가False를 넘기면 기존처럼 직계 자식에게만 보낸다).os.killpg로 그룹 전체에 SIGTERM을 보내고, 유예 시간(GRACEFUL_STOP_SECONDS, 기본 10초) 뒤 SIGKILL을 보낸다. bug(auth): /login refresh 실패 시 CLI가 .credentials.json 토큰을 빈 값으로 덮어써 노드 전체가 조용히 인증 불능 — 10월 3노드(곽가·소교·대교), refresh 방식 7노드 노출 #2397 순서(TERM 먼저, 유예 후 KILL)는 그대로이고, 이제 자손도 TERM을 먼저 받는다.TimeoutExpired를 올린다(이 경우output=None).TimeoutExpired를 실패 사유로만 쓰고.output을 읽지 않으므로 동작이 바뀌지 않는다.scripts/auto-distill/auto-distill.py는 평가 영수증 대상이라 제외했다(#2397과 동일).테스트 (
scripts/graceful_timeout_copies_test.py, CI는validate-harness.sh에서 실행)start_new_session=False선택 시 기존 동작proc.terminate()대신os.killpg(와start_new_session을 확인하도록 바꿨다.검증 (daegyo, Termux)
python3 scripts/graceful_timeout_copies_test.pypy_compile(변경 파일 4개)scripts/ccc-skill-promotion.test.sh영향과 위험
🤖 Generated with Claude Code