Skip to content

Wait for every process under a closed pane's shell before its worktree folder is removed - #721

Merged
yansfil merged 10 commits into
mainfrom
fix/flaky-707
Oct 7, 2026
Merged

yansfil merged 10 commits into
mainfrom
fix/flaky-707

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #707

Summary

Windows에서 worktree 삭제가 가끔 set_aside_refused(os error 32)로 막히고, 이어 Git의 제자리 삭제도 "Permission denied"로 실패했다(#707, 같은 증상의 #484).
#523은 pane을 닫은 뒤 Herdr가 알려 준 shell과 foreground process가 끝나기를 기다렸지만, Herdr는 그 사이의 process를 알려 주지 않는다.
Windows pane에서는 cmd.exe(shell)가 powershell.exe를 거쳐 agent(claude.exe)를 띄우고, 세 process 모두 worktree 폴더를 작업 폴더로 잡는다.
가운데의 powershell.exe는 기다리는 대상이 아니어서, 두 process보다 늦게 끝나면 rename이 그 손에 걸렸다.
이제 pane을 닫기 전에 shell 아래의 모든 process를 pane이 도는 node의 process table에서 함께 읽고(process_descendants), 기존 대기(같은 CONFIRM_TIMEOUT)가 그것까지 기다린다. 새 대기, 재시도, timeout 변경은 없다.
대기가 timeout에 실패하면 삭제 dialog의 오류가 pid와 함께 program 이름을 보여 준다(node.exe pid 1234). 그래서 운영자가 그 process를 끝내고 다시 지울 수 있다. 이름은 node가 새 hide_platform::process::name_of(세 OS)로 읽어 process_starts 답에 싣고, handle holder scan이 따로 갖고 있던 Windows 이름 읽기도 이것으로 바꿨다.

측정 TEMP에서 함께 드러난 경합도 고쳤다. checkout의 마지막 pane을 닫으면 그 repository를 묻던 유일한 Herdr workspace가 사라지고, reader의 다음 답에는 그 project가 없다.
core는 이것을 "worktree가 바뀌었다"로 읽고 삭제를 실패시켰다("The worktree identity or deletion gate changed while panes were closing").
이제 닫는 동안의 identity 비교는 reader가 아직 그 repository를 답할 때만 한다. 답이 없다는 것은 worktree에 대해 아무것도 말하지 않고, host가 지우기 직전에 등록, HEAD, branch를 다시 확인한다(check_confirmed_removal).

Review

  • 판단해 주세요: node protocol 22->23: 기존 device helper는 Hello에서 거절되고 core가 싣고 있는 helper를 설치한다(mini 포함).
  • 조심해서 볼 파일: herdr-core/src/worktree_control.rs - pane_processes가 shell의 자손도 모은다(failure path). 자손을 읽지 못하면 pane을 하나도 닫지 않고 실패한다(기존 process_info 실패와 같은 규칙).
  • 조심해서 볼 파일: hide-node-link/src/protocol.rs, hide-host/src/serve.rs - 새 호출 process_descendants와 process_starts의 Running.name(snapshot wire가 아닌 node wire). main이 process 읽기를 node로 옮긴 것과 merge하며 함께 옮겼다.
  • 조심해서 볼 파일: hide-platform/src/process.rs - 기존 private tree walk를 process::descendants로 공개했다. Windows는 부모보다 늦게 시작한 process만 자식으로 본다(pid 재사용). name_of를 더했다(macOS pbi_name, Linux /proc/<pid>/comm, Windows QueryFullProcessImageNameW). fs/holders.rs의 Windows 전용 이름 읽기는 이것으로 바꾸고 지웠다. contract test를 더했다.
  • 조심해서 볼 파일: herdr-core/src/runtime/projects.rs - ingest_worktree_close_result가 catalog에 repository가 없으면 비교를 건너뛴다(ownership, failure path). repository가 있고 worktree 행이 없거나 HEAD, branch, deletion gate가 다르면 이전처럼 실패한다.
  • 비용 검토: 삭제 한 번에 pane마다 process table을 한 번 더 읽는다. runtime lock 밖, close worker thread에서만.
  • 판단해 주세요: catalog에서 repository가 빠진 동안 바뀐 HEAD나 branch는 core가 보지 못하고 host의 마지막 확인에 맡긴다. host 확인이 같은 계약(등록, HEAD, branch, 보호 base, 중첩, dirt)을 다시 보므로 충분하다고 판단했다.
  • 판단해 주세요: 대기 대상이 shell의 자손 전체로 넓어졌다. pane을 닫아도 끝나지 않는 자손이 있으면, 이전에는 그 process가 폴더를 잡지 않을 때 삭제가 됐지만 이제는 5초(CONFIRM_TIMEOUT) 뒤 그 process를 이름과 pid로 대며 실패한다. 폴더는 건드리지 않는다.
    • Windows에서 Herdr가 pane을 닫는 방식(0.9.1과 현재 pin인 0.9.3 소스로 읽은 것, 두 판이 같다, src/pane.rs shutdown_pane_processes, src/platform/windows.rs signal_processes): 먼저 PTY actor를 멈춰 pane의 pseudo console을 닫는다(ClosePseudoConsole). 이것이 그 console에 붙은 process(shell, powershell.exe, agent, 같은 console에서 띄운 자식)를 끝낸다. 이어서 shell의 자손을 parent pid로 모아 TerminateProcess를 부르지만, handle을 PROCESS_QUERY_LIMITED_INFORMATION으로만 열어 PROCESS_TERMINATE 권한이 없으므로 이 단계는 아무것도 끝내지 못한다(Hangup은 Windows에서 no-op).
    • 그래서 자기 console이 있는 자손(새 창, 숨긴 창 CREATE_NO_WINDOW)이나 console이 없는 자손(DETACHED_PROCESS)은 close 뒤에도 남는다. agent가 그렇게 띄운 dev server가 있으면 이 삭제는 그 이름으로 실패한다. 작업 폴더가 worktree 안이면 이전에도 rename이 os error 32로 실패했고, 다른 곳이면 이전에는 삭제가 됐다.
    • parent가 먼저 끝나 사슬이 끊긴 process는 우리 목록에도 Herdr 목록에도 없어서 기다리지 않는다(이전과 같음).
    • 운영자가 할 수 있는 일: dialog가 보여 주는 이름과 pid의 process를 끝내고 다시 삭제한다. 그 자손을 기다리지 않고 지우는 쪽을 원하면, 작업 폴더가 그 worktree 안인 process만 기다리도록 좁힐 수 있다. 다만 Windows는 다른 process의 작업 폴더를 알려 주는 API가 없어(cwd_of가 Unsupported), PEB를 직접 읽어야 하므로 이 PR에서는 하지 않았다.
    • Herdr의 TerminateProcess 권한 문제는 upstream issue 초안으로만 남겼다(게시 안 함).

Evidence

  • 확인한 것: 원인 측정, TEMP TEMP: issue 707 Windows delete holder evidence (do not merge) #711(Windows, 모든 CPU 부하, 삭제 테스트 두 개 60회, 25 ms마다 작업 폴더가 fixture 안인 process 기록). 60회 모두 pane tree가 cmd.exe → powershell.exe → claude.exe였다.
  • 확인한 것: 같은 측정에서 powershell.exe가 기다리는 두 process보다 늦게 폴더를 떠난 경우가 60회 중 11회였다(최대 628 ms). hided의 worktree reader는 삭제 중에 그 폴더에서 git을 띄우지 않았다(92회 모두 마지막 read가 rename 4초 이상 전).
  • 확인한 것: catalog 경합(identity 비교)은 #707의 원래 실패 run에는 없었고, 이 오류 문구를 담은 issue도 없다. TEMP #719와 #720에서 close worker가 동기 나열로 수백 ms 늦어졌을 때 실제로 보았다(아래 수치). 계측 없는 CI에서는 아직 관찰하지 않았다.
  • 확인한 것: 결정적 재현 a_repository_the_reader_stopped_answering_for_does_not_stop_the_removal. 닫는 중에 reader의 답에서 repository가 빠지면 main에서는 phase가 failed(left "failed", right "removing"), 수정 후에는 removing이다. 같은 표의 moved 행(HEAD가 바뀐 답)은 수정 후에도 failed다.
  • 확인한 것: 결정적 재현 a_process_the_shell_started_holds_the_wait_after_the_shell_has_ended. Herdr가 shell만 알려 주고 shell이 자식을 남긴 채 끝나면 main에서는 대기가 Ok로 끝난다(unwrap_err() on Ok). 수정 후에는 그 자식 pid를 대며 실패한다.
  • 확인한 것: contract test every_process_under_a_root_is_listed_parents_first_and_the_root_is_not, a_process_is_named_by_the_program_it_runs(실행 파일 이름, Linux는 앞 15 byte, 없는 pid는 NotFound). 대기 실패 test는 이름과 pid를 확인한다(shell 자식 test는 그 자식이 아직 sh일 수 있어 pid만).
  • 확인한 것: main(node 이전, Herdr 0.9.3 pin)과 merge한 뒤 로컬 verify-cargo.sh nextest -p herdr-core -p hide-host -p hide-node-link -p hide-node -p hide-platform 2019/2019 통과, fmt-check, 같은 crate의 clippy -D warnings 통과.
  • 확인한 것: TEMP before/after(Windows, 모든 CPU 부하, 삭제 테스트 두 개 30회씩, close 대기가 끝난 순간 작업 폴더가 그 안인 process를 동기로 나열). 나열이 close worker를 수백 ms 붙잡아 위 경합을 키웠다.
  • 확인하지 못한 것: Windows 실행은 CI(contract의 Windows 다리와 TEMP)로만 확인한다. 이 Mac에는 Windows target이 없다.
  • 확인하지 못한 것: Herdr의 Windows close가 pseudo console 밖의 process를 남긴다는 것은 Herdr 0.9.1, 0.9.3 소스와 Windows API 문서로 읽은 것이다. 자기 console을 가진 자손을 띄워 실제로 남는지 Windows에서 실행해 보지는 않았다. TEMP의 pane tree 세 process가 close 뒤 수백 ms에 걸쳐 차례로 끝난 것은 즉시 끝나는 TerminateProcess보다 console close와 맞는다.

…e folder is removed

Herdr reports a pane's shell and foreground process, and nothing between
them. On Windows a pane's cmd.exe runs the agent through powershell.exe,
which works in the same folder and outlived both reported processes in
11 of 60 CI runs, so the set-aside rename of a deleted worktree could be
refused with os error 32 and Git's own removal then failed with
Permission denied.

Closing now also reads every process under the shell from the process
table before closing any pane, and the existing wait, within the same
timeout, covers them. hide-platform exposes its tree walk as
process::descendants with a contract test.
…wers for its repository

Closing a checkout's last pane can end the only Herdr workspace that
asked for its repository; the next catalog then has no project for it,
and the close read that as the worktree having changed and failed the
removal. The host rechecks registration, HEAD and branch before it
removes anything.
A deletion now waits for every process under a closed pane's shell, and
on Windows Herdr's close ends only the processes attached to the pane's
pseudo console, so one with a console of its own outlives it. The
failure the delete dialog shows now names each program beside its pid,
so the operator can end it and delete again. hide_platform::process
gains name_of on all three systems, and the handle holder scan uses it
in place of its own Windows reader.
# Conflicts:
#	herdr-core/src/worktree_control.rs
…first read

A process can start another program after the close read it, as a
shell's background child does until it has become its command, and the
failure should name what holds the folder now. The shell-child test
asserts the pid only, since its child may still be the shell when the
pid is printed.
yansfil added a commit that referenced this pull request Oct 7, 2026
…running (#733)

Closes #727

## Summary

- 실패: `hide-factory::local_git`
`a_local_task_is_verified_merged_checked_on_main_and_reverted_alone`의
`local_git.rs:238`(Linux, #721 run 37589296496).
- 첫 `revert_check`가 `Pending` 대신 `Red`였다("the revert is verified before
it lands").
- 원인: `main_result`는 revert의 verify bundle을 submit하고 같은 호출에서
`VerifyRunner::poll`로 한 번 본다. 그 pump는 prepare(`git checkout`), spawn,
`try_wait`까지 간다.
- bundle 명령(`test -f b.txt && test -f c.txt`, 바로 실패)이 그 `try_wait` 전에
끝나면 첫 호출이 이미 `Red`를 답한다. #717(#722)과 같은 class다.
- 제품 결함이 아니다: revert는 `merge_revert` 전에는 main에 닿지 않고, 판정은 revert commit에
대해서만 한다. test가 "첫 check는 아직 돈다"를 기계 속도에 맡겼다.
- 수정(test만): revert 단계의 bundle 첫 명령을 test가 단언 뒤 여는 FIFO를 읽는 `cat`으로 했다.
  - 첫 `revert_check`는 어느 기계에서든 `Pending`이고, 단언은 그대로다.
- 이어서 bundle은 같은 `test -f` 때문에 `Red`로 끝나고, 그 뒤 단언(다른 branch에서 거절, main에
착지)도 그대로다.

## Review

- **조심해서 볼 파일**: `hide-factory/tests/local_git.rs` - revert 단계에서
factory의 verify 명령을 바꾼다. 이 test는 이미 단계마다 명령을 바꿔 왔다.
  - FIFO를 쓰기로 여는 것은 첫 check가 시작한 `cat`을 기다린다. 파일은 `#![cfg(unix)]`다.

## Evidence

- **확인한 것**:
- 자연 재현: 원래 test를 CPU 14개 busy loop 아래 40회 돌려 1회 실패. CI와 같은
신호다(`local_git.rs:238`, `Red` vs `Pending`).
- 결정적 재현(로컬, 임시 unit test, commit하지 않음): 이미 종료한 child를 든 revert job을
`running`에 두고 `poll` 1회.
- 결과 `Failed { check: "test -f b.txt && test -f c.txt" }`, 즉 첫 check가
`Red`.
- 고친 test: 같은 부하 아래 40/40 통과. `local_git` 5개 통과, fmt와 clippy(`-D
warnings`) 통과.
- **확인하지 못한 것**: Linux 부하 재현은 하지 않았다. 실패 경로의 증거는 위 결정적 재현과 macOS 부하
재현이다.
@yansfil
yansfil merged commit 5fe627a into main Oct 7, 2026
20 checks passed
@yansfil
yansfil deleted the fix/flaky-707 branch October 7, 2026 11:10
yansfil added a commit that referenced this pull request Oct 7, 2026
Fixes #746

Related: PRD `agents/prd/instant-pane-topology/prd.md` · follow-up #732
· flaky #728 #729 #731

## Summary

- split, pane 닫기, zoom/unzoom, 구분선 크기 조절, 새 탭이 Herdr의 레이아웃 확정을 기다리지 않고
바로 그려집니다; Herdr 레이아웃이 오면 그것으로 대체합니다.
- PTY 크기는 Herdr가 geometry를 적용한 뒤에만 바뀌고, 그동안 터미널은 이전 grid를 유지합니다.
- 새 탭과 split 직후 친 키는 새 pane으로 순서대로 가고, 여는 중인 pane의 입력은 pane당 64 KiB까지
보관합니다.
- 보관된 키는 친 지 3초 안에 pane이 받을 수 있을 때만 들어가고, 더 오래된 키는 버리고 진단 로그에 pane id와
바이트 수만 남깁니다(운영자 결정).
- Herdr 이벤트를 적용하는 스레드의 막히는 작업(새 socket 읽기와 cwd 재확인, `lsof`, `codex`
usage HTTP, label fsync)을 worker로 옮겼습니다.
- 운영자 규모 화면 p95, baseline -> candidate: split 1570 -> 55, 닫기 875 -> 35,
zoom 1021 -> 34, 새 탭 1002 -> 68 ms.

커밋은 리뷰 단위입니다: 단계 기록(D-14), 새 탭(A), geometry(B), 이벤트 스레드(C), 문서와 측정. 빌드와
테스트는 HEAD에서만 했습니다.
base 9e9e6a94에서 만든 뒤 `origin/main`(Herdr 0.9.3) 위로 rebase했고, main이 이미 한
C의 일(경로와 git 탐색의 `PathIndex`)은 버렸습니다.

## Review

- **판단해 주세요**: D-02 일부를 이 호스트에서 못 맞췄고 운영자가 "측정값으로 수용"(2026-10-07)했습니다.
재측정은 #732.
- **판단해 주세요**: 못 맞춘 값: Hide 몫 p95 split 68/139, 새 탭 52/75 ms(목표 50), 두 배
규모 새 탭 첫 프레임 233 ms(목표 200).
- **판단해 주세요**: 3초 한도는 키마다 적용합니다(PRD 문구 그대로). 그래서 4초 전에 친 `make deploy`는
버려지고 1초 전에 친 Enter만 들어갈 수 있습니다. 보관분 전체를 함께 버리는 쪽은 방금 친 키까지 잃어서 택하지
않았습니다. escape sequence와 붙여넣기는 한 덩어리로 와서 중간이 잘리지 않습니다.
- **판단해 주세요**: 키보드 focus는 그림이 아니라 core의 답을 따라, ⌘D 두 번 연타는 Herdr처럼 원래
pane을 두 번 나눕니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/terminal_input.rs`,
`web/src/keyTarget.ts` - 키 라우팅. 틀리면 다른 터미널에서 명령이 실행됩니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/operations.rs`,
`pane_prediction.rs`, `drawn_ahead.rs` - runtime mutex 안의 예측과 탭별 줄.
- **조심해서 볼 파일**: `herdr-core/src/session_sync/coordinator.rs`,
`sync_reads.rs` - high-frequency path; cwd 재확인도 tick마다 worker로 갑니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/operations.rs`의
`queue_pane_close`/`pump_geometry_queue`, `session.rs`의
`ingest_session_with_focus_check` - CI에서 찾은 회귀 수정. 닫기를 먼저 그리자 남은 pane의
⌘W가 "close in progress"로 거절됐습니다. 이제 탭의 줄에서 기다렸다가, 앞 닫기가 끝나고 session 반영이
끝난 뒤 시작합니다.
- **조심해서 볼 파일**: `herdr-core/src/worktree_control.rs` - 이 기능과 무관한 main의
테스트(#721)를 고쳤습니다. 테스트 프로세스 자신의 pid를 shell로 써서, `cargo test`에서는 다른 테스트의
자식(git, zsh)까지 세어 항상 실패했습니다. 자식 프로세스 하나를 띄워 shell로 씁니다(#746).
- **조심해서 볼 파일**: `web/src/actions.ts` - main에서 이 기기 id가 node id가 되어 키 표시
조건을 `localDeviceId(rest())`로 비교합니다.
- **비용 검토**: 동작마다 임시 publish 1회, 상한 있는 줄 둘(탭당 대기 8, 입력 64 KiB),
`pane_op.timing` 기록 1개.
- **비용 검토**: idle hided CPU 평균은 줄었지만(2.7 -> 2.1%, 10.2 -> 4.0%) 운영자 규모
중앙값은 0.5 -> 1.0%로 늘었습니다.
- **비용 검토**: 운영자 규모 echo p95 4.1 -> 10.4 ms(1회). 상태 변화 publish 비용은 재지
못했습니다(디스크 부족).

## Evidence

- **확인한 것**: 격리 Herdr와 헤드리스 Chrome에서 키 입력부터 화면과 첫 프레임까지, 두 규모, 동작마다
20회(Herdr 0.9.1, 접힌 표).
- **확인한 것**: rebase한 헤드에서 Herdr 0.9.3 운영자 규모 spot run 10회: 화면 p50 25-42
ms로 같습니다(load 45-53).
- **확인한 것**: B9 실제 관찰: ⌘D와 새 탭 직후 친 문자열이 새 pane에 순서대로, 이전 pane에 0자.
0.9.1과 0.9.3에서 각 10/10.
- **확인한 것**: 그 관찰이 새 탭 키를 버리는 경쟁을 찾아
고쳤습니다(`keys_for_a_new_tab_survive_an_update_before_herdr_lays_out_its_pane`).
- **확인한 것**: 3초 한도는 split 요청 보관, 새 pane 세션 대기, 재연결 재시도 보관에서 3초 안의 키는
순서대로 들어가고 넘은 키는 0바이트이며, 진단에 pane id와 바이트 수만 있고 내용은 없음을 테스트로 고정했습니다(한도
검사를 빼면 세 테스트가 실패).
- **확인한 것**: 요구사항 대조, 코드, 보안 리뷰와 수정분 재리뷰, rebase 재리뷰. 고친 항목은 수정 전 실패를 본
회귀 테스트로 고정.
- **확인한 것**: 최신 main을 merge한 헤드에서 Rust test와 lint, `verify-web.sh`(web
1192, desktop 158), `check-design-contract.mjs` 통과.
- **확인한 것**: 닫기 회귀는 데스크톱 e2e `close-policy`가 수정 전 로컬 4/4 실패, 수정 후 7/7
통과입니다. 같은 경로의 Rust 테스트는 수정을 빼면 실패합니다.
- **확인하지 못한 것**: 로컬 전체 데스크톱 background 실행에서 `browser-agent`(앱이 앞으로 옴)와
`terminal-links`(화면 폭) 2개가 실패했습니다. 이 화면 환경 탓으로 보며, 둘 다 0ec8691 CI에서는
통과했습니다. 판정은 이 헤드의 CI에 맡깁니다.
- **확인하지 못한 것**: 조용한 호스트 측정. 모든 측정이 다른 세션 빌드로 load 14-58이었고, 최댓값은 프로세스
정지가 정했습니다.
- **확인하지 못한 것**: 두 규모 표는 rebase 전 헤드(13980671, Herdr 0.9.1)의 값이고,
0.9.3에서는 spot run만 다시 쟀습니다.
- **확인하지 못한 것**: 운영자 Mac의 설치 앱과 포그라운드 키보드 QA. 운영자 작업을 건드리지 않도록 격리
candidate와 CDP 입력으로 대신.
- **확인하지 못한 것**: load 40-75에서 이 브랜치가 건드리지 않은 테스트가 한 번씩 실패했고 flaky #728
#729 #731로 올렸습니다. main에서 온 테스트 하나는 `cargo test`에서 항상 실패해서 이 PR에서
고쳤습니다(#746, Review 참고).

<details><summary>추가 증거</summary>

D-02 표 (Herdr 0.9.1, base 9e9e6a9, candidate 13980671). Key to screen,
then key to the new pane's first frame (page clock, 20 rounds; p50 / p95
/ max ms; target p95 100 and 200):

| Scale | Operation | Baseline screen | Candidate screen | Baseline
frame | Candidate frame |
| --- | --- | --- | --- | --- | --- |
| operator | split | 336 / 1570 / 1955 | 38 / 55 / 66 | 436 / 1856 /
2105 | 122 / 175 / 216 |
| operator | zoom | 188 / 1021 / 1115 | 23 / 34 / 56 | 188 / 1021 / 1115
| 88 / 109 / 117 |
| operator | unzoom | 123 / 505 / 617 | 24 / 37 / 51 | 123 / 505 / 617 |
106 / 124 / 131 |
| operator | close | 380 / 875 / 2716 | 27 / 35 / 38 | 380 / 875 / 2716
| 126 / 159 / 183 |
| operator | new tab | 325 / 1002 / 1475 | 41 / 68 / 205 | 398 / 1069 /
1525 | 116 / 168 / 272 |
| operator | switch | 13 / 50 / 107 | 17 / 22 / 28 | 13 / 50 / 107 | 17
/ 22 / 28 |
| double | split | 1332 / 2060 / 5647 | 45 / 71 / 152 | 1529 / 2521 /
5881 | 147 / 175 / 286 |
| double | zoom | 565 / 1011 / 1189 | 33 / 50 / 62 | 565 / 1011 / 1189 |
94 / 128 / 216 |
| double | unzoom | 459 / 873 / 1126 | 31 / 51 / 61 | 459 / 873 / 1126 |
101 / 127 / 134 |
| double | close | 978 / 2263 / 3108 | 33 / 47 / 52 | 978 / 2263 / 3108
| 143 / 163 / 246 |
| double | new tab | 1138 / 3455 / 4505 | 45 / 71 / 309 | 1360 / 3539 /
4589 | 136 / 233 / 426 |
| double | switch | 71 / 205 / 247 | 20 / 25 / 27 | 71 / 205 / 247 | 20
/ 25 / 27 |

Hide share, Herdr's layout event to the snapshot sent (candidate
`pane_op.timing`; p50 / p95 / max ms; target p95 50):

| Scale | Operation | Hide share | Herdr share | Core first frame |
| --- | --- | --- | --- | --- |
| operator | pane.split | 40 / 68 / 87 | 45 / 96 / 101 | 90 / 159 / 185
|
| operator | pane.zoom | 5 / 13 / 22 | 78 / 99 / 103 | 104 / 132 / 180 |
| operator | pane.close | 22 / 36 / 41 | 59 / 92 / 95 | - |
| operator | tab.create | 34 / 52 / 54 | 53 / 80 / 145 | 90 / 153 / 262
|
| double | pane.split | 76 / 139 / 142 | 53 / 96 / 105 | 99 / 134 / 139
|
| double | pane.zoom | 12 / 38 / 47 | 73 / 91 / 98 | 101 / 129 / 225 |
| double | pane.close | 42 / 60 / 76 | 52 / 64 / 74 | - |
| double | tab.create | 45 / 75 / 78 | 38 / 98 / 194 | 111 / 190 / 390 |

1-minute load: baseline operator 15.0, candidate operator 13.9, baseline
double 43.5, candidate double 58.2.
두 배 규모 baseline은 4회차가 baseline의 느린 포커스로 측정 도구 제한 시간에 걸려 3회차 값을 썼습니다.
규모: 운영자(워크스페이스 43, 탭 62, pane 66, agent 30, 출력 중 5), 두 배(86, 124, 132,
60, 10).
idle: hided RSS 51 -> 34, 85 -> 67 MiB; Herdr CPU 중앙값은 운영자 규모 6.8 ->
8.5%. 두 배 규모 echo p95 258 -> 22 ms.

Herdr 0.9.3 spot run (rebased head a84a36ab, operator scale, 10 rounds
so p95 is the max, load 44.5-53.2): screen p50 / p95 split 35 / 90, zoom
27 / 274, unzoom 27 / 37, close 25 / 63, new tab 42 / 181, switch 13 /
37 ms; Hide share p50 / p95 split 28 / 93, zoom 7 / 17, close 12 / 95,
tab.create 20 / 280 ms; echo p95 18 ms.

B9 관찰 방법: 이전 pane은 `cat`이라 받은 키를 그대로 보여 줍니다. 단축키 직후 10-51 ms 안에 고유 문자열을
CDP 키로 친 뒤 `herdr pane read`로 두 pane을 읽었습니다. rebase 전 수정 전 헤드의 첫 실행에서 새
탭 1회의 키가 사라졌습니다(core 로그 `terminal.input_delivered` 뒤
`terminal.input_discarded` `pane_gone`). Herdr의 응답과 레이아웃 사이에 session
update가 끼면, 아직 레이아웃에 없는 새 pane의 보관 입력을 사라진 pane으로 본 탓입니다.

D-13/B21을 main 설계 위에서 코드로 확인한 자리:
- 새 socket 읽기(`agent.list`, `pane.get`, cwd 재확인, `workspace.get`)는
`session_sync/sync_reads.rs` worker로 갑니다.
- `lsof`는 `ports.rs`의 `PortsReader`(`BackgroundRead`)로 갑니다.
- `codex` usage HTTP는 `usage.rs`의 `codex_background_read`로 갑니다.
- label fsync는 `labels/store.rs`의 `save_later` 저장 스레드로 갑니다.
- realpath와 git 탐색은 core가 하지 않습니다. 묻는 경로 집합이 같은 동안에는 node의 `PathIndex`
답을 30초 refresh까지 다시 씁니다.
- 이벤트 스레드에 남은 막히는 호출은 main에서 온 것입니다: 경로 집합이 바뀔 때의 `PathIndex::ask`,
Settings를 보는 동안의 `kit::hook_diagnosis`, AI 설정 저장.

리뷰에서 고친 것:
- 줄의 다음 작업이 앞 작업을 확정한 레이아웃을 자기 답으로
읽었습니다(`the_next_operation_in_a_line_waits_for_its_own_layout`).
- 레이아웃을 떠난 pane이나 닫히는 pane의 키 요청이 열려 있었습니다.
- 재시도가 끝난 pane의 보관 키가 수동 재연결 뒤 들어갔습니다.
- Hide가 그리기만 한 새 탭이 시간 초과로 사라지면 진짜 pane의 키를 버렸습니다.
- 대기 중 resize 예측이 이미 그린 레이아웃에서 계산됐습니다.
- 문서에 버림 이유 전체를 적었습니다. 나이 제한이 없다는 남은 문제는 이후 운영자 결정으로 3초 한도가 되었습니다.

구현 중 정한 가정:
- zoom과 resize의 `changed: false` 답은 그 작업을 끝냅니다.
- 새 split pane은 grid를 보관하지 않습니다.
- 결과를 알 수 없는 작업은 탭의 줄을 버립니다.
- OpenOwner 경로의 새 탭은 Herdr 응답을 기다립니다.
- task 탭의 키는 agent 시작 뒤 들어가고, 보이지 않는 탭이면 버립니다.
- 64 KiB를 넘으면 그 pane의 보관분을 버리고 로그에 남깁니다.
- 닫는 pane의 사이드바 행은 Herdr 확정까지 남습니다.
- 새 pane은 cwd 확정 전에 옆 pane의 폴더나 Hide가 만든 탭의 checkout으로 먼저 publish합니다.
- 입력 요청 id는 128자 `[A-Za-z0-9_-]`이고, 같은 id가 다른 출처로 오면 새 것이 이깁니다.
- rebase는 Observer가 승인한 구현 결정입니다(PRD 변경 없음). rebase 전 헤드는
`backup/instant-pane-topology-178de4fc` 브랜치에 로컬로 남아 있습니다.

남은 것(Follow-up):
- 조용한 호스트에서 두 규모 재측정과 split 확정 경로 프로파일: #732.
- Herdr가 이름만 알려주고 어떤 레이아웃에도 싣기 전에 없앤 pane의 요청과 보관 바이트는, 밀려나거나 Hide가 닫을
때까지 남습니다(8행, pane당 64 KiB). 다른 pane으로 가는 경우는 Herdr가 같은 id를 다시 줄 때뿐입니다.
Herdr skill은 닫힌 id를 다시 쓰지 않는다고 하지만, 이 저장소의 restore 문서는 고정 버전에서 그런 사례를 적고
있습니다.
- 화면에 없고 release되지 않는 pane의 보관 입력은 재시도가 끝나도 메모리에 남습니다(pane당 64 KiB). 3초가
지나면 다시는 들어가지 않습니다.
- 닫힌 pane의 입력 요청 행은 8행 고리에서 밀려날 때까지 남습니다.
- 줄에서 기다리다 거절된 닫기는 키보드를 되돌리지 않습니다.
- split 직후 Herdr가 새 pane을 알리기 전에 누른 zoom은 main의 "pane 하나뿐인 탭은 zoom하지 않음"
규칙에 걸려 진단만 남깁니다.
- Hide가 만든 탭의 pane이 잘못된 cwd로 알려지면 `PathIndex::ask`가 두 번 일어날 수 있습니다(main
설계, 0.9.3에서 재현 미확인).
- 같은 cwd를 다시 읽은 답도 publish를 한 번 더 합니다.
- 비차단 리뷰 항목:
  - SyncReader 단위 테스트
  - label 저장 스레드의 종료 시 flush
  - BackgroundRead 재시작 backoff
  - remote `Unchanged` 답
  - task 슬롯 행 시간 제한
  - unknown 진단 반복

</details>

<details><summary>Verification record</summary>

- PRD: `agents/prd/instant-pane-topology/prd.md` (sha256
6e29d9b1a7fe1078767176f6fe97261f4e7b9687463b626bacde9865e788b861;
amended 2026-10-07 for the 3 s held-input limit, D-11/B10)
- Base 9e9e6a9 → head 3494adb, verified 2026-10-07T12:43:12.579Z: PASS
- Rebased onto origin/main 35f480e (backup ref
backup/instant-pane-topology-178de4fc), then merged origin/main
9f14487; PR diff against main: 47 files. The 481 changed paths below
count from the original base 9e9e6a9.
- Verification report:
`agents/runs/instant-pane-topology/verification-report.json` and
`agents/runs/instant-pane-topology/verification-report.md`; source
fingerprint
d8a40fb15180a5c29f645e8889697b994de183e0972a957b47ac55a54e4de0d5
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews:
  - Fidelity (13980671): three findings, all fixed.
- The PR overstated B24/B25; echo, idle medians and the unmeasured
publish cost are now stated.
    - The focus-lag line was added.
- The discard reasons and the no-age-limit residual were added to the
docs.
  - Code (13980671): two Fix now findings.
- The line baseline was read before the update; fixed, with a regression
test.
    - The queued resize was predicted from the drawn layout; fixed.
- Follow-ups: SyncReader tests, label saver flush, BackgroundRead
backoff, remote `Unchanged`.
  - Security (13980671): two Fix now findings.
- A request for a gone pane could take a reused id; fixed with
`pane_gone`.
    - Held keys survived exhausted retries; fixed with `session_failed`.
    - Follow-ups: task-slot timeout, unknown diagnostic churn.
  - Fix follow-up reviews:
    - 88e15ffb: found the provisional-tab expiry hole; fixed.
    - c366e433: closed, no new defect.
    - The B9 probe found the held-key race; fixed and reviewed.
- Rebase review (a84a36ab, Fidelity + Code, key routing first): no
blocking defect.
    - A stale commit message and a stale doc sentence were fixed.
    - Follow-ups are listed under 남은 것.
- Age-limit amendment (operator decision, D-11/B10), two follow-up
reviews:
- First review: no blocking defect. It found that the whole-holder
discard did not match the per-key PRD text, and that the stale
diagnostic was untested; both changed.
    - Second review: no blocking defect. Its findings are now fixed:
- stale keys counted toward the 64 KiB cap; they are now pruned on hold,
with a test;
- the resolve-time diagnostic and the mix of stale and fresh keys were
untested; the runtime test now covers them;
      - two stale test comments were corrected.
- The residual that a fresh Enter acts without its discarded command is
documented in ARCHITECTURE.
- Queued-close regression fix (1b91e61, from the CI desktop e2e failure
on 0ec8691): one Code review, no blocking defect. Its findings are
fixed in 941a0ea:
- a queued close waited with no deadline behind a failed or unknown
close; it now waits only behind a settling close;
    - a nested pump could drop the line;
- the test did not start the queued close; it now does, and fails
without the ingest guard.
- #746 test fix (3494adb), Observer-authorized and test-only: passes
3/3 under plain cargo test, where it had failed 7/7.
- Evidence: 18 registered (3 file, 7 browser, 8 log); paths are local to
the run directory
  - agents/runs/instant-pane-topology/evidence/d02-table.md
  - agents/runs/instant-pane-topology/evidence/idle-echo-summary.md
-
agents/runs/instant-pane-topology/evidence/candidate-operator-4/topology.json
-
agents/runs/instant-pane-topology/evidence/candidate-operator-4/timing-summary.json
-
agents/runs/instant-pane-topology/evidence/baseline-operator-4/topology.json
-
agents/runs/instant-pane-topology/evidence/baseline-operator-4/timing-summary.json
-
agents/runs/instant-pane-topology/evidence/candidate-double-4/topology.json
-
agents/runs/instant-pane-topology/evidence/candidate-double-4/timing-summary.json
-
agents/runs/instant-pane-topology/evidence/baseline-double-3/topology.json
-
agents/runs/instant-pane-topology/evidence/baseline-double-3/timing-summary.json
  - agents/runs/instant-pane-topology/evidence/verify-web-13980671.log
  - agents/runs/instant-pane-topology/evidence/b9/b9-run2-c366e433.json
  - agents/runs/instant-pane-topology/evidence/b9/b9-run1-59682273.json
  - agents/runs/instant-pane-topology/evidence/verify-web-a84a36ab.log
-
agents/runs/instant-pane-topology/evidence/spot-093-operator-summary.md
-
agents/runs/instant-pane-topology/evidence/verify-web-rebased-a84a36ab.log
-
agents/runs/instant-pane-topology/evidence/b9/b9-run3-a84a36ab-herdr093.json
-
agents/runs/instant-pane-topology/evidence/spot-093-operator/timing-summary.json
- Changed paths: 481 from the original base (see Files changed for the
47 against main)

</details>
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: Delete worktree closes the agents its checkout spawned outside it before the folder goes

1 participant