Skip to content

Replace the stall clock with a descendant badge and ancestor unread - #126

Merged
yansfil merged 6 commits into
mainfrom
prd/delegated-agent-boundary
Sep 21, 2026
Merged

yansfil merged 6 commits into
mainfrom
prd/delegated-agent-boundary

Conversation

@yansfil

@yansfil yansfil commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Related: PRD agents/prd/delegated-agent-boundary/prd.md

Summary

  • A delegated child that worked through a long turn tripped the stall clock: "N minutes on no visible progress" on the parent at 5 min and Needs You at 15 min, indistinguishable from a real stall.
  • The stall clock is gone: StallClock, both thresholds, escalation, stall_notice/stall_level, the escalated ownership value, the row notice and its tests.
  • A parent row now carries a descendant badge (× ! ? ● ✓ with counts) summed over every live descendant; ready children and unknown ones are not drawn, unknown ones are logged.
  • A descendant entering or changing a demand, or finishing a turn, turns every ancestor unread through the read fingerprint; starting work, a resolved demand and a closed pane do not. No new store, timer or event.
  • Descendants fold by default (expanded_agent_pane_ids replaces collapsed_agent_pane_ids, old key ignored); the role column shows >/⌄/↳/blank and the worktree name moves into the qualifier slot.

Folded parents wear the descendant badge; the worktree child carries the return glyph

Opened, the badge withdraws and the child names its worktree in the qualifier slot

A read, completed parent (left) rises to Done with a ?1 badge when its child asks (right)

Review

  • 판단해 주세요: 후손 배지에서 ready(idle, 완료 없음)인 자식은 세지 않고, 카운트가 모두 0이면 배지를 그리지 않는다 (PRD B7 해석).
  • 판단해 주세요: 자기 워크트리 헤딩 아래 depth 0으로 올라온 자식은 chevron 대신 ↳를 우선하고, 툴팁은 기존 pane 헤더의 "Return to parent " 문구를 재사용한다.
  • 판단해 주세요: design/hide-ui.lib.pen의 Escalated child / Hard stall 상태 노드는 삭제만 했고, 배지·역할 글리프 마스터는 아직 라이브러리에 없다.
  • 조심해서 볼 파일: herdr-core/src/sidebar.rs - read 지문에 후손 신호가 들어가고 record_covers가 부분집합 비교로 바뀜(ownership, failure path); apply_lineage가 두 pass가 됨(high-frequency path, ingest마다 후손 합산).
  • 조심해서 볼 파일: herdr-core/src/runtime/session.rs, runtime/agents.rs - ingest 순서가 lineage → read로 바뀜(runtime mutex 안의 일), 원격 경로도 같은 순서.
  • 조심해서 볼 파일: herdr-core/src/model.rs, macos/Sources/HerdrMacOS/CoreBridgeWorkspaceSnapshot.swift - descendant_counts가 snapshot wire에 새로 실리고 stall_* 필드가 빠짐(snapshot wire).
  • 조심해서 볼 파일: herdr-core/src/persistence.rs - 저장된 collapsed_agent_pane_ids는 읽지 않고 버림(마이그레이션 없음).
  • 질문: 위임된 자식이 Working인 조상은 unread가 되어도 화면에 배지 변화만 보이는데(B5), 그 상태를 따로 표시할 필요가 있는지.

