Skip to content

feat: use Claude Code PID as session key with watchdog#15

Merged
chsm04 merged 2 commits intomainfrom
test/ci-watcher-notification
Mar 25, 2026
Merged

feat: use Claude Code PID as session key with watchdog#15
chsm04 merged 2 commits intomainfrom
test/ci-watcher-notification

Conversation

@chsm04
Copy link
Copy Markdown
Owner

@chsm04 chsm04 commented Mar 25, 2026

Summary

  • 프로세스 트리를 탐색해서 조상 claude PID를 세션 키로 사용
  • 기존 CLAUDE_CODE_SSE_PORT / PPID 기반 세션 추적 제거
  • watchdog이 5초마다 Claude PID 생존 확인, 죽으면 자가 종료 + 포트 파일 정리
  • 좀비 프로세스가 원천적으로 불가능해짐
  • /health 응답에 pid 필드 추가

Test plan

  • 세션 재시작 후 ~/.pulse/{claude_pid}.port 파일 생성 확인
  • ci-watcher hook에서 동일한 Claude PID로 포트 파일 조회 확인
  • 세션 종료 시 Pulse 자가 종료 및 포트 파일 정리 확인

🤖 Generated with Claude Code

chsm04 and others added 2 commits March 25, 2026 16:06
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Walk process tree to find ancestor `claude` process PID as session key
- Replace unreliable CLAUDE_CODE_SSE_PORT / PPID-based session tracking
- Add watchdog that polls Claude PID every 5s, self-terminates when gone
- Zombie processes are now impossible: Pulse cleans up its own port file
- Simplify cleanupStale to only check PID liveness (no more time-based)
- Add pid field to /health response

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chsm04 chsm04 merged commit 7b2c057 into main Mar 25, 2026
1 check passed
@chsm04 chsm04 deleted the test/ci-watcher-notification branch March 25, 2026 07:42
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