Repository navigation
feat: keep checkout Git state current with a background fetch and one merge judgment - #1564
Merged
Merged
Conversation
…ault branch Every git a node starts goes through hide_host::git_run: no terminal, askpass, Credential Manager or ssh prompt, closed stdin, a deadline and an output cap. The repository's default branch is the Project Settings base, else GitHub's defaultBranchRef, else origin/HEAD; worktrees::merged is the one judgment the sidebar landed mark and the cleanup review share (ancestry of the default branch, or a merged pull request whose head is exactly HEAD), and the cleanup review no longer assumes main.
…ng commits Each node fetches its registered repositories' origin off every lock, the front one each minute and the rest every five, one at a time per node, and never prompts for a credential. The header detail says when the remote was last checked, the history shows commits not pulled yet and opens a commit's GitHub page, and Project Settings can turn the fetch off per project.
Each connected device gets the same Git watch this machine has, over the common directories its worktree read named, driven by the fetch pump off every lock. A repository that changed there is read again by the device catalog, a change during a read is read right after it, and the watches rest while no window is attached.
…a read fails The header's Git read, each CI result and the remote check share one observed shape: the last value stays, with when it was read and whether it is fresh, stale or behind a failed read. A failed CI read no longer erases the results, the poll's paused or rate-limited projects read as stale, and the project in front is polled even with no pull request open.
Fixture homes allow only the file Git transport, so the background fetch never reaches the network from a test.
yansfil
added a commit
that referenced
this pull request
Oct 22, 2026
## Summary
에이전트가 자기 일의 계획을 `hide plan`으로 올리면, Hide가 그 단계를 pane 옆 지도로 그리고 매 프롬프트에 지금
단계를 알려 줍니다.
`--ask`로 올린 계획은 운영자의 검토를 기다리는 질문이 되어 pane 띠, 사이드바 둘째 줄, 벨, 폰에 같은 길로
뜨고(core는 문구 없이 `ask_subject` `{cause: plan_review, steps}`만 보내고 각 화면이 자기
언어로 씁니다), 에이전트가 `hide plan approve`할 때까지 파일 쓰기와 `git commit`/`git push`가
막힙니다.
pane 머리의 옛 작업 칩 자리에 계획 칩(`n/m`, 검토 중이면 `Review`)이 생기고, 팝오버는 작은 지도, `크게
›`는 보기 칸의 큰 지도입니다.
계획은 세션 기록과 같은 저장소에 남아 재시작 뒤에도 읽히고, 세션이 지워지면 함께 지워집니다.