Evidence

  • 확인한 것: 코어 테스트 5개(lineage.rs 4개 + sidebar.rs reconnect 1개)가 후손 요구/완료 → 조상 unread, 시작·해소·닫힘은 아님, 그룹은 자기 축만, 배지 합산, stall 필드 부재, 재접속 시 신호 보존을 각각 검증; Swift presentation 테스트 5개(DelegatedRowPresentationTests)가 배지 표시/숨김, 역할 글리프, qualifier 슬롯을 검증.
  • 확인한 것: verify-cargo.sh test 전 크레이트 green, verify-swift.sh test 538 passed, verify-cargo.sh lint 0 warnings, check-design-contract.mjs PASS, gen-pen.mjs 드리프트 없음, check-core-bridge-structure.py OK.
  • 확인한 것: 격리 Herdr 0.9.1 서버(전용 소켓·HOME·XDG, 워크스페이스 0에서 시작) 위의 dev 앱을 정확한 window id로 배경 캡처해 보드 B(접힘+배지 ●2, 긴 한글 제목·배지·경과 시간 한 줄), C(펼침, qualifier), D(자식 질문 전후: Working 부모는 배지 ?1 ●1만 바뀌고, 읽은 완료 부모는 Seen ○에서 Done ✓로 올라와 raised), B8(다시 읽으면 Seen으로, 배지 유지), 재실행 후 접힘 유지를 확인. 모든 클릭은 QA 앱 PID에 묶인 AXPress.
  • 확인하지 못한 것: 원격 타깃의 후손 배지와 unknown 로그는 단위 경로만 읽었고 실제 원격 서버로는 돌리지 않았음. 5분 이상 실제 위임 turn 동안의 동작은 fixture 토큰으로만 재현했음. Agents 탭(flat 목록)의 ↳ 행은 Swift 테스트로만 확인했음.
  • 생성물: design/hide-ui.lib.pen에서 stall 상태 노드 4개를 구조적으로 삭제(68줄), gen-pen.mjs 실행 후 드리프트 없음.

AI tooling: 대부분 AI 도구; PRD B1-B15와 승인된 디자인 보드 B/C/D, 네이티브 스크린샷을 손으로 대조했다.

Verification record
  • PRD: agents/prd/delegated-agent-boundary/prd.md (sha256 301665ea2042f0a74e54e2b37b82acdc24b41637f064c59f81a44969078c1db4)
  • Base c942b95 → head 53a5089, verified 2026-09-21T03:57:36.532Z: PASS
  • Verification report: agents/runs/delegated-agent-boundary/verification-report.json and agents/runs/delegated-agent-boundary/verification-report.md; source fingerprint e50a607d521ceee2ef37aa533265903e4357b53d29e305fa8d626e85c04e731c
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-swift.sh test (exit 0)
    • S3: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Reviews (advisory, both at head 53a5089):
    • Fidelity: Fix now none at 27c2b05 and 53a5089. Follow-up: ↳ uses SF Symbol arrow.turn.down.right for the design's corner-down-right (documented in DESIGN.md); note that the raised-row return glyph rule also covers the flat Agents view; the badge and role glyph have no library master yet.
    • Code: Fix now at 27c2b05: (1) reconcile_read_records absorbed a descendant signal that arrived during a Herdr reconnect, fixed in 53a5089 with reconnect_keeps_a_descendants_new_question_unread_on_the_parent; (2) the remote session path never logged unknown descendants, fixed in 53a5089. Re-review at 53a5089: none. Follow-up: anOrphanHasNoParentToReturnToAndKeepsItsHint asserts only the blank role; descendant_signals_of could emit a demand and a completed signal for one pane in one tick if both were ever reported together.
  • Evidence: 9 registered (7 screenshot, 2 log); paths are local to the run directory
    • agents/runs/delegated-agent-boundary/native/shots/00-launch-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/01-expanded-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/04-after-ask-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/05-quiet-read-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/06-quiet-child-asked-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/07-quiet-reread-crop.png
    • agents/runs/delegated-agent-boundary/native/shots/08-relaunch-folded-crop.png
    • agents/runs/delegated-agent-boundary/native/native-run.md
    • agents/runs/delegated-agent-boundary/native/server-start.log
  • Changed paths: 28 (see Files changed)

A delegated child's question, approval, error or completion no longer runs
a clock that escalates its lineage root into Needs You. Each row's live
descendants are counted on the lineage pass into a badge the row wears
while they are folded, and their demands and completions ride the row's
read fingerprint as descendant signals, so an ancestor turns unread the
same way its own state change would and its group stays what its own axes
decide. Descendants are folded by default: the persisted collapsed set is
replaced by an expanded set and an old store's collapsed ids are ignored.

The role column draws the fold chevron, a return glyph on a child listed
away from its parent, or nothing; a child under its opened parent names
its worktree on the qualifier line and the loose worktree chip is gone.
The escalation state examples leave the design library with the state.
…mote descendants

