Skip to content

Keep build output in its worktree and stop the incremental cache - #40

Merged
yansfil merged 1 commit into
mainfrom
chore/worktree-build-isolation
Sep 10, 2026
Merged

yansfil merged 1 commit into
mainfrom
chore/worktree-build-isolation

Conversation

@yansfil

@yansfil yansfil commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What changed, in one paragraph a new contributor can follow

Two things that only affect how the repository is built, not what it does. AGENTS.md now states that target/ and macos/.build stay inside the worktree that produced them, with the reason: the build scripts read the Rust archive and the Swift binary from fixed paths under the worktree, and Cargo holds an exclusive lock on its target directory, so worktrees sharing one serialize the parallel builds this layout exists to allow. It also records the cost of that isolation - one cache per worktree, removed with the worktree - because on 2026-09-09 a single abandoned worktree held 5.3 GB of the 10 GB spread across eight. Cargo.toml sets [profile.dev] incremental = false: an agent worktree is built a few times and discarded, which never repays an incremental cache, and what it does instead is grow one per worktree; those had reached 1.5 GB.

Review boundary

  • Runtime mutex: nothing. No runtime code changes.
  • Snapshot wire: no field added or moved.
  • Ownership: neither. No pane, split, zoom, cwd, PTY, tab, focus, panel, or text-scale value is touched.
  • Herdr contract: no method, parameter, or field is called.
  • Failure path: unchanged. The only behavior difference is that debug builds no longer write an incremental cache, which cannot fail on its own; a build that fails still fails the same way.

Evidence

  • Verified by: CI on this pull request. The change is a documentation section plus a Cargo profile key, and the verify workflow builds and tests both suites with the new profile.
  • Not verified (and why): no local suite run. The workstation is currently executing another implementation, and the profile key is exactly what CI exercises.
  • High-frequency path impact: N/A - no runtime path changes. The build-time effect is a slower incremental rebuild in exchange for not growing a per-worktree cache, which is the stated intent.

Screenshots

N/A - no visual surface changed.

AI tooling

The commit was authored in a local session on 2026-09-09 and never pushed. This pull request only cherry-picks it onto current main; the content is unchanged. The claim about worktree cache sizes was measured with du on the actual worktrees at the time it was written.

Build output stays in the worktree that produced it, and AGENTS.md now says
why redirecting it is not the fix for the disk it costs: three build scripts
read the Rust archive and the Swift binary from fixed paths under the
worktree, and Cargo's exclusive lock on a shared target directory would
serialize the parallel builds this layout exists to allow.

