Skip to content

fix(execution): work command의 SIGTERM을 취소 경로로, CLI 출력 보존량 상한 (AGT-3423) - #900

Open
unohee wants to merge 2 commits into
mainfrom
heewonoh/agt-3423-work-sigterm
Open

unohee wants to merge 2 commits into
mainfrom
heewonoh/agt-3423-work-sigterm

Conversation

@unohee

@unohee unohee commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

무엇

AGT-3423의 6개 항목을 origin/main(3ef5b70)과 대조했습니다. 4개는 #789/#791에서 이미 들어갔고, 남은 2개를 이 PR에서 고칩니다.

항목 상태
CLI stdout/stderr 보존량 상한 (stream 파싱 유지) 이 PR — outputRetention.ts BoundedOutput: stage당 stdout 32 MiB / stderr 1 MiB, 마지막 부분(결과·비용·에러 이벤트가 있는 곳)을 줄 경계에서 보존하고 JSON-line 파서가 건너뛰는 표시 줄을 앞에 붙임
force kill 시 graceful escalation 타이머 해제 main: processRegistry.ts escalationTimers (#791)
CI rerun subprocess 상한 main: ciWorker.ts timeout: 30_000, maxBuffer (#789)
fix 오케스트레이션의 objective check 상한 main: fixCommand.ts maxBuffer + timeout: 300_000 (#789)
work command에서 SIGTERM을 취소·coordinator 정리 경로로 이 PR — 기존엔 SIGINT만 받았음. SIGTERM이 오면 process-tree relay가 SIGTERM을 다시 올려 Node가 finally(핸들러 해제, coordinator.close())보다 먼저 죽었음. 이제 SIGTERM도 같은 abort 경로를 타고 exit 143, 두 번째 신호는 강제 종료
취소된 dev task escalation·종료까지 추적 유지 main: dev.ts cancelTask는 abort만 하고 항목은 완료 핸들러에서 지움 (#791)

왜

systemd·docker stop·CI 취소는 SIGTERM을 보냅니다. 이 경우 Ctrl-C와 달리 claim·coordinator 정리가 실행되지 않았습니다. CLI 출력은 실행 내내 문자열을 이어 붙이기만 해서, 폭주하는 stream이 있으면 daemon 메모리가 계속 늘었습니다.

검증

  • npx vitest run src/cli/workCommand src/adapters → 63 files, 1044 tests 통과 (7 skipped는 기존 것)
  • 새 테스트: 실제 process.emit('SIGTERM')이 기본 wiring으로 run을 abort하고 143으로 끝남, SIGTERM이 pipeline signal을 abort하고 handler를 해제하며 143으로 끝남, 기본 wiring이 SIGTERM listener를 달았다가 떼어 냄, BoundedOutput 상한·줄 경계·잘린 뒤에도 extractStreamJsonError가 결과를 찾음·줄바꿈 없는 거대한 줄
  • spawn 경로 테스트: stderr 3 MiB를 흘리면 1 MiB 꼬리만 남고 마지막 줄이 보존됨. base.ts를 main 버전으로 되돌리면 이 테스트가 실패하는 것을 확인
  • npm run typecheck 통과

주의

  • 상한을 넘으면 앞쪽 stream event가 버려집니다. 결과·비용·에러 event는 끝에 있어 영향이 없지만, stage 출력 앞부분에서 실행 명령이나 변경 파일을 읽는 파서가 있다면 32 MiB를 넘는 실행에서는 그 정보가 빠집니다(정상 실행은 이 크기에 한참 못 미침).

…ound retained CLI output (AGT-3423)

- workCommand: SIGTERM aborts the pipelines like Ctrl-C, so the finally still uninstalls the handler and closes the coordinator; exits 143 (second signal force-quits)
- adapters: stdout/stderr per CLI stage are kept as a bounded tail (32 MiB / 1 MiB) starting on a line boundary with a skip-safe marker, so result/cost/error events still parse
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.

1 participant