Skip to content

Add the agent lineage tree and the Git worktree section to the sidebar - #18

Merged
yansfil merged 1 commit into
mainfrom
integrate/agent-tree
Sep 6, 2026
Merged

yansfil merged 1 commit into
mainfrom
integrate/agent-tree

Conversation

@yansfil

@yansfil yansfil commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What changed, in one paragraph a new contributor can follow

The sidebar draws agents as a lineage tree: each agent is keyed by the name Herdr gives it (falling back to its pane id), so an agent spawned from another sits under it and a run's fan-out reads as one tree. The right panel gains a Git worktree section that lists every worktree of the focused checkout with its state (branch, detached, prunable, open as a workspace), opens one as a Herdr workspace, and removes one only after stating what will be lost. The worktree reader refreshes when Herdr reports a worktree event by bumping a generation under the mutex and reading git on its own worker, and disk usage is now reported per checkout rather than once. Each policy the section follows (presentation, base policy, deletion policy, refresh boundary, removal boundary, state reader) has an executable check under scripts/, and the approved PRD agents/prd/hide-agent-tree-and-worktree-panel/prd.md is committed with it. Last of the four integration pull requests, after #15, #16 and #17.

Review boundary

  • Runtime mutex: a worktree event only bumps an in-memory generation while the lock is held; the git read starts afterwards on WorktreeReader's worker (check-worktree-refresh-boundary.sh, check-capability-readers-off-lock.sh). Removal runs git from the shell side, off the core entirely (check-worktree-removal-boundary.sh).
  • Snapshot wire: the agent record carries name across the typed boundary (wire.rs maps the contract's AgentInfo.name); worktree state and per-checkout disk usage live in the revisioned rest and change only when a reader reports.
  • Ownership: opening a worktree asks Herdr for a workspace and waits for it; nothing here moves ahead of Herdr on a value it owns. The tree and the section are core-owned read views.
  • Herdr contract: no new method, parameter or field. AgentInfo.name and the worktree_created|opened|removed events are in contracts/herdr-api.schema.json; the two test fixtures that lacked the contract's required focused, revision and WorktreeInfo fields were completed to it.
  • Failure path: a worktree removal that git refuses shows git's message on the row and leaves the worktree listed; a reader failure keeps the last state and logs a component-tagged JSON line; an agent without a name keeps its pane id as its tree key.

Evidence

  • Verified by: cargo test --locked (371 core tests pass), swift test (267 tests pass), the five CI structural checks, check-typed-contract-structure.py, both typed structure lanes, and all eight worktree-section checks (check-git-worktree-presentation.sh, check-git-worktree-states.sh, check-worktree-base-policy.sh, check-worktree-catalog-presentation.sh, check-worktree-deletion-policy.sh, check-worktree-refresh-boundary.sh, check-worktree-removal-boundary.sh, check-worktree-state-reader.sh), run locally on this branch.
  • Not verified (and why): no fresh screenshot of the tree or the worktree section on this branch; the surfaces were exercised on the line they come from, and a visual pass on the assembled main is the next step after this lands. scripts/measure-git-section-idle.sh (idle-cost measurement against a live server) is a local evidence script and was not rerun here.

Screenshots

Not captured for this integration pass; see Evidence.

AI tooling

The resolution onto the typed event enum (refresh_worktrees matched on ReplicaEvent variants), the name mapping in wire.rs, the fixture completion, and this description were produced with AI tooling. Every lane above was run locally afterwards.

Agents are drawn as a lineage tree keyed by the name Herdr gives them, so a
spawned agent sits under the one that started it. The right panel gains a Git
worktree section that lists each checkout's worktrees with their state, opens
one as a workspace, and removes one only after stating what is lost; the
worktree reader refreshes on Herdr's worktree events by bumping a generation
under the mutex and reading git on its own worker. Disk usage is reported per
checkout. The section's presentation, base policy, deletion policy and
refresh boundary each have an executable check, and the approved PRD is
committed alongside.
@yansfil
yansfil merged commit aa709e9 into main Sep 6, 2026
4 checks passed
@yansfil
yansfil deleted the integrate/agent-tree branch September 6, 2026 09:47
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…ide#2152)

Closes with-hide/hide-private#466
Related: with-hide/hide-private#635 (paired docs/desk.md change)

## Summary

Desk가 시작한 세션의 탭을 `◆ Desk` 그룹으로 옮길 때, 그 탭이 지금 화면에 떠 있는 탭이면 화면이 비거나 다른 탭으로
바뀌었습니다.
옮긴 뒤에도 앞 그룹을 원래 그룹(Ungrouped)으로 되돌려 놓았기 때문입니다.
이제 옮기는 탭이 화면의 탭이면 앞 그룹이 그 탭을 따라 `◆ Desk`로 가서, 같은 탭이 화면과 키보드에 그대로 남습니다.
다른 탭을 옮길 때는 전과 같이 앞 그룹을 바꾸지 않습니다.
CI에서 37번 기록된 desk-lane B41의 120초 타임아웃이 이 문제였습니다.

스크린샷 없음: 바뀐 것은 화면이 그대로 남는다는 것이고, 달라 보이는 곳은 그룹 줄의 이름(Ungrouped -> ◆ Desk)
하나뿐이며 web 코드는 건드리지 않았습니다.

## Review

- **판단해 주세요**: 화면의 탭을 옮길 때 앞 그룹이 `◆ Desk`로 바뀌는 것이 "화면을 바꾸지 않는다"(desk.md
B20)의 올바른 해석인지. 대안은 그 탭을 화면에서 내려갈 때까지 옮기지 않는 것인데, 상태가 하나 더 생겨 고르지 않았습니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/desk/jobs.rs`
`desk_place_in_group` - runtime mutex 안에서 도는 publish
경로(`snapshot_delta_payload`)의 일부입니다. 추가 작업은 이미 잡은 view에서 active 탭 비교 한
번입니다.

## Evidence

- **멈춘 단계**: 실패한 CI 두 런(42148906445, 42147984313, Linux shard 4)의
error-context 둘 다 `desk-lane.spec.ts`의 `const front =
...[data-pane-view][data-focused="true"]...getAttribute`에서 120초를 다 썼습니다.
페이지 스냅샷: 사이드바엔 `◆ Desk > Tab 1`(fixture의 유일한 탭), 작업 영역은 `Ungrouped`의
"Start your first tab", 그려진 pane 없음. (lane은 trace zip을 올리지 않아 스냅샷과 hided
로그로 봤습니다.)
- **원인의 순서**: `refresh_desk_jobs`는 publish 끝에서 탭을 옮깁니다. 다음 publish의
`sync_agent_selection`이 먼저 돌면 앞 그룹이 포커스된 탭을 따라가 통과하고, 그 사이 엔진의 session
답이 먼저 오면 빈 그룹을 읽고 보이는 탭과 키보드 pane을 지워(`session.rs` empty_group 분기) 더는
따라갈 탭이 없어 영영 빈 화면이 됩니다.
- **확인한 것**: 새 런타임 테스트
`a_session_desk_started_in_the_tab_in_front_stays_on_screen_in_the_desk_group`이
main에서 실패(`left: (None, Some("w-order:t2"))`, 앞 그룹 Ungrouped에 다른 탭), 수정
후 통과. Desk 런타임 테스트 57개 통과.
- **확인한 것**: `desk-lane.spec.ts` 전체 `--repeat-each 20` (macOS 로컬,
`scripts/verify-web.sh web e2e`) 80/80 통과. 같은 반복을 main 코드로 B41만 돌린 것도
20/20 통과라, 로컬 macOS에서는 이 경합이 재현되지 않습니다.
- **확인한 것 (Linux, 수정 전후)**: 임시 PR 둘에서 desk-lane 네 테스트를 각각 20번씩, 재시도 없이
Linux 6 shard에 나눠 돌렸습니다. 둘의 차이는 이 수정 하나입니다.
  - 수정 있음 with-hide#2156, run 42209054020: Linux 80/80 통과, Windows e2e 80/80 통과.
- 수정 되돌림 with-hide#2157, run 42209058865: Linux 76/80, B41만 4/20 실패(#3, #8, with-hide#14,
with-hide#18). 넷 다 CI와 같은 `getAttribute` 120초 멈춤입니다.
  - 두 PR은 머지 없이 닫고 브랜치를 지웠습니다.
- **확인하지 못한 것**: 로컬 macOS에서는 main도 20/20 통과해 이 경합이 재현되지 않습니다(위 Linux 수정
전후로 대신 확인). Desk가 꺼져 있어도 배치가 도는 것은 문서가 막지 않아 이번 범위 밖으로 두었습니다.
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