Repository navigation
feat: keep pane records and reconcile them with the holders that run - #1927
Merged
Merged
Conversation
…s leftovers process::arguments reads the words a process started with (Linux cmdline, macOS KERN_PROCARGS2, Windows ProcessCommandLineInformation split as the C runtime does), checked against its start time; process::running now answers on Windows by the file at each image's path; process::boot_id names this boot on macOS and Linux; Session::left_by finds a session again by its recorded leader once its holder is gone; ipc::remove_leftover removes what a killed listener left.
hide_holder_protocol::record: format 1 as JSON, bounded reads that tell an unknown format, a corrupt file and an unreadable one apart from no record, atomic private writes, the records lock and its bound, and the end reasons.
With --record, --record-lock and --incarnation a holder writes itself into the record before it starts the program, the program once it runs and running once its socket listens, and refuses a start the record no longer reserves; at every end it writes why before the connection hears it, and logs holder.record_unwritten with that end when the write fails.
… an ended pane again
yansfil
added a commit
that referenced
this pull request
Oct 31, 2026
…pment switch (#1934) Related: 엔진 교체 묶음 2의 다섯 번째 PR. 선행 #1917, #1918, #1927, #1929 (모두 main에 있음). ## Summary 보관 프로그램(pane holder)은 지금까지 혼자서만 시험됐고, hide-node가 그것을 띄우고 다시 찾아 붙는 길이 없었습니다. 이 PR은 개발 스위치 `HIDE_DEV_PANE_HOLDER=1`이 켜진 로컬 노드가 pane을 보관 프로그램으로 시작·끝내고, 지금 터미널 서비스로 화면을 붙이게 합니다. 노드가 다시 뜨면 기록으로 살아 있는 보관 프로그램을 찾아 64개에 화면을 붙이고, 나머지는 살려 둔 채 `attach_limit`으로 보고하며, 없던 동안 끝난 pane은 기록된 이유로 pane마다 한 번 보고합니다. 다른 노드가 인계하면 재시도하지 않고, 가장 오래된 지원 버전보다 오래된 보관 프로그램은 끝내지 않고 "지원하지 않는 버전"으로 보고합니다. 스위치가 꺼져 있으면 지금 Herdr 세션 길 그대로이고 보관 프로그램을 하나도 띄우지 않습니다. 스크린샷 없음: 화면 변경 없음 (앱은 이 묶음에서 보관 프로그램 pane을 보여 주지 않음). ## Review - **판단해 주세요**: 이 묶음은 로컬 노드만 보관 프로그램을 띄웁니다. 기기 노드는 스위치가 켜져도 진단 로그(`pane_holder.device_node_unsupported`)를 남기고 Herdr 길로 돕니다. OwnedChild 작업 묶음에 BREAKAWAY_OK를 더하는 일과 그 계약 시험은 묶음 3에서 기기 kit과 함께 넣습니다(Conductor 결정). - **판단해 주세요**: 다시 붙을 때 크기는 코어가 레이아웃을 갖는 묶음 3 전까지, 한 번 붙어 Welcome이 알려 주는 보관 프로그램의 지금 크기를 그대로 씁니다(Resize를 보내지 않음). 같은 크기 resize는 보관 프로그램이 PTY를 다시 맞추고 프로그램에 신호를 보내므로 보내지 않습니다. - **조심해서 볼 파일**: `hide-node/src/terminal/session.rs` - Herdr 길이 지나는 곳. 세션의 읽기·쓰기를 transport trait으로 나눴고, Herdr transport는 같은 NDJSON 줄을 같은 순서로 씁니다(아래 Evidence의 기존 시험). - **조심해서 볼 파일**: `hide-node/src/terminal/mod.rs` - failure path. 닫힘이 문자열 대신 구조화된 category를 받고, `taken_over`·`program_exited`·`terminated`·`unsupported_holder_version`은 재시도하지 않습니다(`final_close`). Herdr 닫힘은 지금처럼 `closed_category`로 읽습니다. - **조심해서 볼 파일**: `hide-kit/src/panes.rs` - 끝내기 연결이 Closed 없이 EOF로 끊기면 보관 프로그램이 살아 있는 동안 20초 안에서 다시 붙어 terminate를 보냅니다. 시작 요청에 테마(필수, 시작 키에는 미포함)를 실어 `--theme`으로 넘기고, ready 줄의 `job=`을 `pane_holder.started`에 남깁니다. - **비용 검토**: 화면 조각 배달 경로에 복사나 잠금을 더하지 않았습니다. 보관 프로그램 조각의 바이트는 그대로 frame으로 옮겨지고(NDJSON·base64를 거치지 않음), 서비스 잠금 아래에서는 pane 이름 조회 하나(`keeps_own_size`, 경로 복제 없이 `contains_key`)만 늘었습니다. redraw는 쓰개 명령 하나로 resize와 같은 값을 치릅니다. 키 입력은 잠금 아래에서 base64 줄을 만들던 것이 바이트 복사로 바뀌고 인코딩은 쓰개 스레드로 옮겨졌습니다. - **조심해서 볼 파일**: `hide-node/src/terminal/holder.rs` - 같은 크기 resize는 보관 프로그램에 보내지 않으므로, 서비스가 전체 화면을 다시 달라고 하던 곳(redraw, 같은 크기 view, frame 유실)은 `SessionWriter::redraw`로 묻습니다. Herdr는 지금처럼 같은 크기 resize 줄을 쓰고, 보관 프로그램은 `ClientMessage::Redraw`를 받습니다. - **조심해서 볼 파일**: `hide-holder-protocol/src/lib.rs` - `ask`가 버전을 받고, 노드는 pane 기록의 `protocol`로 묻습니다. 줄의 바이트는 같습니다(v1 fixture 통과). - **조심해서 볼 파일**: `hided/src/env.rs` - `HIDE_DEV_PANE_HOLDER`를 등록해 데몬 점검이 잘못된 값을 다른 키와 함께 보고합니다. 기기 노드는 잘못된 값이면 터미널 시작이 실패하고, `1`이면 진단 로그를 남기고 Herdr 길로 돕니다. ## Evidence - **확인한 것 (macOS, 실제 hide-node 코드와 빌드된 hide-holder)**: `hide-holder/tests/it/node.rs` 7개 통과. - redraw: 보관 프로그램 pane에 redraw와 같은 크기 view를 보내면 각각 새 전체 frame이 오고, 그 뒤 프로그램이 찍은 줄이 보관 프로그램 읽기에 있고 그 뒤 frame에 그려짐. - Windows에서 이 시험이 두 번 실패한 원인은 시험 줄이었습니다(제품 결함 아님). `print_node`가 Windows에서 `set B=<word>& call echo %B%-node`를 쳤는데, cmd는 줄을 읽을 때 `%B%`를 먼저 펼치고 그다음에 `set`을 실행합니다. 그래서 한 셸에서 두 번째 단어를 치면 앞 단어가 다시 찍힙니다("viewed" 대신 "redrawn-node"). 근거: d2c291c(run 41207004565)에서는 첫 단어 "redrawn"이 화면에 그려지고 두 번째 "viewed"만 실패했고, d3e18c813에서는 보관 프로그램 읽기에도 "viewed-node"가 끝내 없었습니다. 한 셸에 두 단어를 찍는 시험은 이것이 처음입니다. 이제 줄은 `echo <word>^-node`(캐럿이 친 줄에 그 글자가 생기지 않게 함)이고, 실패하면 pane 글자를 함께 보여 줍니다. d3e18c813에서 잠깐 느슨하게 바꾼 확인(frame 수만 봄)은 되돌렸습니다. 보관 프로그램 쓰개의 redraw를 같은 크기 resize로 되돌리면 이 시험이 "a full frame after the ask never happened"로 실패함을 확인. - 스위치 꺼짐: Attach가 Herdr attacher로 가고 버전 폴더·소켓·기록이 하나도 생기지 않음. - 켜짐: 시작 후 첫 전체 frame, 입력 바이트가 셸에 닿음(읽기로 확인), 같은 요청 재시작은 Existing이고 같은 incarnation·holder, terminate 뒤 holder가 사라지고 기록은 `terminated`. - 강제 종료: `node` 역할 프로세스가 66개 pane을 띄운 뒤 kill. 새 노드가 65개를 찾아 이름순 64개에 첫 전체 frame, 65번째는 `unavailable`/`attach_limit`으로 보고되고 붙지 않고 살아 있음, 노드가 없던 동안 찍힌 줄이 첫 전체 frame에 있음, 끝난 pane은 `program_exited`로 한 번만 보고, 모든 holder·program pid와 시작 시각이 이전과 같음. 66개 시작 4.1초, 다시 찾아 64개 그리기 0.14초(전체 5.2초). - 인계: 잘못된 첫 메시지 뒤에도 첫 노드 입력이 닿음. 두 번째 노드 인계 뒤 첫 노드는 `taken_over`, `retry_decision: none`, 7초 동안 다시 뺏지 않음. 인계 뒤 첫 노드가 친 줄은 셸에 닿지 않음. - 버전: 바이트로 고정한 v1 fixture(`fixture_v1.rs`)에 기록으로 붙어 화면·입력·크기·redraw·기록 버전으로 읽기·끝내기, 모르는 kind 0개, hello는 버전 1을 포함. protocol 0 기록은 `unsupported_holder_version`으로 보고되고 프로세스와 버전 폴더가 남음. - **확인한 것 (B1)**: hide-node의 기존 Service 시험(`terminal/tests.rs`, `device_tests.rs`)은 한 줄도 바꾸지 않고 통과. hide-node + hide-kit 417개 통과. `session.rs` 자체 단위 시험은 쓰개 명령 타입이 바뀐 세 줄만 고쳤고 단언은 그대로. - **확인한 것**: 9a6508269에서 `scripts/verify-cargo.sh lint` 통과, `scripts/verify-cargo.sh test` 6,890개 통과 0개 실패(macOS), `cargo hakari` 변경 없음, `check-engine-boundary.py` 통과. - **확인한 것 (리뷰 1회차, d2c291c, 시험 수정 0854c31)**: `scripts/verify-cargo.sh lint` 통과. hide-holder, hide-holder-protocol, hide-node, hide-kit, hided 1,182개 통과(macOS). `hided` env 시험이 `HIDE_DEV_PANE_HOLDER=yes`를 다른 잘못된 키와 함께 보고함을 확인. `check-engine-boundary.py` 통과. - **확인한 것 (CI run 41201429951, 9a65082)**: vt 레인 Linux·macOS·Windows에서 `node::` 6개 모두 통과. 66개 pane 강제 종료 시험은 Linux 3.7초, macOS 10.0초, Windows 10.9초. rust workspace, windows check, os contract 3 OS, verify 통과. - **확인하지 못한 것**: 실제 앱과 hided에서 스위치를 켠 실행은 하지 않았습니다(이 묶음은 화면이 없음). Windows ARM64와 실제 Windows PC는 묶음 3 범위입니다. <details><summary>Verification record</summary> </details>
yansfil
added a commit
that referenced
this pull request
Nov 1, 2026
…st Herdr (#1952) Related: engine bundle 2 (pane holder), the last of #1917, #1918, #1927, #1929, #1934; with-hide/hide-private#405 ## Summary This shows that a pane keeps running, untouched, when the node that holds it is killed and a new one takes it back, with every supported agent's real CLI on macOS, Linux and Windows, and measures the holder path against Herdr's. A new lane restarts the node under each pinned CLI: 21 cells on three systems. Measured on macOS against Herdr v0.9.5, the holder path is faster and within every agreed bound; one fix was needed, so a holder now gives freed heap memory back once its screen is still. One Windows Antigravity cell failed once in ten runs: agy read the holder's answer to its color question as keys. The cause and the product question are in hide-private#405; until it closes, the lane shows that cell but does not fail on it, whatever the cause of that cell's failure. The lane, the measurement and the probe end everything they start, by pid and start time, however a run ends. 스크린샷 없음: 화면 변경이 없습니다(개발 스위치 아래의 노드, CI 레인, 측정 스크립트, 문서). ## Review - **판단해 주세요**: the holder answers color questions (OSC 10/11) from the theme whether or not a screen is attached, while Herdr with no client answers none; that difference is what made agy open its editor once (hide-private#405). Should a holder answer only while a screen is attached? - **판단해 주세요**: the memory bounds are a decision of this mission, not the PRD's 3 MB per holder: one holder idle at most 4 MiB, attached or not, and 6 MiB (4 MiB and the parser's 2 MiB scrollback) once a flood has settled. 3 MB was below a holder's own floor (about 2.8 MB before it draws anything; 3.47 MB idle with a screen attached, its connection's buffers included) and had not counted the scrollback. Figures before the change are under the tables. - **조심해서 볼 파일**: - `hide-holder/src/holder.rs` (`next_job`, `return_freed`) - the high-frequency path: the writer waits once for 1 s after its last fragment, then gives freed pages back and waits with no bound; a connection's first return and one after 1 MiB of output are logged (`holder.memory_returned`), so a pane redrawing a line every second does not fill its log. Nothing is added to the PTY reader or the encoder but the pane's count of bytes fed. - `scripts/holder_owned.py` - the one end for every process the lane, the measurement and the probe start: children as started, holders by their pane records, everything under them by one look at the process table; one failing end does not stop the others, and the folder goes only once nothing runs. `scripts/tests/test_holder_owned.py` holds it after a node restart that fails and after SIGTERM. - `scripts/holder-restart-check.py` (`KNOWN_FAILURES`) - the Windows Antigravity cell, keyed `antigravity` as the contract names it, is shown as a known failure and not counted while hide-private#405 is open, unless it leaves a process running; the other 20 cells block. The mark hides every failure of that cell, not only #405's cause, so its reason in the report is what tells a new one apart; a key naming no agent of the contract stops the run, and `scripts/tests/test_holder_restart_known_failures.py` holds the mark, the pass and the fail. A CLI off its pin fails its cell, and the holder's identity is checked against the process table. - `hide-node/src/terminal/holder.rs`, `hided/src/core.rs` - `Holders::start_local` takes the holder folders only with the switch on (`Option<HolderFolders>`). - `.github/workflows/holder-restart.yml`, `scripts/ci-plan.py` - the lane on three systems; the five extra Antigravity runs are gone. - **비용 검토**: per output, a byte count; per burst, one wake and one heap walk (`malloc_zone_pressure_relief`, glibc `malloc_trim`, `HeapCompact`) a second after the last fragment; an idle holder wakes 0 times in 60 s. The lane job took 2.7 to 6.1 minutes per system (runs 41234750464, 41237366181: build 78 to 90 s, cells 24 to 39 s, color probe about 80 s); the `holder_node` example adds 17 to 44 s per system. ## Evidence - **확인한 것**: - Restart lane on three systems, CI run 41250820500 on this head: 21/21 cells pass with every CLI at its pin and nothing left running (table below). - The comparison after a restart is text only: the first full frame, drawn on two xterms, is compared line by line with the holder's own read, with the cursor; colors and attributes are `screen.rs`'s to check, not the lane's. - Measurement, macOS release builds, 120x40: five alternating pairs at 1, 64, 100 and 128 panes, re-analyzed (not re-measured): six pairs that saw a build process in some phase are dropped and listed, 3 or 4 pairs are kept per count at load 1.5 to 15.1, and all 45 bounds pass (verdict table below). - Slow consumer, re-measured: three pairs at 64 panes with only one pane's connection slowed (holder: a proxy on its socket reading 10 ms of every 40; Herdr: its session client stopped 30 ms of every 40). The slow pane drew 44 to 48 frames of a 75 MB flood against about 460 unslowed; the echo pane's p50 stayed 0.19 to 0.24 ms against Herdr's 0.7 to 2.1; CPU 0.07 times Herdr's; the node's own memory grew 0.04 to 0.11 MiB on either path, so its deliveries queue did not grow. - One holder flooded 300 MB with no screen attached: 2.72 MiB before, 5.16 MiB after, under 6 MiB. - The 71 and 72 wakes in the 2.5 s after attach in two 128-pane rounds (64 in the other three): three 128-pane rounds on this head woke exactly 64 times, one per attached holder, with the 64 unattached at 0; the 60 s idle windows were 0 in every round. - The idle and memory tests wait on state (the holder's logged return, then the kernel's count standing still), never a fixed settle; `memory.rs` waits for the return logged after the flood's last line and holds the 6 MiB budget on Linux and Windows in every build, and on macOS that the holder is within the budget or its return brought it down (local debug, five runs: 7.20 to 9.14 MiB at the flood's end, 5.86 to 6.75 MiB after; a CI runner: 5.08 MiB at the end, 5.09 after), the release measurement judging the bound there; a unit test shows a full 2 MiB scrollback drops its oldest rows first and keeps its size. - Cleanup: `test_holder_owned.py` passes and fails when pane records are ignored; a measurement round stopped by SIGTERM left no process and no folder; `test_holder_perf_close.py` holds that a round's own failure is raised with what its close left beside it. - **확인하지 못한 것**: - The Electron item is reproduced, not run: no packaged app runs in CI. The test builds the same job flags, and the lane starts its node through Node's spawn; the Electron binary itself was not used. - Windows Antigravity: 1 failure in 10 runs (20c9452), cause not proven. The probe measured one answer per question and 1.5 ms (max 4.3 ms) on Windows. Its Herdr side is a private v0.9.5 server with one pane started by `herdr pane run` and no client attached; whether Herdr answers while a screen is attached was not measured (hide-private#405). - The holder's 4 MiB fragment cap was not reached by the measurement (a 120x40 frame is about 6 KB); the unit tests split a larger screen. - The extra 7 to 8 wakes of two battery rounds are not attributed: that run kept no per-holder count, and the final build did not repeat them. - Freed-memory return on Windows has no effect: an 8 MB flood leaves 3.81 MiB kept and 4.20 MiB given back; on Linux glibc leaves nothing to give (2.96 against 2.95 MiB). Only macOS gains. - Linux and Windows have no Herdr comparison in numbers; CI holds their boundaries (wakeups, the memory budget, input exactness, caps) only. <details><summary>21 cells (agent x system), this head</summary> Run 41250820500 (40248e9). Each cell: result (first turn / reattach / second turn, s); every CLI matched its pin and no cell left a process running. | agent | CLI (pin) | Linux | macOS | Windows | |---|---|---|---|---| | claude-code | 2.1.302 | pass (0.7 / 0.01 / 0.3) | pass (1.5 / 0.07 / 0.4) | pass (2.4 / 0.08 / 0.3) | | codex | 0.163.0 | pass (2.2 / 0.01 / 0.3) | pass (3.1 / 0.04 / 0.4) | pass (1.3 / 0.09 / 0.4) | | grok | 1.0.52 | pass (0.4 / 0.01 / 0.3) | pass (1.6 / 0.02 / 0.4) | pass (2.9 / 0.11 / 0.3) | | opencode | 2.0.29 | pass (2.0 / 0.01 / 0.5) | pass (1.7 / 0.03 / 0.5) | pass (3.3 / 0.09 / 0.5) | | pi | 1.0.4 | pass (0.6 / 0.01 / 0.3) | pass (0.6 / 0.02 / 0.3) | pass (0.9 / 0.08 / 0.3) | | omp | 18.7.0 | pass (1.6 / 0.01 / 0.3) | pass (1.5 / 0.02 / 0.4) | pass (3.8 / 0.09 / 0.8) | | antigravity | 1.4.8 | pass (0.6 / 0.01 / 0.3) | pass (0.7 / 0.06 / 0.4) | pass (1.0 / 0.11 / 0.3) | Windows Antigravity, five more runs in the same job at 080c2f6 (that step is gone from the workflow; this is its record): pass, pass, pass, pass, pass. Through 080c2f6: 1 failure in 10 runs (20c9452, hide-private#405); it passed at 2fca9dc and on this head. </details> <details><summary>Measurement tables (macOS; dropped pairs listed first)</summary> **Dropped pairs (a build process in some phase of either round)** | panes | pair | build processes seen (path phase: count) | |---|---|---| | 1 | 5 | holder start: 2; holder idle_unattached: 3; herdr end: 2; herdr idle_attached: 3; herdr latency_alone: 2; herdr reattach: 2 | | 64 | 1 | herdr idle_attached: 4; herdr latency_alone: 4 | | 64 | 5 | holder start: 3; holder idle_unattached: 3; herdr idle_unattached: 3 | | 100 | 2 | herdr idle_unattached: 2; herdr idle_attached: 3 | | 128 | 4 | herdr start: 3 | | 128 | 5 | herdr idle_unattached: 3; herdr idle_attached: 3; herdr latency_alone: 3; herdr flood_one: 8; herdr flood_eight: 2 | Kept pairs: 1 panes [1, 2, 3, 4], 64 panes [2, 3, 4], 100 panes [1, 3, 4, 5], 128 panes [1, 2, 3] **Latency, key to frame at the node: each kept pair (ms; load min-max of both rounds)** | panes | phase | pair | load | holder p50 | Herdr p50 | holder p95 | Herdr p95 | p50 ratio | p95 ratio | |---|---|---|---|---|---|---|---|---|---| | 1 | latency_alone | 1 | 2.0-7.8 | 0.26 | 19.49 | 0.65 | 21.21 | 0.01 | 0.03 | | 1 | latency_alone | 2 | 1.7-4.5 | 0.40 | 19.99 | 0.79 | 22.20 | 0.02 | 0.04 | | 1 | latency_alone | 3 | 2.7-8.8 | 0.33 | 19.87 | 0.69 | 22.46 | 0.02 | 0.03 | | 1 | latency_alone | 4 | 2.4-6.3 | 0.41 | 20.11 | 0.96 | 22.51 | 0.02 | 0.04 | | 1 | reattach | 1 | 2.0-7.8 | 0.26 | 19.97 | 0.71 | 23.64 | 0.01 | 0.03 | | 1 | reattach | 2 | 1.7-4.5 | 0.29 | 20.44 | 1.06 | 22.58 | 0.01 | 0.05 | | 1 | reattach | 3 | 2.7-8.8 | 0.37 | 19.61 | 0.82 | 21.46 | 0.02 | 0.04 | | 1 | reattach | 4 | 2.4-6.3 | 0.36 | 19.43 | 1.10 | 22.60 | 0.02 | 0.05 | | 64 | latency_alone | 2 | 1.6-15.1 | 0.24 | 3.50 | 1.22 | 3.67 | 0.07 | 0.33 | | 64 | latency_alone | 3 | 1.5-5.3 | 0.41 | 1.15 | 0.89 | 1.28 | 0.35 | 0.70 | | 64 | latency_alone | 4 | 2.2-8.8 | 0.39 | 0.68 | 0.98 | 0.76 | 0.57 | 1.29 | | 64 | flood_one | 2 | 1.6-15.1 | 0.18 | 3.58 | 0.73 | 19.03 | 0.05 | 0.04 | | 64 | flood_one | 3 | 1.5-5.3 | 0.18 | 1.20 | 0.76 | 18.82 | 0.15 | 0.04 | | 64 | flood_one | 4 | 2.2-8.8 | 0.14 | 0.72 | 0.57 | 19.59 | 0.19 | 0.03 | | 64 | flood_eight | 2 | 1.6-15.1 | 0.21 | 13.80 | 0.98 | 83.13 | 0.02 | 0.01 | | 64 | flood_eight | 3 | 1.5-5.3 | 0.23 | 14.19 | 0.94 | 76.56 | 0.02 | 0.01 | | 64 | flood_eight | 4 | 2.2-8.8 | 0.22 | 0.99 | 0.75 | 83.91 | 0.22 | 0.01 | | 64 | reattach | 2 | 1.6-15.1 | 0.42 | 3.07 | 0.75 | 3.34 | 0.14 | 0.22 | | 64 | reattach | 3 | 1.5-5.3 | 0.26 | 2.22 | 0.76 | 2.46 | 0.12 | 0.31 | | 64 | reattach | 4 | 2.2-8.8 | 0.23 | 1.21 | 0.66 | 31.46 | 0.19 | 0.02 | | 100 | latency_alone | 1 | 2.3-8.8 | 0.27 | 1.66 | 0.81 | 1.81 | 0.16 | 0.45 | | 100 | latency_alone | 3 | 2.2-6.1 | 0.33 | 1.19 | 0.83 | 1.71 | 0.28 | 0.49 | | 100 | latency_alone | 4 | 2.2-7.1 | 0.30 | 1.28 | 0.70 | 1.61 | 0.23 | 0.44 | | 100 | latency_alone | 5 | 3.1-11.2 | 0.30 | 1.72 | 0.75 | 1.98 | 0.18 | 0.38 | | 100 | flood_one | 1 | 2.3-8.8 | 0.16 | 1.77 | 0.55 | 19.13 | 0.09 | 0.03 | | 100 | flood_one | 3 | 2.2-6.1 | 0.16 | 1.23 | 0.57 | 19.07 | 0.13 | 0.03 | | 100 | flood_one | 4 | 2.2-7.1 | 0.13 | 1.32 | 0.58 | 20.58 | 0.10 | 0.03 | | 100 | flood_one | 5 | 3.1-11.2 | 0.14 | 1.92 | 0.89 | 20.38 | 0.07 | 0.04 | | 100 | flood_eight | 1 | 2.3-8.8 | 0.22 | 14.61 | 0.81 | 76.61 | 0.01 | 0.01 | | 100 | flood_eight | 3 | 2.2-6.1 | 0.21 | 12.94 | 0.89 | 77.33 | 0.02 | 0.01 | | 100 | flood_eight | 4 | 2.2-7.1 | 0.25 | 5.77 | 1.05 | 83.54 | 0.04 | 0.01 | | 100 | flood_eight | 5 | 3.1-11.2 | 0.23 | 3.69 | 0.98 | 88.61 | 0.06 | 0.01 | | 100 | reattach | 1 | 2.3-8.8 | 0.33 | 1.25 | 0.63 | 14.91 | 0.26 | 0.04 | | 100 | reattach | 3 | 2.2-6.1 | 0.33 | 0.73 | 0.94 | 0.84 | 0.45 | 1.12 | | 100 | reattach | 4 | 2.2-7.1 | 0.44 | 1.36 | 0.89 | 44.42 | 0.32 | 0.02 | | 100 | reattach | 5 | 3.1-11.2 | 0.23 | 0.75 | 0.72 | 0.85 | 0.31 | 0.84 | | 128 | latency_alone | 1 | 2.4-14.1 | 0.40 | 1.74 | 0.97 | 1.92 | 0.23 | 0.50 | | 128 | latency_alone | 2 | 3.7-10.3 | 0.23 | 2.17 | 0.99 | 2.35 | 0.11 | 0.42 | | 128 | latency_alone | 3 | 4.0-14.6 | 0.29 | 0.79 | 0.65 | 0.96 | 0.36 | 0.68 | | 128 | flood_one | 1 | 2.4-14.1 | 0.16 | 1.84 | 0.72 | 19.25 | 0.09 | 0.04 | | 128 | flood_one | 2 | 3.7-10.3 | 0.15 | 2.31 | 1.51 | 18.83 | 0.06 | 0.08 | | 128 | flood_one | 3 | 4.0-14.6 | 0.15 | 0.82 | 0.61 | 20.84 | 0.18 | 0.03 | | 128 | flood_eight | 1 | 2.4-14.1 | 0.23 | 3.81 | 0.98 | 82.28 | 0.06 | 0.01 | | 128 | flood_eight | 2 | 3.7-10.3 | 0.21 | 14.65 | 1.05 | 78.88 | 0.01 | 0.01 | | 128 | flood_eight | 3 | 4.0-14.6 | 0.23 | 4.70 | 0.96 | 84.66 | 0.05 | 0.01 | | 128 | reattach | 1 | 2.4-14.1 | 0.29 | 1.72 | 1.00 | 2.01 | 0.17 | 0.50 | | 128 | reattach | 2 | 3.7-10.3 | 0.28 | 0.80 | 0.77 | 0.89 | 0.35 | 0.86 | | 128 | reattach | 3 | 4.0-14.6 | 0.31 | 2.77 | 1.58 | 3.06 | 0.11 | 0.52 | **Latency bound: median over kept pairs of holder - (1.1 x Herdr + 0.5 ms)** | panes | phase | pairs | p50 margin | p95 margin | pairs within (p50, p95) | verdict | |---|---|---|---|---|---|---| | 1 | latency_alone | 4 | -22.05 | -24.22 | 4/4, 4/4 | pass | | 1 | reattach | 4 | -21.96 | -24.27 | 4/4, 4/4 | pass | | 64 | latency_alone | 3 | -1.35 | -1.02 | 3/3, 3/3 | pass | | 64 | flood_one | 3 | -1.64 | -20.70 | 3/3, 3/3 | pass | | 64 | flood_eight | 3 | -15.47 | -90.97 | 3/3, 3/3 | pass | | 64 | reattach | 3 | -2.67 | -3.42 | 3/3, 3/3 | pass | | 100 | latency_alone | 4 | -1.83 | -1.63 | 4/4, 4/4 | pass | | 100 | flood_one | 4 | -2.06 | -21.51 | 4/4, 4/4 | pass | | 100 | flood_eight | 4 | -10.56 | -88.01 | 4/4, 4/4 | pass | | 100 | reattach | 4 | -1.32 | -8.49 | 4/4, 4/4 | pass | | 128 | latency_alone | 3 | -2.01 | -1.65 | 3/3, 3/3 | pass | | 128 | flood_one | 3 | -2.37 | -20.95 | 3/3, 3/3 | pass | | 128 | flood_eight | 3 | -5.44 | -90.02 | 3/3, 3/3 | pass | | 128 | reattach | 3 | -2.11 | -1.71 | 3/3, 3/3 | pass | **Flood CPU (user+sys s of the path's processes): each kept pair** | panes | phase | pair | load | holder CPU | Herdr CPU | ratio | |---|---|---|---|---|---|---| | 64 | flood_one | 2 | 1.6-15.1 | 2.03 | 10.53 | 0.19 | | 64 | flood_one | 3 | 1.5-5.3 | 1.95 | 10.61 | 0.18 | | 64 | flood_one | 4 | 2.2-8.8 | 2.01 | 10.56 | 0.19 | | 64 | flood_eight | 2 | 1.6-15.1 | 51.93 | 59.64 | 0.87 | | 64 | flood_eight | 3 | 1.5-5.3 | 54.77 | 58.35 | 0.94 | | 64 | flood_eight | 4 | 2.2-8.8 | 55.23 | 59.87 | 0.92 | | 100 | flood_one | 1 | 2.3-8.8 | 1.99 | 10.67 | 0.19 | | 100 | flood_one | 3 | 2.2-6.1 | 2.00 | 10.69 | 0.19 | | 100 | flood_one | 4 | 2.2-7.1 | 1.99 | 10.85 | 0.18 | | 100 | flood_one | 5 | 3.1-11.2 | 1.91 | 11.02 | 0.17 | | 100 | flood_eight | 1 | 2.3-8.8 | 55.57 | 55.55 | 1.00 | | 100 | flood_eight | 3 | 2.2-6.1 | 55.37 | 58.68 | 0.94 | | 100 | flood_eight | 4 | 2.2-7.1 | 48.57 | 38.32 | 1.27 | | 100 | flood_eight | 5 | 3.1-11.2 | 49.35 | 46.80 | 1.05 | | 128 | flood_one | 1 | 2.4-14.1 | 1.99 | 10.68 | 0.19 | | 128 | flood_one | 2 | 3.7-10.3 | 2.11 | 10.70 | 0.20 | | 128 | flood_one | 3 | 4.0-14.6 | 1.97 | 11.02 | 0.18 | | 128 | flood_eight | 1 | 2.4-14.1 | 54.08 | 57.65 | 0.94 | | 128 | flood_eight | 2 | 3.7-10.3 | 47.68 | 58.38 | 0.82 | | 128 | flood_eight | 3 | 4.0-14.6 | 51.09 | 50.80 | 1.01 | **Loss, wakeups and memory in every kept round** | panes | rounds | input exact | lost on screen | idle holder wakeups (max) | one holder idle max MiB | one holder after a flood max MiB | 64 attached: holder / Herdr | |---|---|---|---|---|---|---|---| | 1 | 8 | 8/8 | 0 | 0 | 2.92 | - | - | | 64 | 6 | 6/6 | 0 | 0 | 3.17 | 5.91 | 0.73 (pairs 0.71, 0.74, 0.73) | | 100 | 8 | 8/8 | 0 | 0 | 3.00 | 5.91 | - | | 128 | 6 | 6/6 | 0 | 0 | 3.28 | 5.88 | - | **Slow consumer at 64 panes: one pane's connection read 10 ms of every 40 (holder: proxy on its socket; Herdr: its session client stopped 30 ms of 40)** | pair | load | holder p50 / p95 ms | Herdr p50 / p95 ms | holder CPU / Herdr CPU s | ratio | flooded holder after, still MiB | node before / after / still MiB (holder) | node before / after / still MiB (Herdr) | wall s holder / Herdr | |---|---|---|---|---|---|---|---|---|---| | 1 | 4.6-8.9 | 0.24 / 1.31 | 0.70 / 17.43 | 0.53 / 7.42 | 0.07 | 5.63, 5.63 | 6.44 / 6.55 / 6.55 | 6.36 / 6.48 / 6.48 | 9.5 / 10.0 | | 2 | 4.4-8.3 | 0.22 / 0.99 | 2.09 / 14.38 | 0.52 / 7.25 | 0.07 | 4.94, 4.94 | 6.59 / 6.63 / 6.63 | 6.44 / 6.58 / 6.58 | 9.5 / 10.1 | | 3 | 4.1-13.2 | 0.19 / 1.51 | 1.66 / 22.43 | 0.52 / 7.54 | 0.07 | 4.95, 4.95 | 6.64 / 6.74 / 6.74 | 6.33 / 6.55 / 6.55 | 9.5 / 10.3 | **One unattached holder flooded 300 MB: before 2.72 MiB, right after 5.16 MiB, still 2.5 s 5.16 MiB** **Verdicts** | bound | verdict | figure | |---|---|---| | latency latency_alone at 1 | pass | p50 -22.05 ms, p95 -24.22 ms | | latency reattach at 1 | pass | p50 -21.96 ms, p95 -24.27 ms | | latency latency_alone at 64 | pass | p50 -1.35 ms, p95 -1.02 ms | | latency flood_one at 64 | pass | p50 -1.64 ms, p95 -20.70 ms | | latency flood_eight at 64 | pass | p50 -15.47 ms, p95 -90.97 ms | | latency reattach at 64 | pass | p50 -2.67 ms, p95 -3.42 ms | | latency latency_alone at 100 | pass | p50 -1.83 ms, p95 -1.63 ms | | latency flood_one at 100 | pass | p50 -2.06 ms, p95 -21.51 ms | | latency flood_eight at 100 | pass | p50 -10.56 ms, p95 -88.01 ms | | latency reattach at 100 | pass | p50 -1.32 ms, p95 -8.49 ms | | latency latency_alone at 128 | pass | p50 -2.01 ms, p95 -1.65 ms | | latency flood_one at 128 | pass | p50 -2.37 ms, p95 -20.95 ms | | latency flood_eight at 128 | pass | p50 -5.44 ms, p95 -90.02 ms | | latency reattach at 128 | pass | p50 -2.11 ms, p95 -1.71 ms | | flood CPU flood_one at 64 | pass | median ratio 0.19 over 3 pairs | | flood CPU flood_eight at 64 | pass | median ratio 0.92 over 3 pairs | | flood CPU flood_one at 100 | pass | median ratio 0.19 over 4 pairs | | flood CPU flood_eight at 100 | pass | median ratio 1.03 over 4 pairs | | flood CPU flood_one at 128 | pass | median ratio 0.19 over 3 pairs | | flood CPU flood_eight at 128 | pass | median ratio 0.94 over 3 pairs | | loss at 1 | pass | 8/8 exact, 0 lost on screen | | idle wakeups at 1 | pass | max 0 | | memory idle <= 4 MiB at 1 | pass | max 2.92 MiB | | memory: 64 attached panes' holders <= 1.5 x Herdr's | pass | median 0.73 | | loss at 64 | pass | 6/6 exact, 0 lost on screen | | idle wakeups at 64 | pass | max 0 | | memory idle <= 4 MiB at 64 | pass | max 3.17 MiB | | memory after a flood <= 6 MiB at 64 | pass | max 5.91 MiB | | loss at 100 | pass | 8/8 exact, 0 lost on screen | | idle wakeups at 100 | pass | max 0 | | memory idle <= 4 MiB at 100 | pass | max 3.00 MiB | | memory after a flood <= 6 MiB at 100 | pass | max 5.91 MiB | | loss at 128 | pass | 6/6 exact, 0 lost on screen | | idle wakeups at 128 | pass | max 0 | | memory idle <= 4 MiB at 128 | pass | max 3.28 MiB | | memory after a flood <= 6 MiB at 128 | pass | max 5.88 MiB | | slow consumer pair 1: input exact, none lost | pass | | | slow consumer pair 1: flooded holder <= 6 MiB once still | pass | 5.63 MiB | | slow consumer pair 2: input exact, none lost | pass | | | slow consumer pair 2: flooded holder <= 6 MiB once still | pass | 4.94 MiB | | slow consumer pair 3: input exact, none lost | pass | | | slow consumer pair 3: flooded holder <= 6 MiB once still | pass | 4.95 MiB | | slow consumer latency | pass | p50 margin -2.14 ms, p95 -18.36 ms | | slow consumer flood CPU | pass | median ratio 0.07 | | unattached holder after a flood <= 6 MiB | pass | 5.16 MiB | 45 of 45 pass **Before the freed-memory return** (pair 1 of the first battery, same method): one holder idle 3.06 MB unattached and 3.47 MB attached at 64 panes (bound then 3 MB); after a 300 MB flood 8.2 MB, and 8.4 to 8.9 MB after 0.46 to 1.5 GB on one holder. </details> <details><summary>Method</summary> `scripts/holder-perf.py` (docs/PERFORMANCE_TESTING.md, The pane holder's path): the node is hide-node's `holder_node` example built through `Holders::start_local`; the Herdr path is a private server of the pinned v0.9.5 (HOME, XDG folders, HERDR_SESSION, HERDR_CONFIG_PATH and HERDR_SOCKET_PATH its own) attached through the node's Herdr sessions, the holder path the same node with `HIDE_DEV_PANE_HOLDER=1`, both at 120x40 running `/bin/sh` on the same Mac in alternating rounds. Latency is a 12-letter token typed through the node's `key` until a frame showing it reaches the node's screen sink, 200 tokens 40 ms apart on an extra echo pane, alone, beside one pane flooding 300 MB, beside eight panes flooding 75 MB each, and beside one 75 MB flood whose connection alone is read slowly; memory is `phys_footprint`, wakeups `pkg_idle_wkups + interrupt_wkups`, CPU user+sys from `proc_pid_rusage`; the echo's log is compared token for token with what was typed. Each phase records the load and the build processes running; a pair either of whose rounds saw a build process is dropped. Release binaries ran from a folder of their own, with no cargo running in this worktree during a round. </details> <details><summary>Verification record</summary> - Head: 23d54df (`test: pass a macOS holder within its budget or one its return brought down`), main merged at 61c5e93. - CI: run 41258509161 on 23d54df, `verify` success, `vt` and the holder restart lane success on Linux, macOS and Windows. The 21-cell table is from run 41250820500 on 40248e9 (21/21, none marked known failure); 41247368773 on 2fca9dc was 21/21 too. - Local check at 23d54df: `scripts/verify-cargo.sh lint` and `test`, 55 test binaries, 7014 passed, 0 failed, with `HERDR_*` and `HIDE_*` unset; `python3 -m unittest discover scripts/tests` OK (21 skipped). - `memory.rs` on macOS debug, five local runs: 7.20 to 9.14 MiB at the flood's end, 5.86 to 6.75 MiB after its return; the macOS runner at 61c5e93 read 5.08 MiB at the flood's end and 5.09 after (job 124704224457), within the budget, which the check now passes. - Measurement: re-analysis of the earlier battery (no new rounds) with `analyze.py`, 45/45 bounds pass; slow consumer and unattached flood re-measured with release binaries copied out of the worktree. - Run artifacts stay local, under the mission's run folder, not in this repository. </details>
yansfil
added a commit
that referenced
this pull request
Nov 1, 2026
…answers (#1963) Closes with-hide/hide-private#409 ## Summary The pane holder's fidelity check found that the old version folders were never cleaned up. This fixes that and six smaller gaps from the same check. All of it sits behind the development switch `HIDE_DEV_PANE_HOLDER=1` except the Windows device Herdr copy cleanup (item 5). - A node with the switch on removes the holder version folders of other builds that nothing runs from, once each time it starts, after it has found its holders again; what it could not remove and more than eight folders left go to its diagnostic log (B20). - A program whose answers wait past 64 KiB has them refused with a reason: the holder logs it and tells a node that accepts the new `notices` capability, which logs it with the pane id; a node that does not accept it is sent nothing and the protocol version stays 1 (B14). - A device's pinned Herdr copy on Windows is kept while any process holds a file in it, and kept when that cannot be told. The deletion started in #1927, which taught `process::running` to read Windows' process table; its description named `running` on Windows but not this effect, so it was not intended. - The idle holder test reads a thread that ends during its watch as work, not as a `NotFound` crash; the flood-close and self-exit tests can no longer pass without proving the end. - The "Zig not found" message names the Zig version the pins need, and `docs/BUILD.md` says the Mac mini's `vt (macos)` job prepares its own Zig. 스크린샷 없음: no screen changes; everything here is a daemon, holder, kit or test change. ## Review - **판단해 주세요**: the answer refusal is reported as a capability-gated `Notice` message, not a new protocol version or a closed connection, because the connection did nothing wrong and the pane runs on. - **조심해서 볼 파일**: `hide-holder/src/holder.rs` - failure path: `Answers::send` now takes a mutex per parse that has answers, and refusals go through the holder's event loop to the connection. - **조심해서 볼 파일**: `hide-holder-protocol/src/lib.rs` - wire: new kind `0x92` and capability `notices`; an unknown notice reason reads as `Other`, never as a broken frame. - **조심해서 볼 파일**: `hide-host/src/kit.rs` - failure path on Windows devices: a copy whose files cannot all be asked is now kept; a kept copy and a failed removal each log one `kit.herdr_copy_*` line on the node's error stream. - **조심해서 볼 파일**: `hide-node/src/terminal/holder.rs` - ownership: the prune runs on the recover thread after `recover`, so the folders of holders the reconcile ended go in the same start. - **비용 검토**: the prune runs once per node start on the existing background thread and waits at most 30 s for starts; notices are at most two per run of refusals, never per answer, and a writer that falls behind holds at most one notice per reason (folded, counts added). ## Evidence - **확인한 것**: `scripts/verify-cargo.sh lint && scripts/verify-cargo.sh test` on macOS at 4cd7b70 with `HERDR_*` removed: 7031 passed, 0 failed, 158 ignored. - **확인한 것**: prune (B20) - `node::a_starting_node_removes_the_old_version_folders_nothing_runs_from`: of three folders the unused older one goes, the one a v0 holder runs from and the current one stay, `pane_holder.folders_pruned` says removed 1, in use 1, failed 0. - **확인한 것**: queues (B14) - `queues.rs`: 17 x 64 KiB input closes with `input_queue_full` and the pane runs on; 6000 OSC 11 questions are refused with `answer_queue_full`, a node accepting `notices` gets refused then resumed, a v1 node accepting only `screen` gets nothing and keeps its connection. - **확인한 것**: node notice - `node::a_node_logs_the_answers_its_holder_refused_with_the_pane_and_keeps_the_session` logs `pane_holder.answers_refused` with pane id `q1` and the session keeps drawing. - **확인한 것**: restart lane (run 41273266602) - in all 21 cells (7 agent CLIs x Linux, macOS, Windows) the real switch-on `holder_node` logged `pane_holder.folders_pruned` removing the planted older folder `v0-0000000000000000`, with no failure, and every cell passed. - **확인한 것**: `holder::tests::refusals_and_resumptions_a_writer_has_not_sent_fold_into_one_of_each`: 1000 refuse/resume pairs leave 2 queued notices with summed counts, newest reason last. - **확인한 것**: lifecycle and idle tests now fail on `holder.pty_close_unconfirmed`, a failed `holder.ended`, or a self-exit before the program and its first child were seen running (on Windows the child keeps starting grandchildren, so only those two are asserted); `idle` reads a thread that ended as work, not a `NotFound` panic. - **확인한 것**: `kit::tests::an_older_herdr_copy_stays_while_a_process_runs_it_and_goes_once_none_does` now runs on every system, and the Windows check lane runs it. - **확인한 것**: the Zig-missing message names the pinned version, and `scripts/check-vt-build-refusals.sh` asserts it. - **확인한 것**: CI run 41273266602 green, including `vt` and `holder restart` on all three systems and `windows check`. - **확인하지 못한 것**: the `kit.herdr_copy_kept` and `kit.herdr_copy_remove_failed` records have no test of their own; the kept/removed behavior they report is covered by the kit test on every system. - **확인하지 못한 것**: `check-vt-build-refusals.sh` was not run locally (it builds hide-vt twice without Zig); the CI `vt` job runs it. <details><summary>Verification record</summary> - Commits: ffe13c6 m14, 3e03271 m15, 958777a S1, f74eca1 m16, 9f185fa m13, 9adfa56 m12, 708386c m8, 45a0118 rustfmt; review 1: 5214e82 Windows self-exit test, 50048e6 notice folding, ca267ac restart-lane prune check, 4cd7b70 kit copy records. - `python3 -m unittest discover -s scripts/tests`: 779 OK (21 skipped); identity, harness anchor and engine boundary guards ok. </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.
Related: #1917, #1918 (engine bundle 2, pane holder)
Summary
A pane's holder outlives the node that started it, but until now nothing remembered which holders a state folder owns.
This adds that memory as a library hide-node will call: a record per pane, and a reconcile that runs when a node starts.
<state>/holders/records/naming its holder and program by pid and start time, its phase and, once ended, why.스크린샷 없음: 화면이 바뀌지 않는 라이브러리 변경입니다 (아직 제품 경로가 부르지 않습니다).
Review
hide-kit/src/panes.rs- failure path and ownership: what ends a process, and the re-read under the lock before each Terminate or kill.hide-holder/src/holder.rs,hide-holder/src/main.rs- small record hooks the screen-input worker's changes also touch.hide-platform/src/process.rs-arguments(macOSKERN_PROCARGS2, Windows PEB command line throughNtQueryInformationProcess),runningon Windows,boot_id.Evidence
hide-holder/tests/it/records.rstests and 2hide-kitpanes::testson macOS start the built holder the way a node does and check the record, the processes by pid and start time, and the socket files.holder_capwith 2 log lines.holder_lostand removed the socket and its lock file.ready(record alreadyrunning) is taken as started, and a start given up on is recordedstart_unconfirmedwith its holder ended (hide-kitunit tests with a stand-in process).hide-platformcontract tests forarguments,boot_id,running,Session::left_by(a reused pid finds nothing) andremove_leftover.scripts/verify-cargo.sh lintandscripts/verify-cargo.sh teston macOS passed on 2e4f66c: 6841 tests passed, 0 failed, across 55 test binaries; CI run 41182624657 on c7fbd40 passedvtandos contracton all three systems andwindows check.vtandwindows checklanes are the first Windows proof.hide_kit::panesyet; hide-node wires it in a later PR.Verification record
bash scripts/verify-cargo.sh lint: exit 0 (macOS)bash scripts/verify-cargo.sh test: exit 0, 6841 passed, 0 failed (macOS, 2e4f66c)bash scripts/verify-cargo.sh nextest -p hide-holder -p hide-kit -E 'test(/records::/) | test(/panes::tests/)': 19 passedpython3 -m unittest scripts/tests/test_ci_plan.py: 81 passedsettle_lost->a_killed_holders_pane_is_settled_by_the_next_reconcilefailed; restored