Skip to content

Keep a pane on its reported session when a same-cwd neighbour is newer - #100

Merged
yansfil merged 1 commit into
mainfrom
session-locator-own-id
Sep 18, 2026
Merged

yansfil merged 1 commit into
mainfrom
session-locator-own-id

Conversation

@yansfil

@yansfil yansfil commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

한 checkout 안에 Claude pane이 둘 있으면, 조용한 쪽 pane이 30초 뒤부터 바쁜 쪽 pane의 transcript로 읽혔습니다.
SessionLocator::locate가 Herdr가 보고한 session id의 파일이 30초 이상 조용하면 같은 cwd의 가장 최신 파일로 갈아탔기 때문입니다.
PR #99 배포 검증 중 새 pane w7J:p34가 처음엔 제 이름(README.md 첫 줄 요약)을 받았다가 곧 이웃 세션의 이름과 task로 덮어써지는 것으로 발견했습니다(watcher 로그의 input_chars=4044가 이웃 세션 파일을 읽었음을 보여줌).

바꾼 것: 보고된 id의 파일이 있으면 그 파일을 무조건 씁니다.
newest-by-cwd 탐색은 보고된 id가 없거나 그 파일이 없는 pane에만 남습니다.
REPORTED_SESSION_FRESHNESS와 is_recent는 쓰는 곳이 없어져 삭제했습니다.

Related

Review focus

  • 사람이 판단할 것: freshness 규칙이 원래 막으려던 케이스가 있는지. 제가 찾은 답은 "pane 안에서 세션이 바뀌면(/clear, --resume) runtime hook이 새 id를 다시 보고하므로 stale id는 hook 경로로 이미 갱신된다"입니다. 그 가정이 틀린 경로가 있으면 알려주세요.
  • 위험한 파일: hide-session/src/lib.rs locate의 분기 하나뿐입니다.

Risk surface

  • Failure path: 보고된 id의 파일이 없으면 이전과 같이 SessionFileMissing → cwd 탐색으로 내려갑니다. 변경 없음.

이외 항목(mutex, wire, ownership, contract, high-frequency)은 해당 없음: 이 코드는 플러그인 watcher 프로세스와 usage fallback에서만 돌고 Mutex<Runtime> 밖입니다.

Evidence

  • 확인한 것: 새 테스트 a_reported_session_is_kept_when_a_neighbour_in_the_same_cwd_is_newer - 보고된 파일 mtime을 10분 전으로 두고 같은 디렉터리에 더 새 파일을 만들어도 보고된 파일이 돌아오고, id 없이 물으면 여전히 최신 파일이 돌아옴. scripts/verify-cargo.sh test 전체 통과(hide-session 11, 워크스페이스 합계 0 실패), scripts/verify-cargo.sh lint 통과.
  • 확인하지 못한 것과 그 이유: 실기기에서 두 pane이 같은 cwd에 열린 상태의 재현은 머지 후 플러그인 재설치(herdr plugin install ... --yes) 뒤에 확인합니다. 워크트리에서 빌드한 watcher를 운영 소켓에 붙이면 지금 도는 watcher와 lock이 충돌합니다.

AI tooling

  • 사람이 직접 작성 - [ ] 일부를 AI 도구로 작성 - [x] 대부분을 AI 도구로 작성

손으로 확인한 것: 검증 pane의 토큰이 시간차로 바뀌는 것을 herdr pane read로 두 번 관찰했고, watcher 로그의 input_chars로 어느 파일을 읽었는지 대조했습니다.

…t is newer

SessionLocator::locate let the newest session file in the same cwd override
the session Herdr reported for a pane once the reported file had been quiet
for 30 s. With two Claude panes in one checkout, the idle pane was then read,
named, and labelled from the busy pane's transcript. A reported id now wins
outright; the newest-by-cwd search remains only for panes without a reported
id or whose reported file is missing. A session switched in place is reported
again by the runtime hook, so the freshness rule bought nothing.
@yansfil
yansfil merged commit 824972f into main Sep 18, 2026
5 checks passed
@yansfil
yansfil deleted the session-locator-own-id branch September 18, 2026 06:25
yansfil added a commit that referenced this pull request Sep 19, 2026
## Summary

PR #100 이후에도 새 pane이 잠깐 옆 pane의 이름을 받는 경우가 남아 있었습니다.
Claude가 뜨고 첫 턴을 쓰기 전까지는 Herdr가 세션 id를 이미 보고하는데 JSONL 파일은 아직 없고, 그
`SessionFileMissing`에서 같은 cwd의 최신 파일로 떨어지는 fallback이 살아 있었습니다.
실측: `w7J:p37` 분석 요청 09:18:11(`input_chars=2008`) → 그 pane의 세션 파일 생성
09:18:30 → 첫 턴 전까지 이웃 세션의 이름을 달고 있었음.

바꾼 것: 보고된 세션은 자기 파일로만 해석되고, 없으면 `session_file_missing`으로 끝납니다.
cwd 최신 파일 탐색은 Herdr가 세션을 전혀 기록하지 않은 pane에만 남습니다.
플러그인 README의 이름 규칙에 이 경우와 대기 중 남는 로그 줄(`raw_session_unavailable` /
`session_file_missing`)을 적었습니다.

## Related

- PR #100 (30초 freshness fallback 제거)의 마무리.

## Review focus

- **사람이 판단할 것**: 없음. 사용자가 "이름 붙이지 않는다"를 선택했고 README가 이미 그렇게 말하고 있었습니다.
- **위험한 파일**: `hide-session/src/lib.rs` `locate`의 identity 분기. Codex도 같은
경로를 타므로 rollout 파일이 아직 없는 Codex pane도 첫 턴까지 이름 없이 기다립니다.

## Risk surface

- **Failure path**: 파일이 생길 때까지 pane마다 tick당 `raw_session_unavailable` 로그
한 줄이 남고 토큰은 발행되지 않습니다. 기존 `session_kind_unsupported`와 같은 경로입니다.

이외 항목은 해당 없음: watcher 프로세스 안의 순수 경로 해석입니다.

## Evidence

- **확인한 것**: `hide-session` 새 테스트(파일이 없으면 `SessionFileMissing`, 생기면 같은
pane이 자기 파일로 해석) + 플러그인 테스트 1개 추가(`session_file_missing`), 기존
cwd-fallback 테스트 2개는 "세션 미보고 pane" 케이스로 범위를 좁힘. `scripts/verify-cargo.sh
test`/`lint` 통과.
- **확인하지 못한 것과 그 이유**: 실기기 재현은 머지 후 플러그인 재설치 뒤 새 Claude pane을 열어 첫 턴 전에
이름이 비어 있는지로 확인합니다.

## AI tooling

- [ ] 사람이 직접 작성  - [ ] 일부를 AI 도구로 작성  - [x] 대부분을 AI 도구로 작성

**손으로 확인한 것**: watcher `events.jsonl`의 요청 시각과 세션 파일 birth time을 대조해
fallback 경로를 특정했습니다.
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