Skip to content

Bring a connected device's Herdr to the app's pinned release - #1197

Merged
yansfil merged 9 commits into
mainfrom
spec/device-herdr-update
Oct 15, 2026
Merged

yansfil merged 9 commits into
mainfrom
spec/device-herdr-update

Conversation

@yansfil

@yansfil yansfil commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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 기기는 지원표의 문서화된 공백입니다.

격리된 SSH 기기가 앱의 고정 Herdr 0.9.3을 받은 뒤: 기기 줄은 버전만 바뀌고 다른 줄은 없음

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 리뷰를 별도 세션으로 받았고 판단과 처리는 아래 기록에 있습니다.

Verification record
  • 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

A package that carries Herdr for a device's system uploads it once per pin
into the helper root, beside the build folders. After each kit pass the
device's node hands the server on the registered socket to that copy when it
runs an older stable release, records a failed handoff per server process and
pin so it is not retried on every connection, and reports the outcome in the
kit report. A copy is removed only once no process on the device runs it, and
Hide's own Herdr calls on the device (status read, kit, terminals) use the
pinned copy when it is there.
…de's

The device row reads the Herdr version its server names in the session, so a
handoff shows at once. When the device's node leaves the server on an older
release, the row says so in one line with the step its cause allows: update
that machine's Herdr when it cannot hand its panes over, or restart Herdr there
when a handoff failed. Every outcome is one herdr.handoff log record with the
device id. A device on an older Herdr protocol no longer gets this Mac's advice
to reopen Hide.
A device server started from an older Herdr moves to the pinned copy with its
pane's process alive, a server on another socket keeps its Herdr, a server on
the pinned release is left alone, and a refused handoff leaves the server as
it was and is not tried again. The remote mailbox lane fetches Herdr 0.9.1 by
digest for these.
…e helper

The staged build carries the pinned Herdr as the package does. The device gets
it beside its build with herdr/current leading to it, its server already on
that release is left alone, the row names that version with no extra line,
and removing the device takes the copy no server runs.
It made every kit answer carry its largest variant.
- A pinned Herdr copy that any build folder names stays through a prune,
  so a copy another connection uploaded for its build is not taken before
  that build applies.
- Removing a device whose server still runs a pinned copy keeps the helper
  folder and says why, instead of reporting a failed removal.
- The core machine's build carries neither the device's Herdr copy nor the
  pin naming it.
- The device row's Herdr-behind line ends once the live server answers with
  another release, and is not shown while the device is unreachable.
- Every handoff record names the pinned version, and the server's when it
  was read, including when no server answers or a stage fails.
- Tests for the pinned copy the kit and the terminals choose, and a held
  copy of the test binary in place of a copied system program, which macOS
  kills as it starts.
@yansfil
yansfil merged commit 1c5ad3d into main Oct 15, 2026
23 checks passed
@yansfil
yansfil deleted the spec/device-herdr-update branch October 15, 2026 18:53
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