Repository navigation
Close an agent with the agents it spawned, deepest first, after one question - #255
Merged
Merged
Conversation
Adds close_descendant_pane_ids to every agent row, computed on the lineage pass: each descendant before its parent, rows on a disconnected device left out. Commits the close-agent-subtree PRD.
A close_tree event names a pane or tab and the descendant panes the operator was shown. The core admits the whole set or nothing (status, confirmation, capacity), then starts each pane through the ordinary local or device close only once its listed descendants are gone, and the target last. A refused or timed-out pane keeps its listed ancestors open while other branches finish. Delete worktree and Remove project take the same close first when asked and start their removal only once it has finished. Progress rides status.async_operations as tree.close records.
…et and the removal dialogs
…outside it end to end
… it, and never read a vanished device as closed
…s the operator, and dismiss a retried close only once admitted
… an unresolved refusal waits on
…se sheet's summary and bright and dim rows
… closes what it shows at the press
…nd drop the frozen-list wording
…ild leaves into it in place
… merged branch folding under Inactive
…h closes while a target's status is unknown
…ive fold, and check where the keyboard lands after a sheet swap
…ture branch folds under Inactive at a time of the core's own
…e button, status words only where the operator acts, one facts line and warning badges in the removal dialogs, short result-named buttons at the standard width
…e and removal docs in line with the quieter modals
Merged
yansfil
added a commit
that referenced
this pull request
Sep 29, 2026
Related: PRD `agents/prd/device-parity/prd.md` · follows #257 (bundled Herdr server start) and meets #255 (subtree close) ## Summary - 지금까지 hide CLI 링크, Claude Code·Codex hook, 라벨 플러그인, hcoord는 기계마다 따로 맞춰야 했고 SSH 기기는 helper만 받았다. - 이제 설치 kit 하나(`hide-kit`)가 같은 구성요소를 이 Mac에는 설치된 앱의 첫 실행에, 각 기기에는 연결 때 묻지 않고 설치한다. - 업데이트, 운영자가 지운 구성요소(다시 설치 전까지 그대로), 기기 삭제(hcoord만 남김)가 이 Mac과 기기에서 같은 규칙이다. - Settings > Devices는 기계마다 구성요소별 상태와 위치를 보이고, 문제가 있는 행에만 Reinstall이 있다. Agents 탭은 기계별 hook 행을 보인다. - 기기의 agent pane은 로컬과 같은 함수로 계측을 판정한다(그 pane의 hook token과 그 기기의 kit). 기기 Memory는 범위 밖이다.  ## Review - **이번 머지의 동작**: 이 Mac의 kit는 실행 중인 앱 번들을 원본으로 쓴다. `/Applications` 위치 제한은 별도 보안 검토 대상으로 남긴다. - **이번 머지의 동작**: 같은 계정에 다른 기기 등록이 있으면 kit를 유지하고 확인창에 이유를 표시한다. 마지막 등록을 지울 때 제거한다. - **기존 결정 D-13**: 계약 2로 허용한 기기는 다음 연결에 kit 전체를 받는다. 과거 동의 문구에는 hook과 설정 변경이 없었다는 점은 Breaking change에 명시했다. - **남은 제약**: 두 Mac이 같은 기기 계정에 kit를 적용하면 마지막으로 실행한 kit가 hook과 링크를 소유한다. 계정 lock은 동시 쓰기만 막는다. - **조심해서 볼 파일**: `hide-kit/src/lib.rs` - 운영자 설정 파일과 LaunchAgent를 바꾸는 유일한 경로(계정 lock, private 폴더). - **조심해서 볼 파일**: `hide-agent-hooks/src/install.rs` - 운영자 설정 파일 쓰기의 failure path(mode와 symlink 보존, 임시 파일). - **조심해서 볼 파일**: `herdr-core/src/runtime/kit.rs` - runtime mutex 밖 worker, 늦은 응답, 기기 삭제 순서와 helper 연결 종료. - **조심해서 볼 파일**: `herdr-core/src/remote/host.rs` - 한 계정에 두 연결이 동시에 올리는 경합과 private 폴더. - **조심해서 볼 파일**: `herdr-core/src/runtime/device_catalog.rs` - regroup마다 lineage pass를 다시 돈다(#255와 만나는 곳, mutex 안의 일). - **조심해서 볼 파일**: `desktop/src/main/host.ts` - hcoord 준비 제거(kit 소유), 창은 status page 로드가 끝난 뒤에 shell을 연다. - **조심해서 볼 파일**: `herdr-core/src/model.rs`, `contracts/snapshot-wire-enums.json` - snapshot wire의 `DeviceSnapshot.kit`. ## Evidence - **확인한 것**: 격리 sshd(비루트, 세션마다 private HOME과 HCOORD_HOME)로 실제 SSH 연결: 연결 한 번에 다섯 구성요소가 설치됐다. - **확인한 것**: 같은 연결에서 다른 도구의 hook과 설정 키가 그대로였고, 기기 pane의 설치된 SessionStart hook이 Workspace 안내를 내고 Memory capsule은 없었다. - **확인한 것**: 운영자가 지운 Claude hook은 '지워짐'으로 남았다가 Reinstall이 그것만 되살렸고, 삭제는 설정 파일을 원래 바이트로 돌리고 hcoord를 남겼다. - **확인한 것**: 한 계정의 두 등록이 동시에 연결해 둘 다 설치됐고, 첫 삭제는 kit를 남기고(`device.kit_left`) 마지막 삭제가 걷어냈다. - **확인한 것**: 패키지된 hide.app의 hided를 private HOME으로 실행하면 첫 실행에 다섯 개를 설치하고, 두 번째 실행은 설정 파일 mtime을 바꾸지 않았다(3회 반복). - **확인한 것**: 전체 desktop e2e 26/26(merge 뒤), device-kit과 remote-workspace 3/3(검증 head), cargo test와 lint, verify-web, scripts, design contract 통과. - **확인한 것**: 모든 실행에서 운영자의 hcoord daemon pid가 그대로였고, 실제 `~/.claude`, `~/.codex`, `~/.local/bin`, `~/.hcoord`, `/Applications/hide.app`은 건드리지 않았다. - **확인하지 못한 것**: mini가 계약 2 동의에서 kit로 올라가는 실제 연결(merge와 설치 뒤에 일어난다, 코어 테스트만 있다). - **확인하지 못한 것**: Linux 기기(단위 테스트만, hcoord는 macOS에서만 설치), GitHub로 설치된 라벨 플러그인을 넘겨받는 경로(가짜 socket 단위 테스트만). - **확인하지 못한 것**: 재부팅 뒤 hcoord daemon이 kit 첫 pass에서 올라오는 순서(#257과 만나는 곳), `/Applications` 설치본 교체(운영자 소유라 하지 않았다). - **확인하지 못한 것**: `github::tests`의 1초 deadline 테스트가 부하(load 9~13)에서 네 번 실패했다. 이 브랜치가 건드리지 않은 모듈이고 단독 실행은 통과했다. <details><summary>추가 증거</summary>    - 창 navigation 경합: status page 로드 10~30 ms 뒤에 shell을 열면 Electron 44가 빈 code로 실패를 보고했다(20번 중 8번, 3번). 창은 shell에 도착했지만 Playwright가 멈췄다. 지금은 한 번에 하나만 연다. - 공유 머신 부하에서 remote-workspace의 hook 65회 반복 검사가 한 번 16번째에서 멈췄고, 단독 재실행은 통과했다(이 브랜치는 hook 버전 문자열만 바꿨다). </details> ## Breaking change - 설치된 앱은 실행마다 운영자 홈의 kit를 맞춘다. 전에 한 번 쓰던 hook(이제 v6)과 hcoord에 더해 `~/.local/bin/hide` 링크, Herdr 플러그인 `hide.agent-context-labels`, `~/.hide/kit/`가 새로 생긴다. - 예전 `~/.hide/agent-hooks/installed-once` 표시는 설치 기록으로 보지 않아서, Hide hook이 없는 기계는 다음 실행에 hook을 받는다. - 같은 id로 GitHub에서 설치했거나 checkout에서 link한 라벨 플러그인은 kit 복사본으로 바뀐다(플러그인 config는 남는다). - 동의가 있는 기기(계약 2 포함)는 다음 연결에 같은 kit를 받는다. helper protocol은 10이고 helper는 연결 때 스스로 바뀐다. - 이 Mac의 kit를 한 번에 걷어내는 명령은 없다. 운영자가 지운 구성요소는 다시 설치하기 전까지 그대로 둔다. **AI tooling**: 대부분 AI 도구. 사람이 손으로 대조한 것은 아직 없고, 이 PR의 리뷰가 그 대조다. <details><summary>Verification record</summary> - PRD: `agents/prd/device-parity/prd.md` (sha256 f197c2cdf41e26a237da0d79a195e42f15cc67d6df57eed17cd63789b3d9a294) - Base efb51d1 → head 755839b, verified 2026-09-29T10:00:10.099Z: PASS - Verification report: `agents/runs/device-parity/verification-report.json` and `agents/runs/device-parity/verification-report.md`; source fingerprint 9e6c848822e7523665bf50ded685362f4e9d9c8df0e12c639c228a52a4e91239 - Suites: - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0) - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0) - Reviews: advisory, native subagents, six feature review sets through f3fac04, plus Fidelity, Code and Security follow-up reviews on verified merge head 755839b; no new actionable findings. - Fidelity (afe113d): Fix now 1, removing one of two registrations of one account kept the kit, a B23/D-16 departure; kept as a recorded deviation with tests and e2e. Fix now 2, an unread device kit judged hooks not installed; fixed 9a636c6, 749e095. Later heads: none. - Code (afe113d): Fix now 1 unread kit judged not installed, fixed 9a636c6/749e0959; 2 concurrent uploads of one account, fixed 6069955, 17108b0, 91354b0; 3 a late answer brought back a removed device, fixed 749e095; 4 hcoord failed on Linux, fixed f5155fb. 5382042: Fix now 1, a regrouped device session dropped its agents' lineage that #255's subtree close waits on, fixed f3fac04 with a regression test. Other heads: none. - Security (afe113d): Fix now 1 hook file mode and symlink replaced, fixed 0496815; 2 this Mac's kit runs from any app bundle, left for human judgment (see Review); 3 kit folders not private, fixed 68f8bc9. Later heads: none. - Follow-ups (not in this PR): a lineage pass on every device regroup even when nothing regrouped; a bounded status page wait; `.upload-*` leftovers after a crash; contract-2 carry with an unbound identity; hcoord shim ownership marker; relative PATH candidates; labels dev-link undo; `process.rs` kill/join order; digest-only reuse and payload caps before read; Herdr-down retry of labels; corrupt record healing; a lost Reinstall not requeued; blocked rows offering Reinstall; removal dialog default focus; two Macs sharing one device account; the `github::tests` 1 s deadlines under load. - Evidence: 7 registered (4 screenshot, 3 log); paths are local to the run directory - agents/runs/device-parity/evidence/this-mac-kit.png - agents/runs/device-parity/evidence/agents-hooks-per-machine.png - agents/runs/device-parity/evidence/device-kit-removed-part.png - agents/runs/device-parity/evidence/device-remove-confirm.png - agents/runs/device-parity/evidence/e2e-desktop-all-0ac13a23.log - agents/runs/device-parity/evidence/device-kit-daemon.jsonl - agents/runs/device-parity/evidence/device-kit-two-registrations-daemon.jsonl - Changed paths: 172 (see Files changed) </details>
yansfil
added a commit
that referenced
this pull request
Oct 29, 2026
…ir causes (#1833) Closes with-hide/hide-private#256 Closes with-hide/hide-private#244 Closes with-hide/hide-private#226 Closes with-hide/hide-private#267 Closes with-hide/hide-private#163 Closes with-hide/hide-private#266 Closes with-hide/hide-private#230 Closes with-hide/hide-private#264 Closes with-hide/hide-private#265 Closes with-hide/hide-private#212 Closes with-hide/hide-private#141 Closes with-hide/hide-private#282 Related: with-hide/hide-private#326 (제품 쪽 후속), #1811 ## Summary Windows에서 데스크톱 앱 시작·정리와 hided daemon 수명 테스트가 가끔 실패하던 것을 원인별로 고칩니다. 제한 시간과 재시도는 그대로입니다. 가장 잦던 실패(#256)는 job에서 처음 시작하는 Windows PowerShell과 새 `hided`의 cold 비용이 첫 테스트의 제한 시간 안에 들어간 것이었고, 테스트 전에 한 번 먼저 시작합니다. 정리 실패(#244 등)는 Playwright의 `app.close()`가 앱 프로세스가 끝나기 전에 돌아오는 것이었고, fixture가 그 프로세스의 종료까지 기다립니다. hided 테스트의 private Herdr는 pane shell까지 끝난 뒤에 폴더를 지웁니다. 나머지는 테스트가 잘못 기대하던 것(아직 없는 파일 읽기, delta 모양, 탭 선택 순서)을 계약대로 고쳤습니다. 제품 코드는 바뀌지 않습니다. 스크린샷 없음: 화면과 제품 코드를 건드리지 않음(e2e fixture와 테스트만). <details><summary>이슈별 원인과 처리</summary> - **#256** Add a project(Windows desktop job의 첫 테스트): Herdr는 cmd.exe pane에서 agent를 `powershell.exe -NoLogo -NoProfile -EncodedCommand`로 띄웁니다(Herdr v0.9.5 `interactive_shell_command`). desktop lane은 첫 테스트 전에 PowerShell을 한 번도 돌리지 않아, 첫 `agent start` 두 개가 46초(제한 30초) 걸렸고 이후 시작은 0.35초였습니다(run 40821395497). web lane은 globalSetup의 `endVctip`이 PowerShell을 먼저 돌려 이 실패가 없습니다. 10-23에는 같은 첫 테스트에서 job의 첫 `hided` 시작이 24초 걸려 "hided did not respond"가 됐습니다(run 39930517565, 평소 0.4-0.9초). -> 두 entry point가 같은 `prepareWindowsRun`으로 Herdr와 같은 형태의 PowerShell 시작과 `hided node --version`을 테스트 전에 한 번 하고 걸린 시간을 출력합니다. desktop에는 없던 `endVctip`도 함께 합니다. - **#244 #226 #267** "candidate exit unconfirmed": Windows에서 Playwright는 Electron을 cmd.exe 아래에서 띄우고(`shell: true`), `close()`는 앱의 디버그 파이프가 닫히면 context가 disposed되어 `TargetClosedError`를 삼키고 돌아옵니다(playwright-core 1.63). 기록된 프로세스(cmd.exe)는 그 뒤에 끝나고, cleanup은 바로 `exitCode`를 읽었습니다. -> fixture의 `close()`가 그 프로세스의 `exit`까지 10초 안에서 기다리고, 넘으면 pid를 말하며 실패합니다(home은 보존). - **#163** product analytics: `expect.poll`은 콜백이 던진 오류를 재시도하지 않습니다. daemon의 첫 저장 전에 `core-state.json`을 읽어 ENOENT로 즉시 실패했습니다. -> 없는 파일은 "아직 저장 안 됨"으로 읽고, 다른 오류는 그대로 던집니다. - **#266** handshake: semantic delta는 한 burst에서 바뀐 필드를 모두 싣습니다. 느린 runner에서는 시작 직후의 link backfill이 UI 변경과 같은 frame에 `navigator`를 실었습니다(실패 로그에 `backfill.done`). -> "navigator가 없다" 대신 "partial delta가 싣는 필드는 모두 그 reader가 가진 값과 다르고, 전체보다 적다"를 단언합니다. - **#230** hide-ai usage: usage child는 `fake-claude.cmd` -> `python`이고 그 step이 job의 첫 python 실행입니다(보통 0.9-3.7초, 나쁜 run 21-30초). -> TESTING.md Rust 규칙 8의 `stand_ins::ready_with_args`로 fake를 먼저 한 번 시작합니다(`FAKE_ENV` lock 안에서). - **#264 #265 #212** connect_stop: 이 step이 job의 첫 debug `hided` 시작입니다. 보통 0.8-1.2초, 나쁜 run은 세 테스트가 함께 10-18초, 그 재시도도 6-10초(첫 시작의 cold 비용이 끝나는 시점까지 기다린 것과 맞음). -> 같은 규칙으로 `hide connect` 전에 `hided node --version`을 한 번 시작합니다. - **#141** New tab: 새 탭은 선택되기 전에 먼저 그려집니다. 테스트는 탭 수가 늘고 선택이 draft가 아니면 선택된 탭을 읽었는데, 이전 탭 `w1:t1`도 그 조건을 만족해 이전 탭을 읽었습니다. -> 메뉴 단계가 이미 하듯 선택이 이전 탭을 떠날 때까지 기다립니다. - **#282** real_herdr: 마지막 실패는 fixture 폴더 삭제가 os error 32(다른 프로세스가 사용 중)였습니다. `PrivateHerdr::stop`은 server 프로세스만 기다렸고, Windows에서 pane shell(cwd가 fixture 안)이 server보다 오래 삽니다. -> server를 `OwnedChild`(Windows Job)로 시작하고, stop은 `capture_until`로 server와 그 트리 전체가 끝날 때까지 기다립니다(30초, 넘으면 트리를 끝내고 오류). </details> ## Review - **판단해 주세요**: 첫 시작을 미리 내는 세 곳(#256 #230 #264류)은 테스트가 재는 것과 무관한 cold 비용이라 TESTING.md 규칙 8을 따랐습니다. 다만 실제 PC의 첫 agent 시작·첫 hided 시작에서도 보일 수 있어 제품 쪽은 with-hide/hide-private#326으로 남겼습니다. - **판단해 주세요**: #266 단언은 원래 계약(UI 변경 delta는 바뀌지 않은 section을 싣지 않음)을 약하게 하지 않습니다. 예전에는 `navigator` 하나만 봤고, 이제는 실린 모든 필드가 바뀐 것인지와 전체보다 적은지를 봅니다. `navigator`는 실제로 바뀌었을 때만 실릴 수 있습니다. - **조심해서 볼 파일**: `hided/tests/it/support/private_herdr.rs` - 23곳이 쓰는 fixture의 stop이 이제 트리 종료까지 확인합니다(failure path: 남은 pane이 있으면 오류). - **조심해서 볼 파일**: `desktop/e2e/fixture.ts` - Playwright `ElectronApplication.close`를 감쌉니다(failure path: 끝나지 않는 프로세스는 10초 뒤 pid와 함께 실패, home 보존). - **조심해서 볼 파일**: `web/e2e/platform-fixture.ts` `prepareWindowsRun` - 두 e2e entry point의 Windows 준비 순서(PowerShell, hided, 마지막 compile 뒤 vctip). ## Evidence - **확인한 것 (원인)**: #256 실패 6건이 모두 job의 첫 테스트였고, 최근 30 run 중 1건 실패; artifact의 Herdr 로그로 첫 시작 46초/14.5초/이후 0.35초를 쟀습니다. - **확인한 것 (원인)**: #244의 반환 경로는 playwright-core 1.63 `ElectronApplication.close()`와 `launchProcess`(`shell: true`, `close` 이벤트) 소스로 확인했습니다. - **확인한 것**: `fixture-cleanup.unit.ts`의 새 두 테스트가 수정 전 코드(exit 대기 제거)에서 실패하고 수정 후 통과. desktop unit 28 files 295 passed. - **확인한 것**: desktop typecheck(e2e 포함), web/desktop lint, `verify-cargo.sh fmt-check` 통과. - **확인한 것 (CI 반복)**: 0c6740300에서 verify 40854250922를 두 번(attempt 1, 2) 돌려 둘 다 통과, 재시도 0, flaky 보고 없음. Windows desktop e2e 19/19 두 번(첫 테스트 포함), macOS desktop 58+61 두 번, Rust 6231/6231 두 번, Windows check와 Windows web e2e 통과. 미리 치른 첫 PowerShell 시작은 2.5-5.6 s, Windows usage 테스트 1회차는 첫 Python 시작이 20.7 s 걸렸지만 기한 밖에서 치러져 통과했습니다. - **확인한 것**: 2934e82b7의 #266 assertion은 Linux·Windows에서 결정적으로 실패했습니다(`rest`가 바뀌지 않은 delta는 `rest: null`을 보냄). 0c6740300이 그 frame을 건너뛰게 고쳤고, 위 두 번의 run에서 통과했습니다. - **확인하지 못한 것**: 이 Mac에서 Windows를 돌릴 수 없어 Windows 동작은 이 PR의 CI Windows job으로 확인합니다. 디스크 여유가 2-5 GB라 Rust 테스트(handshake, connect_stop, hide-ai)와 e2e는 로컬에서 빌드하지 못했고 CI로 확인합니다. <details><summary>Verification record</summary> - base: main d8da3e4 - head: 0c67403, verify 40854250922 attempt 1, 2 success - 범위에서 뺀 것(증거는 각 이슈 코멘트에): #214 #169 #254 #255 #280, #324(이번 원인은 트리 누락이 아님) </details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: PRD
agents/prd/close-agent-subtree/prd.mdSummary
close_tree하나로 가장 깊은 하위부터 닫고 대상을 마지막에 닫습니다.close_descendant_pane_ids가 additive로 붙습니다.정리 전 같은 네 모달
Review
confirmed가 목록 전체를 덮어 그대로 닫힙니다(D-22). 노드별 재확인이 필요하면 PRD 변경입니다.parent_pane토큰은 아무 pane이나 쓸 수 있어, checkout 표시를 더할지 정해 주세요.web/src/Overlays.tsx,web/src/close.ts,web/src/components/subtree-list.tsx- 한AlertDialogContent안에서 바뀌는 두 시트 본문, 막힘 시 포커스, 조용한 행의 상태를 툴팁과 접근 이름으로 옮긴 부분.web/src/WorkspaceDialogs.tsx,web/src/workspaceManage.ts- 사실 한 줄과 배지로 바꾼 삭제 확인창, Discard 조건과 버튼 가용성.herdr-core/src/runtime/tree_close.rs,runtime/projects.rs- failure path,Mutex<Runtime>아래 매 ingest와 tick의advance_tree_closes, 삭제 연속.Evidence
sasu implement verifyPASS(cargo test 전체, fmt, clippy).close_treeend-to-end, 기기 연결 끊김 시 시트 닫힘, 잠든 하위의 달 표시와 기기 칩, Delete worktree 실패 표시와 재시도, B25 reopen과 B27 진단(코드 읽기만), 긴 한국어 이름과 스크린리더, 라이트 테마의 새 모달.github::tests의 1초 마감 테스트 두 개가 부하에서 간헐 실패합니다(이 브랜치가 건드리지 않은github.rs). 최종 verify는 통과.agent-tab-names.spec.ts이름 바꾸기 입력 대기가 한 번 실패했고(이 브랜치가 건드리지 않은 흐름), 같은 run의 재실행에서 모든 검사가 통과했습니다.AI tooling: 대부분 AI 도구. 격리 Herdr에서 실제 닫기 순서, 실시간 시트 전환, 네 모달의 전후 스크린샷을 대조했고, 리뷰의 Fix now를 코드와 테스트로 닫았습니다.
Verification record
agents/prd/close-agent-subtree/prd.md(sha256 c70164a75835ebfb11728f339a261aa6df28238e106222ffa6238a9599147df8)agents/runs/close-agent-subtree/verification-report.jsonandagents/runs/close-agent-subtree/verification-report.md; source fingerprint f8f43f25b0d9689191c90e6b75b421c5b9990d6f978b8e4f020f4c336c2e0c5bbash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)remote:<target>:pane:<id>, replica.rs:1804). 모달 정리는 색·글·버튼 이름만 바꿔 Security 재리뷰 대상 아님. 사람 판단: D-22, D-17, 제자리 전환 직후 한 프레임 안의 클릭.