Skip to content

Wake the live-check guardian on its child's exit - #839

Merged
yansfil merged 1 commit into
mainfrom
fix/flaky-828
Oct 8, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/flaky-828

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Closes #828

Summary

  • 라이브 체크 guardian은 명령마다 자식이 끝난 뒤에도 고정 100 ms 폴링을 한 번 더 기다렸고, 두 scene 실행은 명령을 약 110개 냅니다.
  • 그래서 integrity 시나리오 하나가 약 33 s로 45 s 가드의 4분의 3에 붙어 있었고, 느린 Linux 러너에서 가드를 넘었습니다(python_fixture_timeout).
  • guardian이 직계 자식의 종료를 커널에서 바로 받습니다: macOS는 kqueue NOTE_EXIT, Linux는 pidfd. 자식은 reap하지 않으므로 좀비가 프로세스 그룹을 계속 예약합니다.
  • 폴링 간격은 대기의 상한으로 남아, 취소와 자손 예산 검사 주기는 그대로입니다.
  • integrity 테스트가 실패하면 전체 scene 테스트처럼 도구의 비공개 보고서를 CI 로그 옆에 남깁니다.

Review

  • 조심해서 볼 파일: scripts/agent_live_check/processes.py - failure path: 종료 감시가 reap하지 않는다는 전제가 그룹 신호 안전성을 지킵니다.
  • 비용 검토: 명령당 kqueue 또는 pidfd 하나, finally에서 닫음. 등록 실패도 fd를 닫고 올립니다.

Evidence

  • 확인한 것: 로컬 macOS에서 integrity 테스트 두 시나리오 합계 main 66 s(2회) -> 이 변경 56 s(3회), 모두 통과.
  • 확인한 것: agent-live-check.spec.ts 전체 6개 통과(teardown, Ctrl-C, guardian 시나리오 포함).
  • 확인한 것: scripts/tests 315개 통과. 새 계약 테스트는 종료 보고 후에도 returncode가 비어 있고 wait()가 종료 코드를 돌려주는지, 이미 끝난 자식이 종료로 읽히는지 봅니다.
  • 확인하지 못한 것: Linux pidfd 경로는 로컬에서 돌리지 못했고 CI Linux 레인이 증명합니다.
  • 확인하지 못한 것: 남은 시간 대부분은 도구 계약 창(startup 준비 5 s, effect 창 COMMAND_SECONDS + scene_seconds)이라 그대로 둡니다.

Every guarded command waited out a fixed 100 ms poll after its child
exited, and a two-scene live-check run issues about 110 of them. The
integrity scenarios sat within a quarter of their 45 s guard, so a
slower Linux runner crossed it (issue 828).

The guardian now registers kqueue NOTE_EXIT on macOS, or a pidfd on
Linux, for its direct child and wakes on that exit without reaping it,
so the unreaped root still reserves its process group. The poll still
bounds each wait, so cancellation and the descendant budgets keep their
cadence. Both scenarios dropped from about 66 s to 56 s locally.

The integrity test now keeps the tool's private report beside the CI
logs when it fails, as the full-scene test already does.

Closes #828
@yansfil
yansfil merged commit a8f5bbc into main Oct 8, 2026
20 checks passed
@yansfil
yansfil deleted the fix/flaky-828 branch October 8, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: live check retains integrity loss before a later fatal artifact refusal

1 participant