Repository navigation
Move the Herdr server onto the new app's Herdr when the app is updated - #1083
Merged
Merged
Conversation
process::image_of answers the path a process's program file has now and the identity of the file it was started from, which survives a rename of the app around it and a new file put at its path. macOS reads it from the process's own mapping, Linux from /proc/<pid>/exe; Windows answers Unsupported.
The Herdr server an app starts outlives it, so after an update the server kept running the old app's Herdr from the renamed or trashed bundle: every pane ran under the old build, and macOS named the old bundle when a pane asked for a permission such as Screen Recording. A packaged hide connect now looks at the server on its socket before the daemon step. When the socket's peer runs another Hide app's Herdr (its hided beside app.asar) and Herdr says it can, it sends server.live_handoff with its own Herdr as the import, so the panes and their processes move to the new binary without restarting. The operator's own Herdr, a newer server, and Windows (no live handoff there) are left as they are. Each outcome is a herdr.handoff record that the host now writes to its log, together with the other records hide connect prints.
yansfil
added a commit
that referenced
this pull request
Oct 14, 2026
## Summary Sessions의 missed work에 에이전트 완료 보고의 "알아두실 점"이 거의 그대로 들어가고 있었습니다. 확인하지 못한 검증, 남은 머지·설치, 맡긴 일 자체의 덜 끝난 부분이 그 예입니다. 2026-10-14 기준으로 열린 14건 중 실제로 별도 일이었던 것은 1~2건뿐이었습니다. 이제 missed에는 **세션을 닫으면 아무도 들고 있지 않게 되는, 맡긴 일 밖의 일**만 들어갑니다. - problem: 맡긴 일과 상관없는 곳에서 발견한 고장 - follow_up: 다른 결과물을 만드는 별도 작업이나 이슈로 하자고 제안했지만 아직 아무도 맡지 않은 일 `leftover` 종류는 END 스키마에서 빠집니다(`context_label.v10`). 맡긴 일의 남은 부분은 작업 판정이, 검증은 PR과 CI가, 머지·설치는 PR 상태가 이미 보여 줍니다. 화면과 동작(`이슈로`, `무시`, 닫힘 접기, 한 턴 최대 3건)은 그대로입니다. ``` #1083 세션 "알아두실 점" 7줄 v9 -> Linux 미실행 / 권한 창 이름 미확인 / 로컬 빌드 Developer ID 서명(별도 작업) v10 -> 로컬 빌드 Developer ID 서명(별도 작업) ``` ## Review - **판단해 주세요**: 경계에 있는 두 경우를 v10은 계속 담습니다. 이렇게 두어도 될지 판단해 주세요. - 에이전트가 직접 "별도 과제로 남겼다"고 한 WAN 성능 측정(3번 중 1번 담음) - 기존 이슈 #1061과 signature가 다른 새 flaky(3번 중 3번 담음) - **조심해서 볼 파일**: `herdr-core/src/labels/context_label.rs` - 매 턴 END 호출의 프롬프트와 스키마입니다. 스키마 enum은 router가 다시 검증하므로 이제 `leftover` 답은 거절됩니다. - **조심해서 볼 파일**: `web/e2e/session-work-fixture.ts` - 웹과 데스크톱 세션 기록 e2e가 함께 쓰는 가짜 AI 답입니다. 둘째 턴의 missed 종류만 바꿨습니다. - **조심해서 볼 파일**: `herdr-core/src/links/ledger.rs` - `MissedKind::Leftover`는 v9가 저장한 기록을 읽기 위해 남겼습니다. 지우면 기존 기록을 읽을 때 `ledger_record_invalid`가 납니다. ## Evidence - **확인한 것**: 운영 ledger에서 missed를 만든 실제 턴 15개(Claude 7, Codex 8)를 뽑았습니다. hide-ai와 같은 `claude -p` 인자(sonnet, thinking off, 같은 스키마)로 v9와 v10을 각각 2~3번씩 돌렸습니다. - 잡음만 있던 9개 턴(검증 미확인, 머지·설치, PR 본문 스크린샷, 작업 미착수 등): v10은 모든 실행에서 0건 - 진짜 별도 일 4개 턴: 재시작 테스트 보강 2/2, Codex `developer` role과 links ledger 고장 3/3, 서명과 서버 잔존 이슈화 3/3, Developer ID 서명 2/3 - 평가한 프롬프트와 스키마가 Rust `request()` 출력과 바이트 단위로 같은지 확인했습니다. - **확인한 것**: `labels::`, `links::`, `session_work` 테스트 165개 통과. 새 테스트는 END 스키마가 `problem`과 `follow_up`만 제시하는지 확인합니다. `verify-cargo.sh lint`(fmt, clippy workspace) 통과. - **확인한 것**: 세션 기록 e2e(웹 Linux·Windows, 데스크톱 Windows)는 첫 CI에서 테스트 데이터가 `leftover`를 답해 v10 스키마에 거절당해 실패했습니다. 데이터를 `problem`으로 바꾼 f28d97a52의 `verify`는 전 lane 통과했습니다. - **확인하지 못한 것**: 평가 입력은 worker의 실제 context가 아니라 그 형식을 흉내 낸 것입니다(previous-goal, latest-exchange, 빈 open-tasks/open-missed). 실제 앱에서 새 턴이 v10으로 판정되는 것도 보지 않았습니다(설치 앱 미교체). - **확인하지 못한 것**: Codex 등 다른 hide-ai provider로는 돌리지 않았습니다. 프롬프트와 스키마가 provider와 무관하고, router가 enum을 다시 검증합니다. - **확인하지 못한 것**: v9가 이미 저장한 open `leftover` 기록은 그대로 남습니다. 지우거나 다시 판정하지 않습니다.
yansfil
added a commit
that referenced
this pull request
Oct 15, 2026
## Summary CI는 PR이 바꾼 경로로 돌릴 레인을 고르는데, 규칙에 없는 경로가 하나라도 있으면 모든 레인을 돌립니다. 10-13 이후 머지된 PR 58개 중 13개가 그랬고, 원인은 테스트가 읽는 계약 파일, 레인이 부르는 workflow, 디자인 스크립트, `web/vite.config.ts`였습니다. 이제 이 경로들은 실제로 읽는 레인과 크레이트만 돌립니다. 같은 58개를 다시 계산하면 전체 레인 PR 13 → 1, 잡 855 → 823, macOS 잡 58 → 45입니다. - **계약 5개** (`hided-ws.schema.json`, `snapshot-wire-enums.json`, `agent-adapters.json`, `hide-cli.json`, `usage-coverage.json`): 읽는 테스트의 크레이트만 `rust`로, 웹 테스트가 읽으면 `checks`, 셸이 import하면 `web-e2e`도. - **레인 workflow 4개** (`web-e2e.yml`, `desktop-e2e.yml`, `os-contract.yml`, `remote-mailbox.yml`): 그 workflow를 부르는 레인만. - **`web/vite.config.ts`**: 셸을 빌드하거나 웹 단위 테스트를 돌리는 레인 전부. Rust만 도는 레인은 뺍니다. - **디자인 생성기, 토큰 맵, 디자인 검사**: `policy`만. `design-contract.yml`이 모든 PR에서 따로 검사합니다. - **`Cargo.lock`은 전체 그대로**: 거의 모든 크레이트가 `workspace-hack`에 의존해 lock 변경이 모든 크레이트에 닿습니다. - **따라가다 찾은 누락** (두 번째 커밋): `docs/UI_BEHAVIOR.md`, `docs/AI_PROVIDERS.md`, 에이전트 로고 manifest는 테스트가 읽는데 그 레인을 돌리지 않았습니다. 이제 돌립니다. ## Review - **판단해 주세요**: `agent-adapters.json`은 웹 셸 파일 규칙(`checks`, `web-e2e`)을 따라 데스크톱 e2e를 돌리지 않습니다. `agentAdapters.ts` 변경도 지금 그렇고, 데스크톱에서만 깨지면 nightly가 잡습니다. - **판단해 주세요**: brief 목록 밖인 `web-e2e.yml`, `desktop-e2e.yml`, `os-contract.yml`과 디자인 검사 6개도 같은 규칙이라 넣었습니다. workflow는 테스트가 `pr.yml`의 `uses:`에서 부르는 레인을 읽어 맞춥니다. - **조심해서 볼 파일**: `scripts/ci-plan.py` `classify` - 다른 규칙이 없는 경로는 이제 READERS가 전부 정합니다. 기존 READERS 경로는 다른 규칙이 먼저 잡아 그대로입니다. - **조심해서 볼 파일**: `scripts/ci-plan.py` READERS - 크레이트는 그 크레이트 테스트만 돌립니다. 테스트가 아닌 코드가 계약을 읽게 되면 크레이트 변경 규칙으로 옮겨야 합니다. ## Evidence - **확인한 것**: `python3 -m unittest discover -s scripts/tests -p 'test_*.py'` 343개 통과. - **확인한 것**: 계약 테스트는 기대값을 소스에서 얻습니다. 주석을 뺀 코드에서 파일 이름을 부르는 크레이트와 웹 파일이 계획된 크레이트와 레인과 같아야 합니다. - **확인한 것**: 레인 하나를 빼는 변조 3개(계약, vite 설정, `os-contract.yml`)가 각각 테스트를 실패시킵니다. - **확인한 것**: 재현 스크립트로 PR 58개의 merge commit diff를 변경 전후 planner에 넣었습니다. spec은 merge commit 시점 내용으로 읽었습니다. 표는 아래. - **확인하지 못한 것**: 머지 뒤 실제 PR 런의 잡 수와 대기 시간. 이 PR은 `scripts/ci-plan.py`를 바꿔 자기 런은 전체 레인입니다. - **확인하지 못한 것**: 리더 스캔은 파일 이름 문자열로 찾아, 경로를 조각으로 이어 붙여 읽는 코드는 놓칠 수 있습니다. <details><summary>PR별 전/후 (전체 레인이던 13개)</summary> 잡 수는 `plan`, `verify`와 레인별 잡(`web-e2e` 5, `os-contract` 2, `package` 3, 나머지 1)의 합입니다. Rust 크레이트는 `rust` 레인이 lint와 테스트를 도는 범위입니다(전체 레인이면 workspace 전체). | PR | Unclassified paths before | Full after | Jobs | macOS jobs | Rust crates | Lanes dropped | | --- | --- | --- | --- | --- | --- | --- | | #1108 | `contracts/hided-ws.schema.json` | no | 18 -> 16 | 2 -> 0 | workspace -> 11 of 16 | os-contract-macos, desktop-e2e | | #1085 | `contracts/hide-cli.json` | no | 21 -> 20 | 3 -> 2 | workspace -> 8 of 16 | os-contract-macos | | #1083 | `.github/workflows/remote-mailbox.yml` | no | 21 -> 21 | 3 -> 3 | workspace -> 14 of 16 | - | | #1076 | `scripts/gen-tokens.mjs` | no | 18 -> 10 | 2 -> 0 | workspace -> 1 of 16 | os-contract, os-contract-macos, windows-check, windows-e2e, windows-desktop, remote-mailbox, desktop-e2e | | #1074 | `contracts/hided-ws.schema.json` | no | 18 -> 17 | 2 -> 1 | workspace -> 3 of 16 | os-contract-macos | | #1070 | `scripts/gen-screens.mjs`, `web/vite.config.ts` | no | 18 -> 17 | 2 -> 1 | workspace -> 8 of 16 | os-contract-macos | | #1056 | `contracts/snapshot-wire-enums.json` | no | 21 -> 20 | 3 -> 2 | workspace -> 10 of 16 | os-contract-macos | | #1051 | `contracts/hided-ws.schema.json` | no | 21 -> 20 | 3 -> 2 | workspace -> 3 of 16 | os-contract-macos | | #1049 | `scripts/pen-token-map.json` | no | 18 -> 3 | 2 -> 0 | workspace -> not run | rust, checks, os-contract, os-contract-macos, windows-check, windows-e2e, windows-desktop, web-e2e, remote-mailbox, desktop-e2e | | #1044 | `.github/workflows/remote-mailbox.yml`, `contracts/agent-adapters.json`, `contracts/hided-ws.schema.json`, `contracts/usage-coverage.json` | no | 21 -> 21 | 3 -> 3 | workspace -> 15 of 16 | - | | #1037 | `contracts/hided-ws.schema.json` | no | 18 -> 17 | 2 -> 1 | workspace -> 3 of 16 | os-contract-macos | | #1030 | `Cargo.lock`, `contracts/agent-adapters.json`, `contracts/hided-ws.schema.json`, `contracts/usage-coverage.json` | yes | 18 -> 18 | 2 -> 2 | workspace -> workspace | - | | #1017 | `contracts/snapshot-wire-enums.json` | no | 18 -> 17 | 2 -> 1 | workspace -> 9 of 16 | os-contract-macos | </details>
yansfil
added a commit
that referenced
this pull request
Oct 15, 2026
Related: PRD `agents/prd/device-herdr-update/prd.md` · follows #1083 (이 Mac의 Herdr 서버 핸드오프) ## Summary - 문제: 앱을 업데이트해도 연결된 기기의 Herdr는 그 기기에 따로 깔린 옛 버전에 머물렀습니다(예: mini 0.9.1, 앱 고정 0.9.3). - 이제 기기 연결 때 앱의 고정 Herdr를 helper 옆 `~/.hide/host-helper/herdr/<id>/`에 올리고, Hide가 기기에서 부르는 Herdr(상태 확인, kit, 터미널)는 그 사본을 씁니다. - 기기의 등록된 서버가 더 오래된 정식 릴리스면 pane을 살린 채 고정 사본으로 넘깁니다(live handoff). 같은 버전·더 새 버전·프리뷰는 그대로 둡니다. - 넘길 수 없으면 서버는 그대로 두고, 기기 줄에 한 줄로 이유와 할 일(다시 시작 또는 그 기기의 Herdr 업데이트)을 보여줍니다. 실패한 시도는 같은 서버에 다시 하지 않습니다. - 운영자의 `herdr`는 건드리지 않고, 서버가 쓰는 옛 사본은 쓰는 동안 지우지 않습니다. Windows 기기는 지원표의 문서화된 공백입니다.  ## Review - **판단해 주세요**: 기기 줄 문구 두 가지(`Herdr 0.9.1 on this device is older than Hide's 0.9.3` + 다시 시작/업데이트 안내)가 운영자에게 충분한지. 이 상태의 화면 캡처는 없고 단위 테스트로만 확인했습니다. - **판단해 주세요**: 서버가 고정 사본을 쓰는 동안 기기를 제거하면 helper 폴더가 남고 "그 서버가 멈춘 뒤 지우라"고 말합니다(실패가 아닌 Kept). 이 동작이 맞는지. - **판단해 주세요**: 기기 연결 중이 아닐 때는 그 줄을 숨깁니다(연결 문제가 먼저 보이게). 리뷰 반영으로 정한 기본값입니다. - **조심해서 볼 파일**: `hided/src/herdr_handoff.rs` - Herdr contract 호출(`server.live_handoff`)과 실패 기록(16개 상한). - **조심해서 볼 파일**: `hide-host/src/kit.rs` - 기기의 파일을 지우는 failure path(사본 정리, 제거). - **조심해서 볼 파일**: `herdr-core/src/runtime/session.rs`, `runtime/kit.rs`, `contracts/snapshot-wire-enums.json` - snapshot wire에 `herdr_behind` 추가와 줄이 끝나는 조건. - **조심해서 볼 파일**: `hide-node/src/ssh/host.rs`, `hide-node/src/ssh.rs` - 업로드 위치와 상태 확인의 PATH 앞자리(허용 문자만). - **비용 검토**: 상시 경로 추가 없음. kit pass마다 고정 사본 `--version` 1회(5초 상한)와 프로세스 표 1회 읽기, 둘 다 기기 helper에서 runtime lock 밖입니다. ## Evidence - **확인한 것**: `sasu implement verify` PASS on 최종 head - S1 `verify-cargo.sh test` 전체, S2 lint. - **확인한 것**: 첫 CI의 macOS desktop e2e 실패(home-layout이 빌드에 새로 생긴 `herdr` 위에 링크를 걸다 EEXIST)를 고쳤고, 그 spec을 로컬에서 1/1 통과했습니다. - **확인한 것**: hided 통합 4/4 - 실제 Herdr 0.9.1 서버가 고정 0.9.3 사본으로 pane이 살아 있는 채 넘어감, 다른 소켓 서버와 운영자 `herdr` 바이트 불변, 거부된 핸드오프는 반복 안 함. - **확인한 것**: desktop device-kit e2e 4/4 - 격리된 sshd 기기에 고정 Herdr가 빌드 옆에 올라가고, 이미 고정 버전인 서버는 그대로이며 줄에는 버전만 보임(위 이미지). - **확인한 것**: 실제 0.9.1과 0.9.3에서 `ping`과 `session.snapshot`의 버전 표기가 같음 - 줄이 끝나는 비교가 같은 것을 비교함. - **확인한 것**: kit 단위 테스트 100회 반복 0 실패(복사한 시스템 프로그램을 macOS가 SIGKILL하던 fixture를 테스트 바이너리 사본으로 교체). - **확인하지 못한 것**: 0.9.1 -> 고정 버전 핸드오프를 기기 경로(업로드·kit 적용·기기 줄) 하나로 잇는 실행은 없습니다. 핸드오프 자체는 local only로 실제 0.9.1에 대해 증명했고, CI의 remote-mailbox lane은 0.9.1을 digest로 받아 같은 통합 테스트를 Linux에서 돌립니다. - **확인하지 못한 것**: 기기 줄의 behind 상태 화면 캡처(웹 단위 테스트만), macOS nightly lane, 실제 mini에서의 동작(운영자 서버라 손대지 않음). - **확인하지 못한 것**: 디스크가 가득 찬 상태에서 돈 S1 1회는 환경 실패 68건(StorageFull 등)이었고, 각각 따로 다시 돌려 통과했으며 verify의 S1은 전체 통과했습니다. AI tooling: 구현 후 Fidelity·Code·Security 리뷰를 별도 세션으로 받았고 판단과 처리는 아래 기록에 있습니다. <details><summary>Verification record</summary> - PRD: `agents/prd/device-herdr-update/prd.md` (sha256 e35a753177c5a93c00914e919d9766dc3842fbce442bb88752c0adf3a6b895be) - Base 0390810 → head d8d6836, verified 2026-10-15T17:25:31.468Z: PASS - Verification report: `agents/runs/device-herdr-update/verification-report.json` and `agents/runs/device-herdr-update/verification-report.md`; source fingerprint bba4f2a1869581d0838dc7cd7ddaf2d28de10173e1ec1b1d67a6d99ac7cfbba9 - Suites: - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0) - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0) - Reviews: - Fidelity: ddf6ac8 then follow-ups on a99c68b and 88c10b2. Fix now: none. Earlier gaps fixed (B7 tests for the kit and the helper lookup, versions on every handoff record, an INSTALL line for the leftover folder). Stand as disclosed: B2/B3 not joined end to end through the device path, B9 only by unit test, NodeTerminals closure covered indirectly. - Code: ddf6ac8 then follow-ups on a99c68b, 88c10b2 and d8d6836 (home-layout e2e fix: closes the EEXIST, no clash in other stageBuild callers). Four findings fixed: removal reports Kept while a copy runs, the behind line ends on another live release and hides while unreachable, prune keeps copies a build names, core-host payload carries no pin. Follow-up: an in-repo ping/snapshot version parity assertion (closed for 0.9.1 and 0.9.3 by evidence). - Security (high-risk): a99c68b; 88c10b2 adds one INSTALL line only. Fix now: none. Follow-ups (Low): reuse of an existing copy by size and privacy without a hash or exec-bit check, no peer-uid check on the registered socket, a prune race with a concurrent build upload, an unbounded reason text in handoff.json and logs. - Evidence: 6 registered (5 log, 1 screenshot); paths are local to the run directory - agents/runs/device-herdr-update/artifacts/e2e/device-kit-fix.log - agents/runs/device-herdr-update/artifacts/e2e/device-herdr-on-pin.png - agents/runs/device-herdr-update/evidence/handoff-it-fix.log - agents/runs/device-herdr-update/evidence/s1-rerun-failed.log - agents/runs/device-herdr-update/evidence/herdr-version-spelling.log - agents/runs/device-herdr-update/evidence/home-layout-e2e.log - Changed paths: 57 (see Files changed) - Delivery: mode pr, branch `spec/device-herdr-update`, base `main` </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
앱을 새로 설치해도 Herdr 서버는 예전 앱 안의 Herdr로 계속 돌았습니다.
예전 앱이
hide-previous-….app.bak으로 밀려나도 모든 pane이 그 안에서 실행되어, macOS 권한 창(화면 기록 등)이.bak앱 이름으로 뜨고 새 Herdr는 쓰이지 않았습니다.이제 새 앱을 열면
hide connect가 예전 Hide 앱이 띄운 서버를 새 앱의 Herdr로 넘깁니다(Herdrserver.live_handoff).pane과 그 안의 에이전트·프로세스는 그대로 살아 있고, 화면은 잠깐 다시 붙습니다.
사용자가 직접 설치한 Herdr로 띄운 서버, 더 새 버전의 서버, 다른
HERDR_BIN_PATH를 받은 경우는 건드리지 않습니다.Review
hided/src/cli.rs-find_or_start에서 connect lock 안, daemon 확인 전에 handoff가 돕니다(Herdr/core ownership).hided/src/herdr_handoff.rs- 판정 순서와 모든 실패 경로(넘기지 않고 기록만).hide-platform/src/process.rs- macOSPROC_PIDREGIONPATHINFO구조체를 직접 선언(SDK 크기 assert).herdr-core/src/wire.rs- contract 안의ping/server.live_handoff만 씁니다.herdr status client1회, 넘길 때만 요청 1회(15초 상한).Evidence
tick N을 찍는 셸을 돌렸습니다.hide-previous-….app.bak으로 옮긴 뒤 같은 자리에 이 브랜치 패키지(0.1.0-handoff.5cf8b0c6)를 놓고 열었습니다.herdr.handoff outcome=handed_off elapsed_ms=125, 새 서버의 실행 파일은 새 앱의herdr,.bak안에서 도는 프로세스는 0개.hided/tests/it/herdr_handoff.rs가 고정 Herdr로 통과: 남의 Herdr는 그대로, Hide 앱 것은 넘김, pane 프로세스 생존, 다시 보면Ours. 패키지 검사를 빼면 실패합니다.image_of계약 테스트가 macOS에서 통과(경로 기반 구현을 심으면 실패). linux-gnu, windows-msvc 대상cargo check통과.verify-cargo.sh lint,hakari,test(4,974개 통과),test-scoped -p hide-platform -p hide-kit, desktop typecheck·lint·test, scripts 단위 테스트 326개, workstation identity, pin single source, core-touches-no-machine.추가 증거
넘기는 순간의 줄 합쳐짐은 Hide 화면이 아니라 Herdr의 화면 읽기(
herdr pane read)에도 같이 있습니다.