Repository navigation
feat: ask what ssh asks for the core link and core move on the screen that started them - #1846
Merged
Merged
Conversation
… that started them
…rip and move dialog
…draw it in the gallery
…se, ask once per press and offer no retry for a changed key
…ed it The core link and the core move's checks now take one lease per press, owned by the screen connection that pressed: only it is shown and answers what ssh asks, and its end, a cancel, or the five-minute bound of a question, browser check or key touch ends the attempt before the first question, between questions or on one. Show, ask, answer, cancel and the deadline go through one lock, so a stale Cancel cannot end a later question. The last-held-window rule is gone; a connect no screen made asks nobody. An update stopped on a sign-in runs first on the next press.
A released lease asks nobody: a question waiting is refused and a browser check or key touch waiting ends, but a sign-in that needs nobody, keys, the agent or Tailscale SSH, goes on as one nobody pressed for, so a core move whose window closed after its request still runs its checks.
yansfil
added a commit
that referenced
this pull request
Oct 30, 2026
…four hided flakes (#1860) Closes with-hide/hide-private#351 Closes with-hide/hide-private#321 Closes with-hide/hide-private#347 Closes with-hide/hide-private#330 Related: with-hide/hide-private#339 (diagnostics only; the issue stays open) ## Summary Five flaky hided tests, one cause each: - #351 (`link_mux` connection end): on macOS a `recv` blocked on a local socket sometimes misses its peer's shutdown, and after that misses its own end's shutdown too. Then a core-side mux never saw its node end and kept its streams. Every macOS `LocalStream` read now waits in `poll` first, which hears both. The test's own `SO_RCVTIMEO` (EINVAL on macOS after the end) is replaced by a reading thread with a hang guard. - #321 (`device_bootstrap`): five tests each copied and stripped the 140 MB debug `hided` at once, past the fixture's 10 s command bound. A shared helper now strips and signs each build version once under a lock, and `remote_delivery` and `core_move` use it too. - #347: its one flaky run was the CI merge commit 15f05b4 of a #1846 head that was later rewritten, where 43 of 44 `core_move` tests failed together. It has passed first try on main since. The cause of that run is not proven; the issue is closed on the later main passes (evidence in the issue comment). - #330: the test was deleted with the SFTP upload in 14b6b68. - #339 (WSL, Windows only): the cause is not found. The journey keeps its steps and the Hide AI progress in a bounded in-memory record (256 lines) and prints it only when it fails. At its own 105 s guard, before the lane's 120 s one, it prints the record and the distribution's processes, read by an owned `ps` bounded to 10 s, and ends the test. A passing run prints nothing. ## Review - **판단해 주세요**: a macOS-only `poll` before every local-socket read, against the kernel's lost wakeup, instead of changing each caller that waits for a peer's end. - **조심해서 볼 파일**: `hide-platform/src/ipc.rs` - high-frequency path: every `LocalStream` read on macOS (Herdr socket, mux, pane service). - **조심해서 볼 파일**: `hided/tests/it/support/shipped.rs` - shared state across test processes: lock, half-made copy cleanup, eviction of an older build. - **질문**: `link_mux`'s end tells the link's user by shutting down its end of an in-process pair, which a Windows peer does not hear until the handle closes, and no `link_mux` test runs on Windows. Should that become its own issue? - **비용 검토**: one `poll(2)` per macOS read, with no new thread, timer, queue or notification. Linux and Windows read paths are unchanged (`cfg!(target_vendor = "apple")`). The mux frame reader sits behind a `BufReader`, so a frame is not one read per field. ## Evidence - **확인한 것**: #351 reproduced before the fix: `the_connection_ending_frees_every_stream` failed in 1 of 13, 1 of 81 and 1 of 141 stress iterations (both signatures). A stack sample showed the core's demux thread asleep in `recvfrom` after its peer ended. - **확인한 것**: the kernel behaviour, in C at load ~30 on macOS 15.1: `recv` after the peer's `shutdown(SHUT_WR)` hung for over 60 s, about once in 4,500 rounds. A `poll` wait hung 0 times in 48,000 rounds, and `close()` 0 times in 18,000. - **확인한 것**: the new contract test `a_shutdown_ends_the_peers_blocked_read_every_time` hung in recvfrom on its first iteration before the fix. Its rounds now run in an owned exact-test subprocess bounded to 60 s. With the macOS `poll` removed again, it failed at stress iteration 12 (round 3,724) in 10 s, with the subprocess reaped. With the fix: 75 runs × 5,000 rounds passed, and the `link_mux` tests passed 300 of 300 stress iterations (before the drain's failure-path change, which only touches a timeout). - **확인한 것**: `device_bootstrap` passed 6 of 6 twice locally at 8 threads (macOS, private sshd and pinned Herdr 0.9.5). The store held one stripped copy, rebuilt once when the build changed. - **확인한 것**: `hide-platform` + `hided` (lib and `it`) 971 tests and `herdr-core` + `hide-herdr-client` 3,496 tests passed on macOS with the change. Clippy `-D warnings` and fmt are clean. - **확인한 것**: the new contract is Unix only: on the first CI run, `os contract (windows)` showed that a Windows shutdown never reaches the peer (`CancelIoEx` ends this end's own I/O; the peer hears the end when the handle closes). - **확인하지 못한 것**: #339's cause (no WSL here). `wsl_device.rs` is Windows-only; a cross-check from macOS could not build its C dependencies, so the `windows wsl` lane is its first compile. - **확인한 것 (비용, 미시)**: a C microbenchmark of plain `recv` vs `poll`+`recv` on one socketpair (macOS 15.1, load 18-48), not a product build. 64 B messages × 300,000: `recv` 1.14-5.87 µs per read over 5 completed trials, `poll`+`recv` 1.61-6.71 µs over 9. The difference within a matched pair was 0.3-1 µs; 2 more `recv` trials hung on the lost wakeup. 16 KiB × 20,000, 6 trials each: 5.7-17.8 µs vs 6.4-16.4 µs, with the pairs disagreeing in sign (noise). - **확인하지 못한 것 (비용, 실사용)**: `docs/PERFORMANCE_TESTING.md`'s matched idle/driven terminal measurement (`scripts/web-shell-measure`, `MEASURE_SCENARIO=keys`: key echo p50/p95, hided CPU and RSS, base a891332 vs this head). It was not run: two release builds do not fit on this Mac's disk now, and its load is 20-60. The microbenchmark does not prove the product's end-to-end cost. - **확인하지 못한 것**: `core_move` and `remote_delivery` with the shared helper (left to the remote mailbox lane). <details><summary>Verification record</summary> </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
다른 기기의 core에 붙는 연결과 core 이동은 지금까지 ssh가 비밀번호나 처음 보는 서버 확인을 물으면 아무에게도 묻지 못하고 "로그인 필요"로 멈췄습니다.
이제 운영자가 창에서 직접 누른 시도(띠의 로그인·다시 시도, 이동 점검)에서는 장비 줄과 같은 입력칸, 서버 지문 확인, 브라우저 링크, 보안 키 터치 안내가 그 시도를 시작한 화면에 나옵니다: core 연결은 창 위 띠, core 이동은 이동 대화상자.
질문은 누른 창에만 보이고 그 창만 답합니다.
취소하거나, 질문·브라우저 확인·보안 키 터치를 5분 안에 끝내지 않거나, 누른 창을 닫으면 질문이 뜨기 전이든 두 질문 사이든 시도가 끝나고, 입력한 값은 어디에도 남지 않습니다.
Hide가 스스로 하는 재연결과 창 없이 한 연결(
hide connect)은 여전히 아무것도 묻지 않고 로그인 필요로 멈춥니다.실패는 장비 줄과 같은 세 가지(로그인, 바뀐 서버 키를 터미널에서 확인, 다시 시도)로 보이고, 바뀐 서버 키에는 다시 시도가 없습니다.
누른 한 번은 로그인 한 번만 묻습니다.
창 위 띠: 다시 시도가 시작한 연결이 비밀번호를 물으면 띠 아래에 장비 줄과 같은 입력칸이 펼쳐집니다.
이동 대화상자: 점검이 키 암호를 물으면 입력칸과 ssh-add 안내가 점검 중 문구 아래에 나옵니다.
Review
다시 점검이로그인으로 바뀝니다. 장비 줄의 다시 시도와 같은 규칙입니다.hided/src/screen_sign_in.rs- 누름 하나가Lease하나: 누른 화면 연결이 주인이고, 보이기·묻기·답·취소·5분 기한이 모두 한 잠금 아래에서 처리됩니다. 현재 lease가 아니면 다이얼이 1초 안에 ssh를 끝내고 거둡니다(failure path, 원칙 14).hide-node/src/ssh/upstream.rs- 다이얼이 lease를 가져가며(may_ask(Option<lease>)), lease가 없으면NoSignIn이라 화면에 아무것도 뜨지 않습니다(D-06, B14).hided/src/node_role.rs,hided/src/node_daemon/screen.rs- 띠의 다시 시도가 그 창의 lease를 잡고(connect_again(Some(screen))), 창 연결이 끝나면Press가드가 lease를 끝냅니다. 붙기가 다이얼 없이 열린 세션을 쓰면 남은 lease는 그 자리에서 버립니다. 업데이트 다이얼이 로그인에서 멈추면 다음 누름이 업데이트를 먼저 한 뒤 같은 세션으로 붙습니다(update_owed).hided/src/core_move/control.rs- 점검 요청이 요청한 화면의 lease를 잡고,MoveScreen::frame이 질문을 그 화면에만 보냅니다. 대화상자를 닫으면 질문 번호 없는 취소가 시도를 끝냅니다.hide connect, 앱 실행)은 묻지 않고 로그인 필요로 멈춥니다. 비밀번호 서버라면 앱을 연 뒤 띠의로그인을 한 번 더 눌러야 합니다.contracts/hided-ws.schema.json-core_link·core_move프레임의sign_in,ssh_problem과action: sign_in이벤트.problem이 이제 장비 줄의 묶음(DeviceProblem) 코드입니다.Evidence
system_ssh::unix::a_core_link_asks_on_its_screen_only_for_the_operator_s_own_dial): 누르지 않은 다이얼은 아무것도 띄우지 않고 sign_in_needed; A가 누른 다이얼은 지문을 A에게만 보이고 B의 답은NotOwner, A의 취소는 sign_in_needed; 같은 연결의 다음 다이얼은 묻지 않음; A가 질문 중에 닫으면 다이얼이 기한 전에 바로 끝남; A가 질문 전에 닫으면 아무것도 뜨지 않고 sign_in_needed; 신뢰 후 연결되고, known_hosts를 지운 뒤 같은 연결의 다음 다이얼은 묻지 않고 열린 세션으로 실행됨.screen_sign_in::tests): 주인만 답함, 질문 전·두 질문 사이 닫기, 질문 번호 없는 취소, 보안 키 터치와 브라우저 확인이 기한에 시도를 끝냄, q1 취소가 나중에 온 q2를 건드리지 않음, 새 누름이 이전 lease를 끝내고 이전 lease의 끝은 새 것을 건드리지 않음.core_move::control::the_checks_sign_in_belongs_to_the_screen_that_asked_for_them): 질문은 A의 프레임에만, B의 답은move_not_asker, B가 닫아도 그대로, A가 질문 중·질문 전에 닫으면 끝남, 대화상자 닫기의 번호 없는 취소, 화면 없이 요청한 점검은 lease 없음.node_role::tests::an_update_stopped_on_a_sign_in_runs_first_on_the_next_press- 로그인에서 멈춘 업데이트는 깨우기로 대기가 끝나지 않고, 누름 없는 시도는 lease도 업데이트도 가져가지 않으며, 누름이 업데이트를 먼저 가져가고 그 뒤 붙기는 누름 없이 다이얼합니다. 보안 키 터치는 askpass 데스크에서도 5분에 끝납니다(askpass::tests::a_touch_that_never_comes_ends_the_attempt_at_its_bound).remote_core::a_core_link_that_needs_the_operator_dials_again_only_when_they_connect가 서버 연결 수로 확인합니다.remote_core하네스는 화면 websocket을 다루지만, node 데몬의 core 별칭이 질문을 하게 만들려면(처음 보는 서버 키나 비밀번호를 가진 별칭으로 node를 띄우기) 새 하네스가 필요합니다. sshd 테스트는ScreenSignIn과Upstream을 직접 이어 소유권과 닫기 시점을 증명하고, 이동 쪽은MoveScreen단위 테스트가 필터와 닫기를 증명합니다.추가 증거
띠: 처음 보는 서버의 지문, 어느 쪽도 미리 고르지 않은 두 버튼.
띠: 로그인 필요로 멈춘 연결은
로그인을 둡니다.띠: 서버 키가 바뀌면
ssh mini복사만 두고 다시 시도는 없습니다(#1840의 장비 줄과 같음).대화상자: 점검이 처음 보는 서버를 만났을 때.
대화상자: 연결 점검이 바뀐 서버 키로 멈추면 장비 줄의 문구와 명령, 다시 점검은 없습니다.
영어.
Verification record
-j 4, pinned Herdr 0.9.5): 44/44 on 58134d7.bash scripts/verify-cargo.sh lint: exit 0.bash scripts/verify-cargo.sh test: exit 101, onlyhide-memorystore tests that share one process in parallel (a different one each run) at load average 127-235;cargo test -p hide-memory --lib -- --test-threads=1205/205, nextest passes; this branch does not touchhide-memory(with-hide/hide-private#338).bash scripts/verify-web.shwith pnpm 10: 2277 passed, 2 failed, bothsrc/OverviewGraph.test.tsx(5 s timeout under load, then its cascade); the file alone passes 17/17. With the shell's pnpm 12 the install refuses (ERR_PNPM_IGNORED_BUILDS).screen_sign_in::tests(10),core_move::control::tests::the_checks_sign_in_belongs_to_the_screen_that_asked_for_them,node_role::tests::an_update_stopped_on_a_sign_in_runs_first_on_the_next_press,askpass::tests::a_touch_that_never_comes_ends_the_attempt_at_its_bound,system_ssh::unix::a_core_link_asks_on_its_screen_only_for_the_operator_s_own_dial(real sshd): 14/14 pass; webcoreLinkSignIn.test.tsx5/5,coreMove.test.ts10/10.