Skip to content

라이브 프로세스 감지를 claude 전용에서 에이전트별로 확장 - #3

Merged
4mGLn merged 1 commit into
mainfrom
feature/multi-agent-live-detection
Sep 2, 2026
Merged

4mGLn merged 1 commit into
mainfrom
feature/multi-agent-live-detection

Conversation

@4mGLn

@4mGLn 4mGLn commented Sep 2, 2026

Copy link
Copy Markdown
Owner

문제

activity.server.ts의 라이브 프로세스 스캔이 claude 바이너리만 찾도록 하드코딩되어 있어서,
Codex/Gemini CLI/OpenCode/Aider 세션은 실제로 실행 중이어도 ACTIVE+HIGH 신뢰도에 도달하지 못하고
타임스탬프 휴리스틱으로만 판정됨.

변경

  • detectActivity에 agentId를 추가해 세션 자신의 에이전트에 해당하는 프로세스만 매칭
  • 이 머신에 실제 설치된 codex/gemini/opencode 바이너리로 프로세스명 확인 (aider는 미설치라 검증 못함)
  • 같은 워크스페이스에 다른 에이전트의 프로세스가 있어도 잘못 ACTIVE로 표시되지 않도록 실제 테스트로 검증
  • macOS는 에이전트별 개별 lsof 호출로 기존 검증된 파싱 로직 재사용

검증

  • 실제 /proc 스캔 기반 프로세스 스폰 테스트 3개 추가, 전체 100개 테스트 통과
  • 이 대화 자체의 실시간 세션으로 변경 전후 모두 확인: ACTIVE/HIGH 유지 (회귀 없음)

- 문제 재현: 이 대화 자체의 실시간 Claude Code 세션은 정확히 ACTIVE/HIGH로
  잡히는 것을 실제로 확인함 — 그런데 activity.server.ts의 라이브 프로세스
  스캔이 "claude" 바이너리만 찾도록 하드코딩되어 있어서, Codex/Gemini
  CLI/OpenCode/Aider 세션은 실제로 실행 중이어도 타임스탬프 휴리스틱
  (RECENT/IDLE/STALE)으로만 판정되고 ACTIVE+HIGH에는 절대 도달하지 못함
- 이 머신에 실제 설치된 바이너리로 codex/gemini/opencode 프로세스명을
  확인함 (aider는 설치되어 있지 않아 실제 검증은 못 했고, pip 패키지의
  잘 알려진 콘솔 스크립트 이름을 그대로 사용)
- detectActivity에 agentId를 추가해 세션 자신의 에이전트에 해당하는
  프로세스만 매칭하도록 함 — 같은 워크스페이스에 다른 에이전트의 살아있는
  프로세스가 있어도 엉뚱하게 ACTIVE로 잘못 표시되지 않도록 실제 테스트로
  검증(같은 워크스페이스, codex 프로세스 실행 중 → codex 세션은 ACTIVE,
  gemini-cli 세션은 여전히 RECENT)
- macOS 경로는 매칭된 에이전트별로 별도 lsof 호출을 하도록 해서, 기존에
  검증된 단일 에이전트 파싱 로직을 그대로 재사용(여러 pid를 한 lsof
  호출로 묶어 p<pid> 라인으로 구분하는 새로운 파싱 로직을 추가하지 않음)
- 실제 /proc 스캔을 쓰는 진짜 프로세스 스폰 테스트 3개 추가(claude-code,
  codex, custom 폴백), macOS 목 테스트 2개 추가 — 전체 100개 테스트 통과
- 이 세션 자체의 실시간 워크스페이스로 다시 확인: 변경 후에도 여전히
  ACTIVE/HIGH로 정확히 잡힘 (회귀 없음)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aeaa41bea7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


function matchAgent(cmdline: string): AgentId | null {
for (const [agent, pattern] of Object.entries(AGENT_PROCESS_PATTERNS) as [AgentId, RegExp][]) {
if (pattern.test(cmdline)) return agent;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match the executable instead of arbitrary command arguments

When a Codex session is started as codex exec "compare Claude...", codex exec --help describes [PROMPT] as the initial instructions, so that text is part of the command line. This loop sees the claude pattern first and buckets the running Codex process as claude-code; likewise, any non-agent process with one of these words in an argument is treated as that agent. Discovery can therefore mark an unrelated stale session ACTIVE/HIGH (and keep it ongoing) while failing to mark the actual Codex session active. Restrict matching to the executable or CLI entrypoint rather than the entire argument string.

Useful? React with 👍 / 👎.

@4mGLn
4mGLn merged commit 507e0cc into main Sep 2, 2026
4 checks passed
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