A Herdr connection bootstrap rebased a parent's read record with its
current fingerprint, which absorbed a child's question that arrived while
Hide was disconnected. The rebase now keeps the descendant signals the
operator had actually seen. The remote session path logs unknown
descendants the way the local ingest does.
@yansfil
yansfil merged commit 12e15cb into main Sep 21, 2026
5 checks passed
@yansfil
yansfil deleted the prd/delegated-agent-boundary branch September 21, 2026 04:24
yansfil added a commit that referenced this pull request Oct 29, 2026
Closes with-hide/hide-private#153
Closes with-hide/hide-private#152
Closes with-hide/hide-private#148
Closes with-hide/hide-private#218
Closes with-hide/hide-private#213
Closes with-hide/hide-private#227
Closes with-hide/hide-private#319
Closes with-hide/hide-private#159
Closes with-hide/hide-private#246
Closes with-hide/hide-private#186
Closes with-hide/hide-private#126

## Summary

herdr-core의 연결 노드 runtime 테스트 11개가 가끔 실패하던 원인을 고쳤습니다.
대부분은 테스트가 순서를 직접 정하지 않아 백그라운드 작업이 끼어든 경우였고, 그중 둘은 제품 쪽 문제였습니다.

- 정리(cleanup) 검토 결과가 화면에 나온 바로 그 순간 누른 "정리" 확인이 조용히 버려졌습니다. 이제 검토 결과와 다음
작업 허용이 같은 순간에 일어나서 확인이 항상 받아들여집니다.
- 새 pane의 셸 대기에서, 마감이 읽기 도중에 끼어들면 앞서 실패한 이유가 지워져 진단 기록이 "unreadable" 대신
"timeout"이 되거나 엉뚱한 이유를 남겼습니다. 이제 마감에 잘린 읽기는 결과로 치지 않습니다.

대기 시간을 늘리거나 재시도를 더하지 않았습니다.
with-hide/hide-private#274(doorbell 두 테스트)는 재현되지 않아 범위에서 뺐고, 원인 후보와 증거를
이슈에 남겼습니다.

스크린샷 없음: 화면을 바꾸지 않는 core와 테스트 변경입니다.

## Review

**제품 동작이 바뀌는 곳** (둘 다 수정 없이 실패하는 테스트로 증명, Evidence 참고):