Turn off the dev profile's incremental cache. A worktree here is built a few
times and discarded, which never repays the cache; it only grows one per
worktree, and those had reached 1.5 GB across eight.
@yansfil
yansfil merged commit 870f595 into main Sep 10, 2026
5 checks passed
@yansfil
yansfil deleted the chore/worktree-build-isolation branch September 10, 2026 06:33
yansfil added a commit that referenced this pull request Oct 22, 2026
…ull request wakes (#1524)

## Summary

여러 이슈를 한 에이전트(Conductor)에게 맡기면, 그 에이전트가 계획을 세우고 작업자 에이전트를 나눠 띄우고 PR까지 끌고
가는 기능입니다.
Hide는 그 진행을 "미션"으로 기록하고, 오른쪽 보기 칸에 미션 지도를 그리며, 동시에 도는 작업자 수를 상한으로 막고,
PR이 바뀌면 Conductor를 깨웁니다.

- Conductor는 `hide-conductor` 스킬과 `hide mission help` 안내를 따르고, `hide
mission` 명령으로 계획, 노드 상태, 결정할 일, 보고를 기록합니다.
- 첫 계획이 들어오면 지도가 한 번 열리고, 사이드바의 Conductor 줄과 Overview 기록에 `미션 0/4` 칩이 붙어
다시 열 수 있습니다.
- Settings › Conductor에서 동시 작업자 상한, 기본 범위, 작업자 후보(에이전트, 모델, effort, 용도)를
정합니다.
- 상한을 넘는 작업자, 계획 승인 전의 작업자, 다른 기계를 겨냥한 작업자는 이유를 붙여 거절합니다.

![격리 후보에서 실제 gittest PR 두 개로 돌린 미션 지도와 노드
상세](https://github.com/yansfil/pr-assets/blob/main/hide/gen-prd-software-factory-conductor/f7981c2/pr-map-detail.png?raw=true)

## Review

- **판단해 주세요**: 작업자 수 상한은 Conductor가 띄우는 작업자에만 걸립니다. 작업자가 다시 띄우는 에이전트는
안내문으로만 막습니다(운영자의 "하네스는 가볍게" 결정을 따름).
- **판단해 주세요**: 닫히거나 취소된 미션의 Conductor는 이후 일반 에이전트처럼 상한 없이 띄울 수 있습니다. 한
Conductor가 여는 미션은 한 번에 하나뿐이라, 다른 미션을 하는 중에 끝난 미션의 PR이 바뀌면 소식만 받고 그 미션은
끝난 채로 둡니다. 끝난 미션의 PR이 머지되면 아무도 깨우지 않습니다.
- **판단해 주세요**: 미션 기록 파일을 읽지 못하면 아무것도 작업자를 세지 못합니다. 모든 띄우기를 막는 대신, 안내문이
Conductor에게 멈추고 운영자에게 알리라고 합니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/missions.rs` - 모든 명령이 runtime
mutex 안에서 한 번에 적용되고, PR 깨우기는 잠금 밖 스레드에서 보냅니다. 작업자 후보 밖의
띄우기(`mission_candidate_refused`)와 스택이 모두 머지된 `merge_wait` 미션의 자동 종료도 여기서
정합니다.
- **조심해서 볼 파일**: `herdr-core/src/coordination/mod.rs` - 상한 검사가 ledger
예약과 같은 잠금 안에 있습니다. 10분 동안 진행이 없고 작업자도 없는 예약은 세지 않고, 그 예약을 다시 부르면 상한 안에서
자리를 다시 잡거나 거절합니다. 이어받기(`take`)는 미션의 작업자, 그 시작 기록, 감시를 새 Conductor에게
옮기며(`AdoptMissionWorkers`), take가 답하기 전에 delivery 큐에 넣어 새 Conductor의 다음
명령보다 먼저 들어갑니다.
- **조심해서 볼 파일**: `herdr-core/src/node_migration.rs`, `reown.rs` - core를
다른 기계로 옮길 때 `missions.json`도 함께 옮기고 기계, 프로젝트, pane id를 바꿉니다.
- **조심해서 볼 파일**: `herdr-core/src/persistence.rs` - Settings › Conductor를
값으로 저장해서, 이 빌드가 못 읽는 값이 나머지 UI 상태를 지우지 않습니다.
- **비용 검토**: 새 상시 작업은 없습니다. 깨우기는 이미 있는 GitHub 읽기 결과를 비교할 뿐이고, 보내지 못한
깨우기는 미션당 32개까지 기록에 남습니다. 저장 크기는 시작 때 다시 읽을 수 있는 7 MiB 안으로 제한합니다.
- **비용 검토**: snapshot을 읽을 때마다 lock 안에서 도는 미션 갱신은, 미션이 없으면 아무것도 하지 않고,
있으면 숫자 두 개, ledger 포인터 하나, 미션당 두 비트만 비교합니다. 미션 기록, PR 답, ledger,
Conductor 유무, 기기 연결 중 하나가 바뀌었거나 만드는 중인 작업자가 상한에서 빠질 때만 지도를 다시 만들고, 닫힌
미션은 기록이나 PR이 바뀔 때만 다시 만듭니다.

## Evidence

- **확인한 것**: 격리된 desktop 후보(dev 빌드, 고정 Herdr 0.9.5, 운영자 앱과 서버는 건드리지 않음)를
띄우고, 실제 `yansfil/gittest`에 쌓인 PR 두 개로 미션 하나를 끝까지 돌렸습니다(마지막 코드
d5b2140b4에서 #40, #41). 끝난 뒤 PR은 닫고 브랜치는 지웠습니다.
- **확인한 것**: 그 실행에서 첫 계획이 지도를 열었고, 시작 전 작업자는 `mission_not_started`, 상한
2에서 세 번째는 `mission_cap_reached`, 다른 기계는 `mission_machine_refused`로
거절됐습니다.
- **확인한 것**: 아래 PR에 push하자 `hide:conductor`가 보낸 깨우기 편지 한
통(`mission:mission-1:api:40:new_head:<head 12자>:1:<Conductor>`)이
Conductor 받은편지함에 들어왔습니다.
- **확인한 것**: 같은 실행에서 결정 배너, Settings › Conductor, Conductor가 끝난 뒤의 이어받기
배너, 노드 상세, 사이드바 칩을 화면으로 봤습니다.
- **확인한 것**: 마지막 코드 e99c204a2로 다시 돌린 격리 실행(gittest #42, #43)에서 실제로 이어받기를
했습니다. 첫 Conductor 프로세스를 끝내자 `Conductor 없음` 배너가 떴고, 새 pane이 `hide mission
take`로 이어받자 배너가 사라졌습니다. 새 Conductor가 같은 노드 intent(`mission-1:api`)로 다시
띄우자 새 작업자가 아니라 기존 작업자(agent-3)가 돌아왔고, 그 작업자는 새 Conductor의 자식이 됐습니다. 작업자가
보낸 report 편지는 새 Conductor 받은편지함에 들어왔습니다.
- **확인한 것**: 같은 실행에서 이어받은 뒤 쌓인 PR #43에 push하고 draft로 바꾸자, 지도의 PR 표시가
mergeable에서 draft로 바뀌었고 새 Conductor가 `PR #43 has a new commit` 깨우기를
받았습니다(지도 갱신 조건이 GitHub 답을 놓치지 않음). 끝난 뒤 PR은 닫고 브랜치는 지웠습니다.
- **확인한 것**: web e2e `mission-map.spec.ts`가 실제 `hide mission` 명령으로 지도
열림, 다시 안 열림, 칩으로 다시 열기, 노드 상세, Settings 상한 저장을 확인합니다.
- **확인한 것**: 코드 리뷰가 찾은 13건과 후속 리뷰의 1건(core 이동 뒤 기록을 못 읽는 문제)을 고쳤고, 그중
깨우기 유실, 설정 손상, 세션 누락은 고치기 전에 실패하는 테스트로 확인했습니다.
- **확인하지 못한 것**: 후보 창이 비활성이라 macOS 창 캡처가 "could not create image from
window"로 실패해, 화면은 renderer 캡처로 남겼습니다.
- **확인하지 못한 것**: 기기 연결이 끊긴 지도(B20 흐림)는 gallery 장면으로만 봤고, 실제 기기 연결을 끊어
보지는 않았습니다.
- **확인하지 못한 것**: Windows는 실행해 보지 않았습니다(`docs/INSTALL.md` 표에 이유와 닫을 방법을
적었습니다). Linux는 CI로만 확인합니다.
- **확인하지 못한 것**: 저장 크기 초과로 되돌린 명령은 책만 되돌리고, 그 명령이 먼저 연 보기 칸과 보낸 깨우기는
되돌리지 않습니다(7 MiB 근처에서만 생김).
- **확인하지 못한 것**: 작업자 후보 두 개를 아주 빠르게 연달아 고치면 뒤의 편집이 앞의 것을 덮을 수 있습니다(후보
목록은 통째로 보냄).
- **확인하지 못한 것**: 미션 단위의 "뒤에서 열기" 확인(B7)은 없습니다. 후보 거절(B8), 스택 머지 후 자동
종료(B41), 원격 카탈로그의 이유 표시(B10), 늦게 돌아온 예약의 상한, 한 Conductor당 열린 미션 하나는 core
테스트로만 확인했고 live 실행에는 없습니다.

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

![사이드바의 Conductor 줄에 붙은 미션
칩](https://github.com/yansfil/pr-assets/blob/main/hide/gen-prd-software-factory-conductor/f7981c2/pr-sidebar-chip.png?raw=true)

![Conductor가 끝난 뒤의 이어받기
배너](https://github.com/yansfil/pr-assets/blob/main/hide/gen-prd-software-factory-conductor/f7981c2/pr-map-takeover.png?raw=true)

![새 pane이 이어받은 뒤의 미션
지도](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-conductor/e99c204/07-taken-over-renderer.png?raw=true)

![이어받은 뒤 PR #43 push와 draft 전환을 지도가
따라감](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-conductor/e99c204/08-after-push-draft-renderer.png?raw=true)

![Settings ›
Conductor](https://github.com/yansfil/pr-assets/blob/main/hide/gen-prd-software-factory-conductor/f7981c2/pr-settings.png?raw=true)

![결정할 일이 있는 지도, 밝은 테마
gallery](https://github.com/yansfil/pr-assets/blob/main/hide/gen-prd-software-factory-conductor/f7981c2/pr-gallery-decision-light.png?raw=true)

</details>

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

- PRD: software-factory-conductor (local contract; D-01..D-56, B1..B55)
- Base `242aed346ac9`, head `e99c204a2` (verify report head)
- `sasu implement verify`: PASS on e99c204: `scripts/verify-cargo.sh
test` and `lint` green
- Also run on the final code: `verify-web.sh web typecheck/lint/test`
(1944 passed, 1 skipped), `web e2e mission-map.spec.ts` (1 passed), `web
e2e settings-general.spec.ts` (3 passed), `verify-cargo.sh cli`, hide
CLI contract tests, hakari, live isolated desktop spec on
yansfil/gittest, rerun on d5b2140 (1 passed, 2.9 min), rerun with a
real takeover on e99c204 (1 passed, 3.7 min)
- Reviews: Fidelity and Code on f7981c2 (13 code findings, all fixed);
follow-up Fidelity and Code on fb3785a (Fix now: null `workspace_id`
after a core move, fixed in cc05c9a); short Code re-review of
cc05c9a: nothing to fix; Observer-requested contract gaps (B8
candidates, B10 test, B41 self-close, resumed reservation cap, wake
recipient) in 1d846b9, review found 2 Fix now (candidates per mission,
already-merged stack) fixed in d5b2140, re-review: nothing to fix;
independent review of a7fba00 (6 items: one open mission per
Conductor, takeover handover, snapshot hot path, merge_wait settle,
replan guard, wake kind) fixed in d33972c; follow-up review found 3
Fix now in the handover (unregistered heir, worker without parent,
swallowed enqueue failure) fixed in e99c204; re-review: nothing to fix
- Follow-up (not fixed): revert after `mission_full` keeps the opened
slot and sent wakes; candidate edits send the whole list; a re-ask of a
stuck start every <10 min keeps its slot; a self-closing mission still
gets its last merged wake; no per-mission worker override (B3); an
unknown kind is refused as a candidate before `agent_unknown`; the
200-newest PR window; skill re-write after one skill is deleted; reown
key skip narrowing; mission chip found by pane id; a former Conductor's
in-flight spawn racing a take can move workers back; a closed mission's
node pane follows only on the next book or PR change; no runtime test of
a take whose handover enqueue fails
- Registered evidence (12): live run logs (fb3785a, d5b2140,
e99c204 with takeover), 6 live renderer captures (node detail,
decision, settings, takeover banner, taken over, after push and draft),
mission-map e2e log, gallery stale capture, web lanes log

</details>
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 12, 2026
…hide#2470)

## Summary

A delegated agent's open questions (`나를 기다리는 것`) stayed open after its
parent had already answered them in a letter.
Hide is meant to close a child's earlier questions when its parent sends
a `reply` or `request` letter (B12), but it never matched the parent.
The bell line names the writer by the name a person knows it by (its
registered name, else its pane's title), while the child's lineage names
the parent by its wire name (`agent-32039`); for every parent registered
without a name, every Conductor, the two never matched.
The bell record now also carries the writer's wire name and the letter's
kind, the judged message keeps them, and the answer check compares wire
name with wire name.
On the operator's ledger copy, 15 of 20 hand-labelled stale questions
would have closed this way (17 counting two letters too old for the
delivery ledger to show their sender).

## Review

- **Decide**: a parent's request letter closes every earlier question of
its child, and the turn's judgment lists again the ones still waiting
(documented B12, now working). On the labelled sample this also closes 2
of 3 live questions (both a person's own step) unless the judgment lists
them again; the stacked follow-up keeps a person's step from closing on
a parent's letter.
- **Risky files**: `hide-core/src/delivery/doorbell.rs` - the bell is
recorded under the runtime lock as before, with one more owned string;
`hide-core/src/labels/facts.rs` - the verdict saved in `labels.json`
gains an optional field (old records read with none).
- **Cost**: one `wire_name` lookup over the pass's ledger copy per bell
typed; no new work per input or tick.

## Tests

- **Layer**: unit, in the label worker (`labels/tests.rs`), driving real
session files, the real bell line (`delivery::bell::line`) and the bell
record, and reading the `TurnEnd` the ledger receives.
- **Catches**: a parent matched by the name the line shows. Planting the
old comparison fails it: `[true, false, false, false, true]` against
`[true, true, false, false, false]`, which also shows the old code took
an impostor whose line showed the parent's name.
- **Repeat**: the new test 5 times locally, all green.
- **Waits**: none new; the existing `settle` helper.

## Evidence

- **Verified**: `labels::`, `doorbell` and `open_ask` tests, 271 run,
271 passed; clippy `-D warnings` on `hide-core` all targets; fmt.
- **Verified**: root cause reproduced on the operator's ledger copy
(session 1c86d7, letter at offset 3421468: parent `agent-32039`, line
sender `hide 앱 모바일 출시 계획`); the same parent appeared under three titles
in one day.
- **Not verified**: no live run against an installed build; the full
Rust suite and the other lanes run in CI only.
- **Not verified**: the measured effect is a simulation over a copy of
the ledger with the delivery ledger's sender names, not a replay through
the judgment.

<details><summary>Measured on the labelled sample (41 open questions of
11-11/12 with later turns; 20 stale, 3 live by hand)</summary>

| | before | after |
| --- | --- | --- |
| stale closed by a parent's reply/request | 0/20 | 15/20 (17 with two
letters older than the delivery ledger keeps) |
| live closed before the judgment lists them again | 0/3 | 2/3 (778191:
approval, App Store Connect details) |
| roots with no operator answer (#5, with-hide#37, with-hide#40) | open | open: not
certain, left to the stacked fold |

Needs You is unchanged: a delegated row carries no questions, and a
root's hold still ends only on the operator's own message.

</details>

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

Base adb0f56. Suites: nextest `-p hide-core` filtered `labels::`,
`doorbell`, `open_ask` (271/271); clippy `-p hide-core --all-targets -D
warnings`; `check-no-workstation-identity.sh`,
`check-no-attribution.py`, `check-timed-waits.py`.

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