검토로 올린 계획(영어 UI): 칩 `Review`, pane 띠와 사이드바 둘째 줄이 `Plan review · 5
steps`로 묻습니다. 한국어 UI에서는 `계획 검토 · 5단계`입니다.
## Review
- **판단해 주세요**: B20의 "같은 자리에서 끈다"를 Settings › Agents의 에이전트 스위치로 읽었습니다. 스킬
줄은 읽기 전용이고 스킬마다 끄는 스위치는 없습니다(kit에 그 상태가 없음). 스킬별 스위치가 필요하면 후속으로 나눕니다.
- **판단해 주세요**: 재계획에서 빠진 `done` 단계는 `done`인 채 "바뀜"으로 남깁니다(빠진 나머지는
`dropped`). `n/m`이 뒤로 가지 않게 하려는 선택입니다.
- **판단해 주세요**: 새 토큰 `--size-plan-node-compact: 144`(팝오버 작은 지도의 카드 폭).
- **조심해서 볼 파일**: `herdr-core/src/runtime/plans.rs` - runtime mutex 안의 일.
`refresh_plan_reviews`가 snapshot 경로에서 계획 책이 바뀐 때만 보이는 행에 검토 질문을 다시 얹고,
얹었던 것만 걷어 냅니다.
- **조심해서 볼 파일**: `herdr-core/src/agent_state/turn.rs`, `header.rs`,
`tally.rs` - snapshot wire. 행의 `ask_subject`가 `state.line.subject`,
`state.ask.subject`, 띠 `subject`, 벨과 폰 알림의 `subject`로 그대로
갑니다(`ask_subject_cause`를 `snapshot-wire-enums.json`에 등록). 이 행은 `detail`이
비고 상태 단어만 남습니다.
- **조심해서 볼 파일**: `web/public/m/sw.js`, `web/src/mobile/push.ts` - 폰이 닫혀
있어도 알림을 쓰도록 페이지가 `{{count}}`를 남긴 문구를 서비스 워커에 넘기고, 워커가 단계 수를 채웁니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/snapshot_delta.rs` - snapshot
wire. 위 호출이 `refresh_missions` 앞에 들어갑니다.
- **조심해서 볼 파일**: `herdr-core/src/links/` - 링크 worker가 유일한 SQLite writer,
스키마 9에 `ledger_plans` 표(#1565의 8 다음).
- **조심해서 볼 파일**: `hide-agent-hooks/src/plan_record.rs`,
`hide-agent-hooks/src/delivery.rs` - failure path. PreToolUse는 core를 부르지
않고 pane 기록 파일만 읽습니다. 읽지 못한 계획 요약은 요약만 버리고 편지는 그대로 전합니다.
- **조심해서 볼 파일**: `herdr-core/src/dag.rs` - 미션 그래프 코드를 옮긴 것(동작 그대로, 미션
테스트 77개 통과).
- **비용 검토**: 고빈도 경로 추가는 snapshot마다 `plans.edit` 비교 한 번입니다. 계획이 바뀐
publish에서만 행 복사, lineage, 읽음 축을 다시 돕니다. 계획은 128개(`PLAN_LIMIT`), 단계는
64개(`plan_too_large`)로 막히고, `laid`는 보이는 pane으로 잘립니다.
## Evidence
- **확인한 것**: 격리된 Herdr와 hided 위의 Playwright e2e
`web/e2e/plan-review.spec.ts`. `--ask` → 칩 Review, 띠와 사이드바 `Plan review
· 4 steps`(영어 UI), approve → 띠와 사이드바가 비고 1/4, 일하는 단계가 둘째 줄, 순서 거절
`plan_order_refused`, 2/4, 팝오버 4단계, `크게 ›` → 보기 칸 큰 지도(아래로 흐름), drop → 칩
사라짐.
- **확인한 것**: 격리된 후보 Electron 창(Playwright renderer capture, 사설
HOME/state/Herdr)에서 아래 화면 네 장. 운영자 앱과 서버는 쓰지 않았습니다.
- **확인한 것**: 핵심 회귀 - 다른 Herdr 이벤트 없이 approve만 해도 검토 질문이 행에서 걷힘(첫 캡처에서 남아
있던 것을 고침, core 테스트로 고정).
- **확인한 것**: core plan/mission 테스트, delivery-envelope 계약 테스트(계획 요약과 힌트
예시), hide-agent-hooks 전체(훅이 `hide`를 부르지 않고 거절), hided CLI 계약, hide-kit,
web 전체(`scripts/verify-web.sh`), design contract, cargo lint(clippy,
fmt).
- **확인하지 못한 것**: OpenCode와 Pi 플러그인 helper의 계획 거절 경로는 테스트가 없습니다(Claude
Code CLI 경로만 픽스처로 증명).
- **확인하지 못한 것**: 연결된 기기의 pane(B22), 폰 줄(B24)은 실행해 보지 않았습니다. 같은 질문 행을
읽는다는 것은 코드로만 확인했습니다.
- **확인하지 못한 것**: 실제 macOS 창 크롬과 네이티브 입력(renderer capture만 했습니다).
- **확인하지 못한 것**: 한 번 OpenCode plugin2 테스트 "a terminal that misses an
answer…"가 부하 중 실패했고 재실행에서 통과했습니다. 이 변경과 무관해 보입니다.
<details><summary>추가 증거</summary>

approve 뒤: 묻기가 사라지고 칩 `1/5`, pane 둘째 줄이 `core 이벤트 · 이벤트 쓰는 중`.

칩 팝오버: 끝난 단계 채움, 지금 단계 진행색과 `Now`, 기다리는 단계 점선, `PR` 꼬리.

`크게 ›`가 보기 칸에 큰 지도를 엽니다.
</details>
<details><summary>Verification record</summary>
- PRD: `hide-plan` (D-01..D-30, B1..B24), head `e52d7f7b7` (main merged
four times: `02f9043c0`, `d55a5218e` with #1564, `68e6fcba4` with #1565,
`8a6ca61af` with #1567; the last keeps both sides' 보기 items, Plan beside
Worktrees and Cost, and 55 shortcut rows).
- Review band wording moved out of the core (`e6e898dc3`): the row
carries `ask_subject`, and web, bell and phone word it with
`plan.askReview`; core test compares the wire structure, web tests cover
en/ko line, bell and service worker; e2e `plan-review.spec.ts` passes
with the English text; isolated capture replaced.
- Reviews of `e6e898dc3`: Code review found a raised ask (a blocked
delegated child carrying the subject) would word the label line on its
root; `22e41901a` carries `subject` on `RaisedAsk` to the root's ask,
band, turn card and tree popover, with a core test. A plain laid review
does not raise on its own (`ChildBlocked` needs the child's own block),
so this was a latent path. Fidelity review: the same popover sites,
fixed by the same commit; no other Fix now. Follow-ups:
`overviewTasks.cardLine` reads only `ask.what` (its one consumer falls
back to the subject).
- `sasu implement verify`: PASS on `e52d7f7b7` (and on `22e41901a`,
`8a6ca61af`); CI `verify` green on `e52d7f7b7` (run 39855795741). The
phone's cached words now include the plan review template
(`mobile.spec.ts` expectation, `e52d7f7b7`). Code review of the
`8a6ca61af` merge: no Fix now.
- Earlier: `sasu implement verify` PASS on `68e6fcba4` (S1
`verify-cargo.sh test`, S2 `verify-cargo.sh lint`), and earlier on
`02f9043c0` and `7582bce1e`.
- Before the merge, two runs on `3c96a8381` each failed one unrelated
timing test under machine load (load average 20 to 28):
`memory_analysis::...a_linked_node_s_closed_session...` and
`memory_hook::...short_continuations...` (`Deadline` for `Empty`). Each
passed alone, neither file is in this diff.
- Link store schema: #1565 merged first and took version 8
(`closed_result`); `ledger_plans` is version 9, applied after it in the
same migration. Code review of the move: no Fix now (a store a pre-merge
build of this branch stamped 8 would miss `closed_result`; only
throwaway candidate stores).
- Fidelity review on `6195d35af`: 6 Fix now, 5 fixed (done steps on
replan, `--json` revise route, record 지금 line, waypoints icon,
`plan_not_yours` test), 1 left to the reviewer (B20 per-skill off).
Follow-up on `3c96a8381`: no Fix now.
- Code review on `6195d35af`: 4 Fix now, all fixed (`plan_too_large` and
`--json` errors as JSON, review question lifted from shown rows,
`--json` revise route, unreadable plan summary keeps the letters).
Follow-up on `3c96a8381`: no Fix now.
- After the merge, Fidelity found that a deleted session's plan item
closed the viewing column instead of showing the documents (main's
lane-two-columns B13); `drop_detail_items` fixes it for plans and
missions (`2b4b5ad79`). Both reviews of `02f9043c0..7582bce`: no Fix
now.
- CI web e2e linux 5/6 (`s2.spec.ts` shortcut count 53 vs 54 with Show
plan) fixed in `7582bce1e`.
- Follow-ups carried: plan context before the restore finishes, skip the
row copy when no plan is proposed, remote rows' read mark after a
re-lay, bell on a review laid at pull time, ghost steps toward the 64
cap, session precedence after `/clear`, device clock skew, pane record
cleanup, eviction note, OpenCode and Pi helper test, `git rebase
--continue`, a documents-return assertion on the plan delete path,
re-reading a record under a dropped plan.
- Evidence: 5 isolated renderer captures registered (B5, B7, B11, B12,
B14); e2e `web/e2e/plan-review.spec.ts`.
</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.
Summary
헤더의 ↑↓와 최근 커밋이 운영자가 직접 fetch하기 전까지 몇 시간씩 낡아 있었습니다.
이제 Hide가 등록된 저장소를 백그라운드에서 fetch합니다(앞 저장소 1분, 나머지 5분, 노드마다 하나씩, 어떤 창도 띄우지 않음).
헤더 상세는 마지막 원격 확인 시각을 보여주고, 최근 커밋은 아직 받지 않은 커밋을 위에 흐리게 보여주며, 커밋을 누르면 GitHub 커밋 페이지가 열립니다.
병합 판정은 사이드바와 디스크 정리 검토가 하나를 쓰고(squash/rebase는 PR head가 HEAD와 정확히 같을 때만), 기본 브랜치는
main고정이 아니라 Project Settings > GitHub > origin/HEAD 순입니다.연결된 기기도 그 기기에서 fetch되고 Git 변화를 바로 따라오며, 읽기가 실패하면 마지막 값을 나이와 함께 흐리게 유지합니다.
수동 fetch 없이 앱을 연 지 2.4초 만에 ↓2와
Remote checked 1s ago가 나타남 (격리된 후보 앱, octocat/Hello-World 클론)받지 않은 커밋 두 줄이 로컬 커밋 위에 흐리게
Not pulled, 누르면 Browser View에 GitHub 커밋 페이지Review
리뷰 순서는 커밋 층 순서입니다(각 층은 그 커밋으로 되돌릴 수 있음): 1 실행기·병합 판정·기본 브랜치, 2 fetch·헤더·커밋 링크·설정 스위치, 3 기기 Git 감시, 4 관찰값 모양·폴링 범위, 5 e2e, 이어서 리뷰 수정 커밋.
--prune이 운영자가 쓰던 원격 추적 ref를 지울 수 있다는 점(끄기 스위치는 Project Settings > Working style).Observation으로 적용했고, PR 목록은 기존GithubStatusSnapshot(마지막 성공 시각 + stale)을 같은 뜻으로 씁니다.refs/remotes/origin/밖으로만 쓰는 저장소(미러 설정)는 로컬 브랜치를 지킬 수 없어 fetch하지 않습니다. 보안 리뷰에 따른 의도적 예외입니다.hide-host/src/serve.rs,hide-node/src/ssh/host.rs- 링크에 세 번째 레인(백그라운드 Git, 슬롯 2)을 추가해 기기 Git 감시와 fetch가 머신 호출 슬롯 4개를 차지하지 않게 했습니다. 양 끝이 같은 빌드여야 해서 프로토콜 52 안에 넣었습니다.hide-host/src/git_run.rs- 모든 노드 git 실행의 비대화형 환경, fetch와 clone은 운영자의 ssh 명령(GIT_SSH_COMMAND>core.sshCommand>GIT_SSH)을 유지하고ssh일 때만BatchMode=yes등을 뒤에 붙입니다.herdr-core/src/fetch.rs- 1초 펌프가 잠금을 잡는 방식, fetch 스레드와 기기 감시의 종료(감시 drop은 펌프 스레드에서 최대 3초 기다림), 실패한 기기 읽기의 30초 뒤 재시도.herdr-core/src/runtime/fetch.rs- 일정·백오프·인증/오프라인 일시정지 상태 기계, 같은 ref 잠금이 세 번 연속이면 실패로 셈(잠금 아래 I/O 없음).herdr-core/src/worktree_cleanup.rs- 정리 후보가 GitHub 병합 PR head로 넓어지는 경로, 목록에 없는 HEAD는 브랜치별 조회(삭제는 여전히 운영자 확인).herdr-core/src/runtime/device_catalog.rs- 기기 감시가 표시한 저장소만, 움직인 worktree만 다시 측정하는 경로.docs/PERFORMANCE_TESTING.md상시 작업 표에 두 줄이 있습니다.리뷰 결과와 처리:
reuse_unchanged).GIT_SSH_COMMAND가 운영자core.sshCommand를 덮음 → 운영자 명령 유지, 옵션만 덧붙임.--no-write-fetch-head는 Git 2.29 이상 → Git 버전을 한 번 읽어 그보다 낮으면 빼고 fetch.a와a/b충돌은 바로 실패.같은 수정에서 fetch에
--no-recurse-submodules,gc.auto=0,maintenance.auto=false를 더했습니다."C:/Program Files/OpenSSH/ssh.exe"를 ssh로 알아보지 못함 → 따옴표 경로를 한 단어로 읽음.충실도 지적(B17): 검토만 오래된 병합을 찾아 사이드바와 답이 달라질 수 있음 → 검토가 브랜치로 증명한 head를 코어가 기억해 사이드바 표시에 합침(060803a).
remote.origin.fetch가 로컬 브랜치로 쓰는 저장소(미러 설정)는 자동 fetch가 로컬 브랜치를 지우거나 되돌릴 수 있었음 →refs/remotes/origin/아래로 쓰는 refspec만--refmap=과 함께 넘기고, 그런 refspec이 없으면 fetch하지 않음(0e90630). 로컬 브랜치가 그대로인지 테스트로 확인.-로 시작하면 git 옵션으로 읽힐 수 있음 →--를 넣고 그런 값을 버림, 실행되지 않음을 테스트로 확인. 보안 낮음 1건, 검토 도중 기본 브랜치가 바뀌면 증명이 다른 기본 브랜치에 저장될 수 있음 → 검토가 판단한 기본 브랜치로 저장하고 맞지 않거나 사라진 프로젝트의 항목은 버림(18d76ea).남은 후속(이 PR 범위 밖으로 둔 것):
Permission denied는 로컬 파일 권한 오류도 Auth로 셉니다.--remotes) 기준이고 링크는 origin 기준이라, fork 원격에만 있는 커밋은 origin에 없는 페이지로 연결될 수 있습니다.git_command.rs의 checkout과 branch 설정은 이제 10분 상한과 닫힌 stdin으로 돌아, 터미널을 읽던 hook이나 LFS smudge는 묻지 않고 실패합니다.GIT_ALLOW_PROTOCOL제한, 새로 등록한 신뢰하지 않는 폴더의 자동 fetch 기본값,clone::redact가'나/가 든 비밀번호를 일부 남길 수 있음, 들어올/푸시 안 된 커밋 목록의 개수·SHA 검증, 창 포커스마다 인증 실패 재시도.hide agent register로 직접 등록했습니다. AskUserQuestion PreToolUse hook이 없는 herdr-pet 스크립트를 가리킵니다.Evidence
sasu implement verifyPASS(18d76ea): Rust 워크스페이스 테스트 전체와 clippy-D warnings.hide-host/tests/it/worktrees.rs).core.sshCommand를 실제 git config에서 읽고BatchMode=yes를 뒤에 붙임, wrapper와 plink는 그대로), Git 버전 파싱(macOS, Windows, Linux 형식) 단위 테스트.checkout-git-header.spec.ts(720x480, 두 테마)가 받지 않은 커밋 1줄과 로컬 5줄로 통과(6f8a56c, 로컬 Electron).checkout-git-header.spec.ts2개 통과(새 테스트: 다른 클론이 push한 커밋이 수동 fetch 없이 ↓1과 들어올 커밋 줄로 보임).Verification record
PRD git-freshness, base ae87893, head 6f8a56c. Deterministic verdict: PASS (
sasu implement verifyon 6f8a56c, cargo test and lint; earlier attempts stopped once on agit inittimeout under load and once on an input-changed ERROR after both commands were green). CI: desktop e2e on 18d76ea failed on the header spec's outdated row count, fixed in 6f8a56c (spec passed locally in Electron); CI verify green on 6f8a56c (run 39829437351). Review: Fidelity and Code on 0f13494; follow-ups on 0fceca5 and ff53214; Security on ff53214; Code and Security follow-up on 0e90630 found one shared item, fixed in 18d76ea; Security closure check on 18d76ea: no Fix now. Code follow-up on 6f8a56c (test-only): no Fix now. Every Fix now item is addressed.