1. `herdr-core/src/worktree_cleanup.rs` `WorkerGuard`, `worker_ended` -
정리 worker가 마지막 snapshot 전달과 lane 해제를 한 lock 안에서 합니다(전에는 lock 두 번).
`runtime/projects.rs` `confirm_cleanup`은 lane이 잡혀 있으면 확인을 거절하는데, 검토 답과
lane 해제 사이에 온 확인이 여기서 버려졌습니다(#152의 CI 로그: 10초 동안 제거 진단이 하나도 없음).
- `Mutex<Runtime>` 아래 일: 늘지 않았습니다. 같은 `ingest_cleanup`과
`cleanup_worker_finished`(필드 하나를 `None`으로)를 두 번의 lock 대신 한 번의 lock에서
합니다. 새 I/O, subprocess, 직렬화는 없고 `notify`는 전처럼 lock 밖입니다.
`scripts/check-capability-readers-off-lock.sh` 통과.
- 판단해 주세요: lane 해제가 마지막 답과 묶였으므로 `confirm_cleanup`의
`cleanup_worker.is_some()` 거절은 이제 "검토가 아직 loading 중"일 때만 걸립니다. 그 주석을
고쳤습니다.
2. `herdr-core/src/runtime/terminal_input.rs` `wait_with` - 셸 대기의 반복이
시계와 한 번의 읽기를 받아 돌고, 마감에 걸쳐 끝난 읽기(결과가 무엇이든)는 결과로 치지 않아 마지막으로 끝난 읽기의 결과가
남습니다. `shell_reads_keys`는 main과 같습니다. 결과는 `terminal.input_shell_wait`
진단의 `outcome`/`reason`에만 쓰이고, 키는 어느 경우든 그대로 써집니다.

다음 둘은 지시서에 제품 변경 후보로 적혔지만 **테스트 fixture만** 바뀝니다: #218/#213의 held
link(`runtime/tests/inbound.rs`), #227/#319의 연결
전환(`runtime/tests/links.rs`).

**조심해서 볼 파일**:
- `runtime/tests/inbound.rs` - held link의 Herdr가 link가 풀릴 때까지
`connect`에서 기다립니다(전에는 없는 socket이라 즉시 거절). 그 거절을 node session sync가 받아
테스트가 연결해 둔 node를 끊긴 상태로 덮었습니다. link를 쓰는 모든 테스트(inbound,
hide_ai_devices)가 통과하지만, 끝까지 release를 쥔 테스트가 있으면 멈출 수 있는 구조라 봐 주세요. 이전의
10초 자동 종료(`recv_timeout`)는 없앴습니다.
- `runtime/tests/node_issues.rs` - 확인을 검토 답의 announcement 안에서
누릅니다(`ChangeNotifier::announcing`). 콜백 안의 panic은 삼켜지므로 값을 모아 밖에서
assert합니다.
- `suggestions/worker.rs` `handled` - 실행 중인 run이 없는 pen 명령의 거절 답을
barrier로 씁니다. 상태를 바꾸지 않는 명령이라 골랐습니다.
- `docs/TESTING.md` - The test decides the order와 Wait for state에 규칙 네
줄을 더했습니다.

<details><summary>이슈별 원인과 처리 (main 8a865d8 기준)</summary>

| 이슈 | 테스트 | 원인 | 처리 |
| --- | --- | --- | --- |
| #153, #148 | `runtime::delivery::tests::moved_terminal_keeps_…`,
`remote_observation_without_a_local_socket_…` | `Worker::spawn`이
doorbell/watch producer를 띄워 자기 시계로 pass를 돌림. watch tick이 fixture의 옮겨진
child를 못 읽고 폴더가 없다고 보면 watch를 끝냄(`watches.len()` 0, `watches[0]` index),
store가 쓰는 중에 테스트가 파일을 읽음(`ledger_unavailable`, 로컬 재현) | #1812와 같은 규칙: 이
파일의 테스트 12개를 `Worker::store`로, 파일을 읽기 전에 store를 멈춤 |
| #152 | `node_issues::a_node_s_merged_worktree_is_removed_…` | 제품: 위 1번
| worker 마지막 답과 lane 해제를 한 lock에서. 테스트는 가장 이른 순간에 확인 |
| #218 |
`inbound::a_node_pane_s_hide_memory_reads_for_the_node_s_session` | node
session sync의 `socket_missing` 답이 테스트가 넣은 session 뒤에 도착해 node를 끊김으로
바꿈(`pane_not_connected`, 실패 0.04초) | held link의 Herdr가 link 동안 답하지 않음 |
| #213 | `inbound::a_moved_core_reads_its_own_kit_…` | 같은 원인 + kit 작업이
대기열에 남은 채 dispatch하면 node는 `checking`이 되지 않음, dispatch 뒤 lock을 놓은 사이 답이
끝날 수 있음 | 대기열까지 비기를 기다리고, dispatch와 확인을 한 lock에서 |
| #227, #319 | `links::a_native_fork_keeps_state_changes_…` (#227의 새 이름이
#319) | "다음 connect에 전환" arm을 fork worker 옆의 control lane(focus)이 가져가면,
전환이 fork worker의 확인 뒤에 적용되어 `pane.get`이 옛 서버로 감 | 전환을 fork worker 자신의
thread connect에서만(같은 fixture의 archive 테스트도) |
| #246 | `ssh_hosts_list::the_host_list_names_each_alias_…` | dispatch 뒤
lock을 놓은 사이 fake 답이 끝나 `loading`을 못 봄 | dispatch와 확인을 한 lock에서 |
| #126 |
`suggestions::worker::tests::a_weak_line_waits_fourteen_quiet_days_…` |
fixture의 barrier read가 전날의 남은 read일 수 있음. 그러면 clock이 `Wake` 처리 전에 움직여
run이 실제 3분 뒤로 밀리고 10초 대기가 끝남(로컬 재현) | 응답 채널이 있는 명령으로 barrier(`handled`)
|
| #159 | `memory_analysis::tests::a_linked_node_s_closed_session_…` |
테스트가 Memory hook의 1초 제품 예산 안에서 읽음, 부하에서 답이 비었음(로컬 37%) | hook 답 대신
scope가 가리키는 Project를 직접 확인. hook 답은 `memory_hook` 테스트의 몫이고 뒤의 receipt
확인은 hook과 무관해 그대로 |
| #186 | `terminal_input::tests::a_terminal_that_is_never_read_…` | 제품:
위 2번 | 잘린 읽기는 결과가 아님. 두 테스트(기존 것과 잘림 규칙 새 것)는 테스트가 움직이는 시계와 정해 둔 읽기로 돌아
socket과 벽시계에 기대지 않음, bound 150ms 그대로 |
| #274 | doorbell 두 테스트 | 재현 안 됨(fixture는 10-09부터 store만 띄움, 실패 둘 다
store의 5초 답 기한) | 범위 제외, 이슈에 증거 코멘트 |

</details>

## Evidence

- **확인한 것 (수정 전 재현)**: main 코드 테스트 바이너리로 12개 테스트를 각 200회, 24개 병렬, load
average 31-38에서 돌림: #159 74/200, #148 1/200(`ledger_unavailable`), #186
1/200, #126 1/200(`a read: Timeout`), 나머지 0/200.
- **확인한 것 (수정 후)**: 같은 조건(각 200회, 24병렬, load 27-42)에서 수정 후 바이너리로 12개
테스트와 새 잘림 테스트를 돌림: 2,600회 실패 0.
- **확인한 것 (수정 없이 실패)**: #152 - `worktree_cleanup.rs`와 `projects.rs`만
main으로 되돌리면 새 순서의 node 테스트가 5/5 `a confirmation pressed on the answer is
taken`으로 실패. #186 - 반복의 잘림 분기 한 줄만 지우면
`a_read_the_bound_cuts_short_leaves_the_last_failure_as_the_reason`이
`Timeout`(기대 `Unreadable("link down")`)으로 실패.
- **확인한 것 (#186 재수정 뒤)**: 두 셸 대기 테스트 각 200회, 24병렬, load 25-29: 실패 0.
- **확인한 것 (CI)**: verify run 40823301322(head 808270c) 성공, rust
workspace Linux를 포함한 모든 lane에서 재시도로 통과한 테스트 없음.
- **확인한 것**: 로컬 `verify-cargo.sh nextest -p herdr-core --retries 0`
3437/3437 통과.
- **확인한 것**: 바뀐 모듈 295개 테스트 통과, `verify-cargo.sh clippy -p herdr-core
--all-targets -D warnings`, `fmt-check`,
`check-capability-readers-off-lock.sh` 통과.
- **확인하지 못한 것**: #218, #213, #227/#319, #246, #153, #152는 로컬 부하 200회에서
수정 전에도 재현되지 않았습니다(CI Linux에서만 기록). 원인은 CI 로그(실패 시각, 진단 순서)와 코드로 정했고,
Linux 반복은 이 PR의 CI 실행으로만 봅니다. 이 맥은 Linux 호스트가 없고 디스크 여유가 3-9 GB입니다.

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

- base: main 8a865d8, head: ae7f390 (CI verify run 40826129061
success, no test passed only on retry)
- before binary: main 8a865d8, after binary: 커밋 전 작업 트리(포맷만 다름)
- load repeat: `repeat.sh <bin> <tests> 200 24`, 테스트 하나당 프로세스 하나, macOS
arm64
- CI #152 로그: run 40817735918 job 123262761058, TRY 1 FAIL 11.029s,
`worktree.*` 진단 없음
- CI #218 run 40675696797, #213 run 40485064142: TRY 1 FAIL
0.040s/0.034s, 패닉 직전 `remote.session_unavailable socket_missing`

</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.

1 participant