Skip to content

Move the core's machine work behind the node link (core-host-node 2a) - #692

Merged
yansfil merged 75 commits into
mainfrom
prd/core-host-node-2a
Oct 7, 2026
Merged

yansfil merged 75 commits into
mainfrom
prd/core-host-node-2a

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: core-host-node 2a/5 (항상 켜진 노드에서 core 돌리기).
#664(병합됨, ed64668) 다음 layer입니다. base는 main입니다.

Summary

core(herdr-core)는 결정과 상태만 갖고, 기계를 직접 만지지 않게 했습니다.
파일, 프로세스, Herdr 소켓, 세션 파일은 node의 일이고, core는 계약 하나(NodeLink, 새 crate hide-node-link)로 node id를 지정해 묻습니다.
이 PR에서는 core 자신의 node(hide_node::Local, hided 프로세스 안)가 모든 호출에 답합니다. 화면과 동작은 바뀌지 않습니다.

  • core가 하던 git, gh, hide-ai, 포트, agent sleep, kit, 세션 읽기, clone, worktree, 문서 저장, 첨부, Herdr 연결이 Call::*로 node에 갑니다.
  • 카탈로그는 경로를 직접 읽지 않고, 재빌드 전에 lock 밖에서 node에 한 번 묻습니다(Call::PathFacts). 새 프로젝트도 node가 만듭니다(Call::ProjectCreate).
  • 링크 기록의 세션 파일 상태(있음/없음)도 node에 묻습니다(Call::RealPaths). node가 답하지 못하면 "알 수 없음"으로 둡니다.
  • hided의 파일 열기(opener)와 pane 자격 증명의 커널 증거, bootstrap 소켓은 hide-node로 옮겼습니다.
  • 탐색기 감시는 이 Mac과 device를 하나의 감시자로 합쳤습니다. 둘 다 node id로 그 node에 Call::Stamps를 묻습니다.
  • scripts/check-core-touches-no-machine.py가 core의 운영 코드에서 기계 접근을 막습니다. 예외 파일마다 허용 개수를 적어 두어, 예외 파일 안에 새로 생긴 접근도 실패시킵니다. policy lane에서 돕니다.
core(결정, 상태, 자기 저장소) --NodeLink(node id)--> node(파일, 프로세스, Herdr, 세션)
  이 PR: core 자신의 node만, 같은 프로세스 안에서 답함
  2b: SSH 위의 같은 계약, device helper가 hided node 역할로 합쳐짐

Review

  • 판단해 주세요: 탐색기 감시를 "옮기기" 대신 "합치기"로 했습니다. 이 Mac의 핸들 polling을 지우고 device와 같은 stamp 비교로 바꿨습니다. 200 ms poll과 200 ms 묶음 창은 그대로입니다. 이 Mac의 root는 boundary가 등록 때 확인한 identity로 고정합니다(목록 읽기와 같은 identity). 그래서 같은 경로에서 바꿔치기된 root는 목록과 감시 모두 거절합니다. device root는 helper가 바꿔치기를 알리면 다시 열고 감시 폴더를 모두 한 번 알립니다.
  • 판단해 주세요: 카탈로그 행의 경로가 node의 비교 형태(실제 경로)입니다. 예전에는 pane에서만 보인 행이 이름 그대로(/var/...)였고, 등록 행만 실제 경로였습니다. 이제 둘 다 /private/var/...처럼 실제 경로입니다.
  • 조심해서 볼 파일: herdr-core/src/session_sync/coordinator.rs, runtime/session.rs (high-frequency path, runtime mutex). 재빌드 전에 lock 밖에서 PathFacts를 묻고, 같은 경로 집합이면 30초 refresh까지 재사용합니다. coordinator가 카탈로그를 한 번 넘긴 runtime은 그 뒤 카탈로그 없이 들어온 session(닫기 상태 읽기 등)에서도 lock 안에서 node를 부르지 않고 마지막 답을 씁니다. coordinator가 없는 runtime(fixture, 첫 Herdr 응답 전)만 lock 안에서 자기 node에 묻습니다.
  • 조심해서 볼 파일: herdr-core/src/live.rs 프로젝트 생성 (failure path). 폴더와 git init은 node가 하고 실제 경로를 답합니다. 등록은 그 경로로 합니다.
  • 조심해서 볼 파일: hide-project/src/lib.rs (failure path). 저장소 안의 HEAD, ref, 포인터 파일, config를 regular file로만, 링크를 따라가지 않고, pipe에서 막히지 않게 열고 크기 상한(포인터 64 KiB, config 1 MiB)을 둡니다. pane 안의 프로세스가 .git/config를 pipe로 바꿔도 카탈로그가 멈추지 않습니다.
  • 조심해서 볼 파일: hided/src/watch.rs (high-frequency path). 이 Mac 감시는 200 ms마다 in-process Call::Stamps 한 번(폴더 최대 64), device는 2초마다 한 번, 실패한 poll은 어느 쪽이든 2초 뒤에 다시 묻습니다. 답한 link는 poll 사이에 재사용해서 매 poll마다 core owner thread를 거치지 않습니다.
  • 조심해서 볼 파일: hided/src/env.rs (failure path). 상대 경로 HERDR_SOCKET_PATH는 시작 때 HERDR_SOCKET_PATH: invalid로 거절합니다. 예전에는 연결은 됐지만 pane 증명이 조용히 checkout binding으로 내려갔습니다.
  • 비용 검토: 카탈로그 재빌드 1회당 node 호출 1회(경로 4,096개 단위), 경로 집합이 그대로면 30초에 1회. lock 안에서는 node를 부르지 않습니다(테스트가 호출 수 0을 확인). 감시는 대기열 없이 직전 답을 기다린 뒤 다음 poll을 합니다.
  • 조심해서 볼 파일: herdr-core/src/worktrees.rs Git watch (high-frequency path, failure path). 감시 대상이 바뀌면 새 감시를 시작하되, 새 감시가 Watching을 알릴 때까지 옛 감시를 유지해 두 집합에 모두 있는 저장소는 감시가 끊기지 않습니다(main은 저장소마다 watch/unwatch해서 틈이 없었습니다). 감시가 끝나거나 시작하지 못하면 30초 뒤 다시 시작하고, 다시 감시가 시작되면 모든 프로젝트를 한 번 다시 읽습니다. 시작 실패는 매번 다시 묻지 않고 30초 간격으로 다시 시도합니다.
  • 조심해서 볼 파일: hide-node-link/src/protocol.rs (snapshot wire 아님, node 프로토콜). 2a가 node 호출 38개를 더해서 PROTOCOL_VERSION을 22로 올렸습니다(main의 #656이 공유 서버 끄기로 21을 먼저 썼습니다). 이 빌드의 helper를 아직 받지 않은 device는 Hello에서 거절되고, 새 payload의 digest가 달라서 다음 연결에서 새로 설치됩니다.
  • B1 예외로 적은 테스트 수정: 이미 있던 테스트 a_commit_in_one_project_does_not_rerun_status_in_another, moved_remote_ref_refreshes_one_project_once_after_a_burst, idle_and_working_tree_edits_do_not_reread_but_manual_refresh_does와 helper changes_before_sentinel을 고쳤습니다. 저장소를 만들 때의 Git 쓰기(symbolic-ref)와 sentinel 자신의 늦은 쓰기가 감시 시작 뒤에 도착해 측정에 섞였기 때문입니다. 단언(프로젝트별 git status 횟수 1과 0, behind_upstream)은 그대로이고, 측정 전에 sentinel로 정리하고 이미 시작된 읽기를 기다립니다. main의 고치지 않은 테스트에도 같은 경쟁이 있는지는 돌려보지 않았습니다(같은 Repository::new 구조라서 있을 것으로 추정).
  • 질문: hided에 남긴 것은 자격 증명 registry(pane_auth.rs, 증명은 이 프로세스에서 hide_node::pane_proof로 읽음)와 감시자 스케줄러(watch.rs)입니다. registry는 layer 4에서 node 역할 hided가 link로 보내는 증명을 받도록 바꾸려 합니다. 괜찮을까요?
  • 질문: 파일 열기의 안전 규칙(server.rs::openable, 실행 파일과 handler가 실행하는 파일 거절)은 hided의 open handler 곁에 남았습니다. 그 handler는 main에서 이미 연결되지 않은 코드(#[allow(dead_code)])라서, 연결하는 변경이 규칙을 launcher 곁으로 옮기도록 문서에 적었습니다.
  • 질문: core에 남은 기계 접근은 check에 이유와 개수로 적었습니다. SSH 전송(remote.rs, remote/, ssh_hosts.rs)은 2b, terminal attach child(live.rs)와 첨부는 layer 3, label generator lock은 layer 4입니다. AI 선택 파일(hide_ai::settings)은 core 저장소로 두었습니다.
  • 알려진 예외: main이 이 PRD 뒤에 넣은 Software Factory 엔진은 이 PR 뒤에도 core의 기계에서 직접 일합니다. runner(hide_factory::exec, 경계 check가 이름으로 금지)가 git, gh(issue와 pull request 만들기, merge, rerun, gh::allowed가 덮지 않는 호출), 확인 명령(/bin/sh -c)을 돌리고, 버리는 Task의 worktree는 node의 확인된 삭제 대신 hide_host::worktrees::remove_worktree로 강제 삭제하고 branch -D합니다. 남은 디스크와 자기 실행 파일 위치도 직접 읽고, hide-factory crate는 프로젝트 파일(guide, package.json, Makefile)을 스스로 읽습니다(check가 보는 폴더 밖). 모두 main의 동작 그대로이고, factory.rs를 LATER_LAYERS에 2b 항목(15)으로 적었습니다. 2b가 이것을 모두 core 자신의 node로 옮기고 항목을 지웁니다(Observer 결정). docs/ARCHITECTURE.md에도 적었습니다. 이 PR에서 node로 가는 것은 Factory의 AI 판단(factory_router)과 worker pane 닫기입니다.
  • main과 달라진 동작: Factory의 판단 thread는 core가 사라지면(Weak upgrade 실패) 끝납니다. main은 홈의 AI 선택을 읽어 판단을 계속했지만, 답을 받을 core가 없고 node도 core가 줍니다.

Evidence

  • 확인한 것: sasu implement verify PASS on 98b6440(지금 head). S1 Rust 전체 suite, S2 lint, 격리 HOME과 긴 TMPDIR.
  • 확인한 것: CI 전 lane 통과 on 5edb1b8(98b64402는 진행 중)(rust workspace, windows check, os contract 3종, web e2e linux 4/4, windows e2e, desktop e2e, package linux/windows).
  • 확인한 것: 로컬 web e2e 205/206(새로 빌드한 hided, load 20 아래). 남은 1건 agents-tab.spec.ts:46은 이 Mac에 Homebrew로 설치된 OpenCode가 login shell PATH로 보여 "Installed 5"가 된 환경 차이입니다. 이 PR은 agent 탐지(hide-kit/src/agents.rs, hide_platform::programs)를 바꾸지 않았고 CI에서는 통과합니다.
  • 확인한 것: Rust workspace nextest 2832/2833(load 15에서 19). 남은 1건 opener_lifecycle acceptance_timeout은 테스트 안의 경쟁(2초 수락 창과 가짜 helper의 pid 기록)으로, 단독 5/5 통과, 코드는 그대로 옮겼고 Name the core's own machine by its node id and convert stored state once #664 tree에서도 같은 실패를 봤습니다.
  • 확인한 것: Git watch 테스트의 간헐 실패 2종은 flake로 두지 않고 테스트를 고쳤습니다. sentinel 자신의 늦은 쓰기가 기준선에 섞인 것(d3eb073), 저장소 준비 때의 ref 쓰기(symbolic-ref)가 감시 시작 뒤에 도착해 다른 프로젝트 읽기를 먼저 깨운 것(5edb1b8, 측정 전에 sentinel로 정리). 고친 뒤 worktree behavior 테스트 전체 stress 30/30, Git watch 3건 40/40(고치기 전 1/24 실패). main의 codex_trust 시간 초과 1건(load 34에서 41)은 이 PR이 바꾸지 않은 테스트입니다.
  • 확인한 것: lock 안에서 node를 부르지 않음. reconciling_with_a_precomputed_catalog_runs_no_git가 세는 node(CountingNode)로, 카탈로그를 받은 뒤 카탈로그 없는 session까지 호출 0을 확인합니다.
  • 확인한 것: 링크로 들어간 checkout 아래 중첩 worktree를 구분하는 테스트는 예전 동작으로 되돌리면 실패하고 지금 통과합니다. 바꿔치기된 root 거절(boundary identity), 상대 socket 거절, pipe와 큰 config 거절, 세션 파일 상태(있음, 없음, 알 수 없음)를 단위 테스트합니다.
  • 확인한 것: 경계 check가 심어 둔 위반, 예외 파일 안의 새 접근을 잡고, 이유가 사라진 항목을 실패시킵니다(scripts/tests/test_core_touches_no_machine.py 7건). clippy -D warnings, fmt, design contract 통과.
  • 확인한 것: PathFacts 비용: 실제 worktree 경로 24개(저장소 1개)에 p50 2.8 ms, p90 3.1 ms, 최대 9.1 ms(debug 빌드, load 21에서 24).
  • 확인한 것: 저장소의 HEAD와 config가 링크여도 main처럼 따라가 읽습니다(regular file, 비차단, 크기 상한은 유지). a_linked_head_and_config_are_read_through_the_link.
  • 확인한 것: Git watch 인계와 끊긴 뒤 다시 읽기를 가짜 node로 단위 테스트합니다(a_git_watch_restarted_after_it_ended_rereads_every_project, a_change_while_the_watched_set_changes_is_kept).
  • 확인하지 못한 것: 유휴/구동 측정은 2b에서 옮긴 reader와 함께 냅니다. moved_remote_ref_refreshes_one_project_once_after_a_burst가 다른 세션이 빌드하던 중 섞어 돌린 stress에서 1/20 한 번 15초 hang guard에 걸렸습니다. 어느 대기였는지는 남기지 못했고, 그 뒤 섞어서 40/40, 단독 30/30입니다.
  • 후속(2b): RealPaths의 상대 경로 하나가 묶음 전체를 실패시키는 것, LinkAnswer Debug의 비밀 가리기, stdio serve의 역할별 호출 허용 목록, gh argv 정확 일치, git 인자 검증, Local::call timeout, SSH link의 call_with_progress(진행과 취소가 있는 호출을 device에 보내기 전), 세션 읽기 호출의 경로 제한과 비차단 열기(main과 같은 동작), PathFacts 답 전체 크기 상한, Windows의 root identity 일치 테스트.
  • 후속(나중): 경계 check가 signature 안의 ;(예: [u8; 4])에서 test 항목을 일찍 끝내는 것(실패가 크게 나므로 숨지 않음), test_ci_plan.py의 EVERY_PACKAGE 하드코딩.
Verification record
  • base: f422844 (Name the core's own machine by its node id and convert stored state once #664 head, on origin/main 411f34a; git merge-tree against origin/main f5a9fe8 clean), head: 0b7a250

  • sasu verify: PASS on 0b7a250(S1 Rust 전체 suite 344.9s, S2 lint; round 5 고침이 동작을 바꿔서 전체 verify). 그 전 PASS: 98b6440. 0b7a2506에서 workspace lint 통과, Git watch와 reader 테스트 45/45, kit, protocol, Factory 테스트 92/92, 경계 check 테스트 8/8.

  • sasu verify: PASS on 98b6440 (test 296.9s, lint 34.8s); earlier PASS on 5edb1b8

  • CI on 5edb1b8: all success (package macos skipped on PRs)

  • local web e2e on 5edb1b8: 205 passed, 1 failed (environment: Homebrew OpenCode on PATH), 38.4m

  • reviews round 1 (e11296d4): Fidelity, Code, Security. Fix now 12건 처리: watcher를 boundary identity로 고정하고 실패 시 2초로 물러남(11ea411), Windows unix gate 2건(0c6ce78), 중첩 worktree를 최신 index로 읽고 lock 안 node 호출 제거(fc97795), 상대 socket 거절(6b193d2), Git 파일 읽기 상한과 비차단(4ce9d8b), 링크 파일 상태를 node에 묻고 check에 허용 개수(e497247, 2b3d36a), 문서 정정(58c3cce). 2b로 넘긴 것: stdio serve의 역할별 호출 허용 목록, gh argv 정확 일치, git 인자 검증, Local::call timeout.

  • reviews round 2 (6c7e832): Security 새 발견 없음. Fidelity: CI와 e2e 증거 요청, 이번 head에서 채움. Code: policy lane test_ci_plan(2b898fe), hide-host gh 테스트 unix gate(586528b), 쓰지 않는 folder_stamps 삭제(9664628), boundary identity 테스트가 바꾸기 전에 stamp(df6fbc4), ARCHITECTURE의 저장소 파일 읽기 규칙(ea84dd1), Git watch 테스트 2건(d3eb073, 5edb1b8).

  • reviews round 3 (5edb1b8): Security Fix now 없음. Fidelity Fix now 1: 고친 기존 테스트를 B1 예외로 기록(Review 절). Code Fix now 1: 측정 전 진행 중 읽기를 기다림(589e937). 받은 follow-up: 링크 HEAD/config(1e0a905), 대기 상한(589e937), 중복 gate 삭제(78356a5).

  • /code-review 1회차 (5edb1b8), 8건: protocol 21(96b411a), Git watch 인계와 끊긴 뒤 다시 읽기(4508968), 시작 실패 재시도 간격(4508968), doc 위치(78356a5) 고침. 받지 않음: 탐색기 200 ms poll(main도 200 ms poll), SSH 취소(2a에서는 device로 안 보냄, 2b), 경계 check ;(이전 회차와 같음), 세션 경로 제한(main과 같음, 2b).

  • reviews round 4 (98b6440): Fix now 3건 처리. Git watch가 어느 감시에서 끊기든 다시 읽기를 한 번 빚지는 하나의 owes_reread(3aad696), Git watch 테스트는 읽기와 대기가 모두 끝난 뒤에만 정리(159706c), discovery가 regular HEAD만 받는다는 문서와 그 뒤 링크 읽기 테스트(41c4289).

  • reviews round 5 (d278df4, round 4 고침과 main Stop Codex's running shared server when the operator turns it off, so a hand-started Codex runs in its own pane #656, Run project Tasks as a DAG through a local Software Factory (stage 1: engine and hide factory) #682, Answer the caller's own registration with hide agent show here #724, Require a pane-bound caller for delivery and agent commands #725 위로의 rebase): Fidelity Fix now 1, Code Fix now 3, Security Fix now 1 처리. 옛 Git watch의 overflow도 다시 읽기를 빚게 함(6e39a90, 고치기 전 실패하는 테스트), join_pending doc 위치(7b1c446), 판단 thread의 동작 변화를 Review에 적음, Factory가 아직 직접 하는 일을 Review와 ARCHITECTURE에 적음(25e3e24). 받은 follow-up: 이름을 바꾼 runner 호출도 check가 잡음(fd1e21f), 이 기계의 공유 서버 끄기가 자기 node로 가는 테스트(94ce4d9, 막는 결함을 심으면 실패). 2b로: hide-factory crate 전체의 기계 접근과 store 개수 분리, Factory gh 쓰기와 느슨한 allowlist 정확 일치, search allowlist 테스트 위치, Git watch collect의 한 pass 안 경쟁, 발견 뒤 링크가 된 HEAD 테스트.

@yansfil
yansfil changed the base branch from main to prd/core-host-node October 7, 2026 02:52
@yansfil
yansfil force-pushed the prd/core-host-node-2a branch from 258d0fe to 6c7e832 Compare October 7, 2026 03:40
@yansfil
yansfil force-pushed the prd/core-host-node branch 5 times, most recently from bce1a82 to f422844 Compare October 7, 2026 08:31
yansfil added 23 commits October 7, 2026 17:36
… its own node

hide-node-link holds the NodeLink trait (was HostChannel), its error and answer types and the wire shapes the core and a node exchange; hide-host re-exports them at their old paths. hide-node holds the machine side, starting with Local, the in-process node that answers through hide_host::serve. hided builds it and passes it to Core::create as the core's own node, so herdr-core no longer constructs an in-process host itself; Runtime::node_link (was device_channel) addresses every node by its id. Behavior is unchanged.
The local session-sync target now carries the link to the core's own node, and the worktree reader asks it with the same Call::Worktrees a device's repository is read with, instead of calling hide_host::worktrees in the core. A refused read is the project's unavailable reason, as on a device. Any target that has a node link gets a worktree reader, so a second answering node needs no new plumbing.
hide_host::serve answers from an Env instead of the process HOME. A device's helper builds it from its process; the core's own node is given the home the core was configured with, so a daemon started with a private home never reads the operator's sessions, kit or Home folder through its node. hide_node::Local carries that Env.
The local label worker reads with the same Call::LabelTranscript a device's worker uses, through the core's own node, so the core no longer reads transcripts in place; LocalTranscripts is gone and DeviceTranscripts is NodeTranscripts. The node answers for the home the core was configured with, so the reads land where they did.
The delivery worker's activity source is one link for every node: the core's own node in process, a device's through its helper, both asked with Call::SessionActivity, so the core no longer reads session files in place. A watch warning keeps the failure words of the machine that answered. Test runtimes that set a home give their own node the same home.
The node knows where its kit's parts are (the desktop package's resources
folder, or a helper root), so the kit_dir core option goes away. The core
sends its own machine the same kit call a device answers, and reads the
hook diagnosis through a new hook_diagnosis call. A standalone node refuses
the kit with the reason the row already showed. Stopping the core closes
its own node, which raises the kit's stop flag before the worker is joined.
Document, Saved, Changed, Listing, Walked, HomeSynced, Registrable, Range,
the worktree facts and their caps now live in hide-node-link, and hide-host
re-exports them where they were. The core names them from the contract
crate, so what it still takes from hide-host is machine work alone.
…node

The branch check and fetch for an existing branch, the purpose and issue
settings in a branch's configuration, the branch move's status, current
branch and checkouts, and the start times a folder removal waits on are
typed node calls (git with a fixed GitCommand, process_starts). The core's
own machine context carries its node for them; a device checkout's purpose
stays in Herdr only and never asks for git.
…ogress

NodeLink gains call_with_progress: the node reports while it works and the
caller answers whether to go on. The disk walk and its layer rules move to
hide-host, the core's DiskReader asks the checkouts' node with disk_usage
and hears each checkout as it finishes, and the volume's free space is the
node's volume_free call. The layer shapes live in the contract crate; the
folder paths still never reach the snapshot wire.
The lsof and native listener reads move to hide-host behind a
listening_ports call. The core keeps the five-second refresh window and
the attribution of a listener to a pane, and asks its machine's node
for the sample, both for the coordinator and for a cleanup's fresh read.
The core sends each gh command line as a node call and parses the
answer; the node checks the allowlist, runs gh with the operator's
login under its time limit and classifies the failure. The main
worktree lookup goes through the node's git, and the gh boundary tests
move to hide-host with their fixture.
The core keeps every cleanup decision (exclusion codes, merge proof,
in-use reads) and asks the checkouts' node for each machine fact: the
registered worktrees, real paths, ref commits and counts, status, the
ignored-repository look, the index list, the folder judgement before a
move, the set-aside rename, the clean removal and the trash wait. The
run's nested-repository allowance is now the core's, carried from one
checkout's judgement to the next.
The URL, progress and failure shapes move to the contract, and the node
re-parses a URL it reads off the link. The node runs the clone and
reports each stage and a once-a-second heartbeat; the core answers each
report with its cancel flag, so a cancel or the runtime going away
still ends Git within a second.
The core still decides whether the pane's foreground group may be ended;
the node sends the signal and refuses a group of 1 or less on its own.
The node reads the picked files with the same refusals and limits and
asks the core before each file whether to go on; the core decodes the
bytes and keeps the admission checks and the quoted paste.
The node reads the Codex CLI login and the newest session's weekly window,
and runs the `claude` usage read with a once-a-second report the core
answers with its cancel. The core keeps the schedule, the endpoint
request, the parsing of the CLI text and the rows.
A request's feature and schema names and a log event's names become
borrowed-or-owned strings, and the request, answer, error, availability,
model list and process measurement derive serde, so they can cross a
node link.
yansfil added 20 commits October 7, 2026 17:36
The node reports a burst as it drains it, so a sentinel's ref write can
reach the reader in a later report than the one the phase returned on,
and the next read_if_due moved it into pending. The edit phase then
counted the sentinel's own repository as a working tree change; it now
starts from pending without the sentinel. 60/60 under stress, where the
old baseline failed one run in four.
…its machine work as a later layer's

The Factory engine main added after layer 2a runs git, gh and check commands
in process through hide_factory::exec::SystemRunner, which the boundary
check did not see. The check now bans that runner, and factory.rs is listed
for 2b with its 15 touches; its AI judgments and its pane close already go
through the core's own node.
…set change

A change the old watch lost while it still stood as cover was dropped, so
nothing read it again; it now sets the owed reread like an end does.
@yansfil
yansfil force-pushed the prd/core-host-node-2a branch from 98b6440 to 0b7a250 Compare October 7, 2026 08:53
Base automatically changed from prd/core-host-node to main October 7, 2026 08:56
@yansfil
yansfil merged commit 3f3444d into main Oct 7, 2026
22 checks passed
@yansfil
yansfil deleted the prd/core-host-node-2a branch October 7, 2026 09:33
yansfil added a commit that referenced this pull request Oct 7, 2026
Related: 1단계 #682 (머지됨, 707ef2c) 위의 2단계 · PRD
`agents/prd/software-factory-ui/prd.md`

## Summary

1단계(#682)로 Factory 엔진, 저장소, `hide factory` CLI가 들어왔지만 운영자는 터미널로만 볼 수
있었습니다.
이 PR은 그 위에 Factory 화면을 얹습니다: 내 차례, 보드, 그래프, Task 페이지, 만들기 시트, 설정, 비서 패널.
코어 스냅샷에 `factory`와 `factory_task` 섹션이 생기고, 엔진 스레드가 비교해 달라졌을 때만 내보냅니다.
화면의 모든 행동은 `factory_action` 이벤트 하나로 1단계 `Command`를 그대로 실어 보냅니다.
사이드바 배지, 요청 뷰의 Factory 줄, ⇧⌘F 단축키가 Factory로 이어집니다.

리뷰 전에 함께 넣은 것 (마지막 push ceae33e 이후):

- 코드 리뷰 3회차의 결함 7개를 고침 (설정 검사 추가 중복, 받지 못하는 숫자 복원, Task 페이지 폼별 요청, i32
우선순위 상한, 받아들여진 답 뒤 보내기 비활성 등), 각각 jsdom 테스트와 함께.
- 흐름 막대의 완료 오늘을 이 기기의 현지 날짜로 셉니다. 전에는 UTC 날짜라 서울 오전 9시 전에 끝난 Task가
빠졌습니다. 엔진 요약을 바꾸는 유일한 변경이며 운영자가 이 PR에 넣도록 허락했습니다
(`hide-platform/src/time.rs`, `hide-factory` Clock 포트에 `utc_offset_ms`).
- 검증 n/3 수에 "검증 실패" 이름을 붙이고, 완료된 Task의 기준은 충족 체크로 그립니다.
- '{{answer}}(으)로 보내기' 대신 조사 없는 '보내기: {{answer}}'; Factory 문구 전체에서 한국어
조사 대체 표기를 없앴고 `labels.test.ts`가 지킵니다.
- 엔진이 줄인 글의 `[cut N bytes]` 표시를 결정, 시도 로그, 목표 어디에 있든 "… (줄임)"으로 보여 줍니다.
- 의존 그래프(Issues Dependencies와 Factory 그래프가 함께 쓰는 D-08 배치)의 배치와 선 경로만
elkjs layered로 바꿨습니다. 카드와 토큰은 그대로이고, 전이 축약은 Factory 그래프에만 남깁니다. elkjs는
그래프를 열 때 동적 import로 불러 Web Worker에서 돌리고, 3초나 카드 400장을 넘으면 열 배치로 남기며 진단
로그를 남깁니다.
- main(#664, node id) 병합 뒤 만들기 시트가 `"local"` 대신 이 기기의 node id로 프로젝트를
고릅니다.
- main(#692 node link, 그 뒤 #738 Herdr 0.9.3과 #733)을 병합했습니다; Factory 화면
포트는 Factory host 시작 직후 그대로 설치되고, 완료 오늘의 시간대 읽기는 2b가 노드로 옮길 기기 일로 경계 검사에
적었습니다.

라이선스: elkjs 0.12.0은 EPL-2.0 (또는 GPL-3.0-or-later)이고, hide(MIT)는 이를 수정하지
않은 번들 의존성으로 EPL-2.0에 따라 씁니다. 패키지된 앱은 `elk-worker.min.js`를 그대로 담습니다.

![내 차례 (ko, Light): 완료 오늘 9, 보내기:
ok](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-ui/9ed33d7/ko-light-turn.png?raw=true)

## Review

- **판단해 주세요**: 그래프 배치가 elkjs layered로 바뀌어 긴 선이 카드 사이로 돌아갑니다; Issues
Dependencies 화면에도 같은 배치가 적용됩니다 (아래 그래프 이미지).
- **판단해 주세요**: 내 차례 맨 위 항목이 펼쳐진 채 답 후보가 바로 보이는 밀도가 적당한지 (위 이미지).
- **판단해 주세요**: 엔진이 쓴 영어 문장(GitHub 읽기/쓰기, `gh` 로그아웃 다음 행동)과 공지 접두사는 모든
언어에서 그대로 보입니다.
- **판단해 주세요**: 새 번들 의존성 elkjs (EPL-2.0); 저장소에 제3자 고지 파일이 없어 고지 문구를 넣을
자리가 없습니다.
- **조심해서 볼 파일**: `herdr-core/src/factory/screen.rs` - 엔진 스레드의 비교와 발행,
high-frequency path.
- **조심해서 볼 파일**: `herdr-core/src/factory.rs` - 명령과 틱마다 `touched()`, 엔진
루프 안의 추가 일, `SystemClock`의 현지 시차.
- **조심해서 볼 파일**: `herdr-core/src/runtime/factory.rs` - runtime mutex 안에서
보내는 이벤트와 거절 경로.
- **조심해서 볼 파일**: `snapshot_delta.rs`,
`contracts/snapshot-wire-enums.json` - snapshot wire에 새 섹션 둘.
- **조심해서 볼 파일**: `persistence.rs` - core
`ui_state.factory_secretary_pane`, 목록에 나온 pane만 기억.
- **조심해서 볼 파일**: `hide-platform/src/time.rs` - Unix
`localtime_r`/`tm_gmtoff`, Windows `GetTimeZoneInformation`; 읽지 못하면 한 번
로그하고 UTC로 셉니다.
- **조심해서 볼 파일**: `hide-factory/src/summary.rs`, `adapters.rs` - 엔진 요약의
날짜 경계 (Clock 포트에 메서드 하나).
- **조심해서 볼 파일**: `web/src/dependencyLayout.ts`, `web/src/TaskBoards.tsx`
- 공유 그래프 배치, worker 수명, 시간 제한, 구조별 배치 기억.
- **비용 검토**: 유휴 시 2분마다 바깥 읽기 시각이 바뀌어 22 KB `factory` 프레임 하나; hided CPU
60초당 0.23-0.25초.
- **비용 검토**: 열린 Task 페이지는 명령과 틱마다 다시 읽지만 같으면 버립니다; 우선순위 변경 20번에 프레임 20개.
- **비용 검토**: 그래프 배치는 같은 노드와 선이면 다시 묻지 않고, 거절된 구조는 한 번만 묻고 한 번만 로그합니다.
- **질문**: 아래 "PRD가 말하지 않은 곳의 가정" 중 바꿔야 할 것이 있는지.

<details><summary>PRD가 말하지 않은 곳의 가정</summary>

- One generic `factory_action` event carries the stage-1 `Command`
(strict decode, whitelisted verbs, one event per action), read as the
PRD's "typed UI 이벤트 하나씩".
- The 내 차례 tab count and the sidebar badge always show the global
`my_turn`, also while the project filter is set.
- With several Factories the board shows Factory after Factory in the
engine's order; the screen re-sorts nothing.
- The flow bar sums the shown Factories' flows; its read time is the
oldest GitHub read among them, stale when any is stale.
- Done today counts by this machine's local day, the day the operator
reads it on; a machine whose offset cannot be read counts in UTC and
logs once.
- The Factory screen is kept out of Recent Panels.
- 카드 고치기 (edit) opens the secretary, because the PRD has no edit form
and the engine's edit is a card re-add.
- The secretary row shows only while an open Factory exists; its pane is
remembered in core `ui_state.factory_secretary_pane`; it starts with the
Factory config's `default_runtime`; its first prompt is English.
- The create sheet asks the engine for a new preview on each project or
verification change and preselects the first detected candidate; it
lists this machine's projects only, because the engine reads local
folders.
- Settings can add a check (the `check` verb is in the screen whitelist)
but not remove one: the engine has no removal verb.
- The Overview's yellow count keeps its aria name '내 차례', which now
overlaps the Factory's 내 차례 (PRD Risks).
- ⇧⌘F was free and is now Open Factory; the shortcut test and the docs
table gained that row.
- The init preview's GitHub reads and writes are English sentences with
no codes; the sheet shows them as given in every language.
- Refusal reasons have no engine enum; the screen labels all 50, held
complete by `labels.test.ts` reading every `refuse`/`Refusal::new`
reason in `hide-factory/src` and `herdr-core/src`; an unlisted reason
shows its code.
- A stop's free-text detail (`stop_detail` in the engine's item text) is
not shown in 내 차례; only the coded reason is.
- The graph's placement and edge routes come from elkjs's layered
algorithm for both Issues Dependencies and the Factory graph (D-08 still
shares one layout); only the Factory graph drops transitive edges. Over
400 cards or 3 seconds the columns layout stays and a diagnostic is
logged.
- An engine notice's text is shown as the engine wrote it, so the
stage-1 prefix `무관한 발견:` stays Korean in every interface language.
- The Task page's chain lists the stored dependencies, including those
the graph leaves out as redundant (L-1 lists L-5, which also waits on
L-2 and L-4).
- B9 puts the time left on the line under the open item; the approved
picture puts the time cue at the item's right, where every item has it,
and the screen follows the picture.
- A failed project check is `init_failed` with a stage; the engine tells
a logged-out `gh` apart only in its English next action, so the sheet
shows that sentence as written in every language. A code for that signal
in stage 1 would let the screen label it.
- With no required checks a GitHub repository still lists CI first; the
sheet's own first pick moves to the detected commands when the engine
refuses CI with `ci_checks_required`.
- Text the engine shortened shows a muted "… (줄임)" where each `[cut N
bytes]` mark was, in decisions, attempt logs and the goal.
</details>

## Evidence

- **확인한 것**: 푸시한 머리 a9370ae(main #738 병합)에서 sasu verify PASS (S1, S2),
CI 통과, build, 집중 테스트 865개, 코어 경계 검사, verify-web, Factory와 Overview e2e
9/9 (Herdr 0.9.3), 그 전 머리 563c1a59에서도 sasu verify PASS (S1
`verify-cargo.sh test`, S2 lint), `verify-cargo.sh build --workspace`,
코어 경계 검사, herdr-core/hide-factory/hide-platform 집중 테스트 865개, verify-web,
design contract, Factory와 Overview e2e 9/9.
- **확인한 것**: 9ed33d70에서 web e2e 19/19: `factory.spec.ts` (그래프가
`layered`로 열림, 만들기 시트에서 `fixture` 프로젝트 선택), `overview.spec.ts`,
`s2.spec.ts`.
- **확인한 것**: 새 테스트: 서울 오전 9시 전에 끝난 Task가 그날의 완료로 세어짐 (Rust); 긴 L-1>L-5
선의 경로가 어떤 카드 상자와도 겹치지 않음, 카드 수 상한, 시간 제한 뒤 worker 종료, 같은 구조 재구성 때 배치 유지,
거절된 구조 한 번만 묻기 (vitest); 조사 대체 표기 없음, 줄임 표시, 충족 기준, 검증 실패 이름, 열 배치 대체
(jsdom).
- **확인한 것**: 격리된 후보 앱 네이티브 QA (9ed33d7, #692 병합 전, 1단계 Factory 사본,
ko/en x Light/Dark): 완료 오늘 9, 보내기: ok, 그래프 layered 선 10개, T-3 줄임 표시, 만들기
시트 프로젝트 calc와 fixture; #664 이전에 쓴 상태 폴더도 그대로 열림.
- **확인한 것**: B25 그래프 열기: 탭 클릭부터 layered 배치까지 23-302 ms (302 ms는 worker를
처음 불러오는 첫 열기), 네 번 모두 main thread long task 0개; 1.6 MB worker 파일은 한 번만
불러옴.
- **확인한 것**: 이전 B25, 50-Task Factory: 입력 echo p50 2.1 대 2.2 ms, p95 9.8
대 11.5 ms, 탭 전환 잡음 범위.
- **확인하지 못한 것**: B25는 debug 빌드, 통제되지 않은 부하; release, 스크롤, 실행 중 Task,
400장 넘는 그래프나 worker 시간 초과의 네이티브 확인 (단위 테스트만).
- **확인하지 못한 것**: GitHub를 쓰는 만들기 시트 전체 흐름 (실제 저장소에 Factory를 돌리지 않음), CI
대체 선택의 테스트, 비서 시작 hook의 단위 테스트, Pen 프레임 렌더.
- **확인하지 못한 것**: 부하 30-60에서 S1이 이 PR 밖 테스트로 실패했다가 단독 또는 재실행에서 PASS:
`github` gh 시간 초과, `codex_trust` 자식 pid (두 번), `ssh_hosts` 주소 None,
`worktrees` stale; 563c1a59의 첫 실행은 디스크가 가득 찬 순간 fixture의 git commit이
실패하고 (e2e 3개) 테스트 바이너리 하나가 실행 중 사라져 (S1) 실패, 다시 돌려 PASS.
- **생성물**: `design/hide-screens.pen`의 Factory 화면은
`scripts/pen-screens-factory.mjs`가 씁니다.

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

![그래프 (ko, Light): elkjs layered 배치, 긴 선이 카드 사이로
지나감](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-ui/9ed33d7/ko-light-graph.png?raw=true)

![Graph (en, Dark): layered
layout](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-ui/9ed33d7/en-dark-graph.png?raw=true)

![Task T-3 (ko, Light): 줄임 표시, 검증 실패 0/3, 완료 기준
체크](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-ui/9ed33d7/ko-light-task-T-3.png?raw=true)

![Create sheet (en, Dark): this machine's projects by node
id](https://github.com/yansfil/pr-assets/blob/main/hide/software-factory-ui/9ed33d7/en-dark-create-projects.png?raw=true)

후속 개선:

- 바깥 읽기 시각을 작은 별도 필드나 섹션으로 내보내, 시각 하나 때문에 요약 전체를 다시 보내지 않기; 엔진이 깨어날 때마다
요약을 다시 만드는 일도 함께.
- 행동 답이 그 행동이 바꾼 요약보다 먼저 옴 (화면마다 보정 중); 요약을 먼저 내보내기, 답은 별도 섹션으로.
- 큐가 가득 차 버려진 `factory_task_open`은 다시 묻지 않아 Task 페이지가 로딩에 머묾.
- 열린 Task 페이지는 프로세스에 하나이고 클라이언트가 떠나도 남음; 클라이언트별 소유로.
- 공유 그래프 worker: 한 그래프의 시간 초과가 대기 중인 다른 배치까지 끝냄 (각자 기한에 열 배치로 남음); 배치마다
시작 시각부터 재는 순차 큐로.
- `summary::build`에 0이 아닌 시차를 넣는 Rust 테스트 (지금은 `local_day`만 고정).
- 제목과 문장 속에 끼워 넣은 질문 글의 `[cut N bytes]`도 줄임 표시로.
- elkjs EPL-2.0 고지를 담을 제3자 고지 파일 체계.
- 그래프 확대/이동과 미니맵.
- CI 대체 선택 때 경고가 잠깐 보임; 무응답 뒤 다시 시도 버튼이 켜져 있음.
- 비서 시작 hook에 테스트 추가; 비서 pane id는 목록에 있는지만 확인하므로 Herdr가 재시작 뒤 id를 다시 쓴다면
신원 확인 추가.
- 1단계가 `gh` 로그아웃을 코드로 알리면 화면이 그 다음 행동을 번역할 수 있음.
- 설정 거절이 모든 칸의 입력을 되돌림; 거절된 칸만 되돌리기.
- 대기 중 add가 루프 끝 발행을 건너뜀 (이 PR 전부터).

</details>

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

- PRD: `agents/prd/software-factory-ui/prd.md` (sha256
4102547e0dfc5f17ab8554209dd17eab92e83036646f14b414ed2369f19dd73b)
- Base e515726 → head a9370ae, verified 2026-10-07T11:00:50.045Z: PASS
- a9370ae is the merge of main fffb3c0 (#738 Herdr 0.9.3, #733) on
563c1a5; sasu implement verify passed on both heads (the first run on
a9370ae was stopped by the disk floor and rerun).
- Verification report:
`agents/runs/software-factory-ui/verification-report.json` and
`agents/runs/software-factory-ui/verification-report.md`; source
fingerprint
bdf303ba6f2a0342e79a3de079ccceb9fff0e4f17a70ea7f4ec6dbe67e91359b
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews:
- Fidelity (b6084f0): B5 init_failed 다음 행동, B22 Close 조건, B13 범위, B25
증거 범위 지적; 앞의 셋은 35f02bef에서 고침, B25는 아래 확인하지 못한 것에 남김
- Code (b6084f0): Medium 5건(secretary 기억 재시도, config 무응답 deadline,
factory_busy 라벨, 늦은 답 유실, Task 페이지 재읽기) 모두 f3fc7d0, 35f02be,
0847812a에서 고침
  - 병합 뒤 후속 리뷰 (0847812, 5d5eb89): Fix now 없음; Follow-up은 아래 목록
- 두 번째 main 병합 뒤 후속 리뷰 (4bdaa80): Fix now 없음; Factory task 상태 `landed`와
`CheckoutSnapshot.landed`가 이름만 겹침 (Follow-up)
- PR 코드 리뷰 1회차 (4bdaa80): 10건; 5건을 0c9a4a1c에서 고침 (자세히 위 Enter, 한글 조합 중
Enter, 거절된 설정값 복원과 중복 전송, 설정 위 ⇧⌘F, 보관만 남은 보드); 나머지 5건은 Follow-up 또는 변경
없음
- 고친 커밋 후속 리뷰 (0c9a4a1): Fix now 없음; 다시 입력한 값 재전송과 문서 문구를 7d87084f에서 반영
- PR 코드 리뷰 2회차 (7d87084): 8건; 6건을 ceae33e1에서 고침 (check/close 답에 config가
없어 설정 화면이 깨짐, 만들기 시트가 이전 프로젝트 답을 다시 읽음, 비운 숫자가 0으로 감, 폼 입력 유실, 받아들여진 답
재전송, 사라진 Factory의 Task 로딩); 2건 Follow-up
- PR 코드 리뷰 3회차 (ceae33e): 10건; 7건을 edd3e432에서 고침, init probe는 변경 없음, 2건
Follow-up
- 977/986 수정 후속 리뷰 (11b2af7): Fix now 2건 (스냅샷마다 그래프 배치가 열 배치로 돌아감, 거절된
배치를 스냅샷마다 다시 물음) 모두 a1965fc, 6c8f90fb에서 테스트와 함께 고침; Follow-up 4건은 위 목록
- main(#664) 병합 뒤 후속 리뷰 (9ed33d7): 병합에서 찾은 만들기 시트의 `"local"` 필터를
9ed33d70에서 고침; 그 밖의 결함 없음
- main(#692, node link) 병합 뒤 후속 리뷰 (7e018cc, 563c1a5, 마지막): 결함 없음;
Factory 시계의 시간대 읽기를 2b가 옮길 기기 일로 경계 검사와 ARCHITECTURE에 적음 (563c1a5)
- Evidence: 41 registered (11 file, 22 screenshot, 8 log); paths are
local to the run directory
  - agents/runs/software-factory-ui/qa/native/RECORD.md
  - agents/runs/software-factory-ui/qa/native/ko-light-graph.png
  - agents/runs/software-factory-ui/qa/native/ko-light-graph-right.png
  - agents/runs/software-factory-ui/qa/native/ko-dark-board.png
  - agents/runs/software-factory-ui/qa/native/en-light-turn.png
  - agents/runs/software-factory-ui/qa/native/en-dark-settings.png
  - agents/runs/software-factory-ui/qa/native/ko-dark-settings.png
  - agents/runs/software-factory-ui/qa/native/ko-light-task-T-9.png
  - agents/runs/software-factory-ui/qa/native/en-dark-task-T-1.png
  - agents/runs/software-factory-ui/qa/native/status.json
  - agents/runs/software-factory-ui/qa/native/facts.json
-
agents/runs/software-factory-ui/qa/design-review/states/light-1440-long-x1.png
-
agents/runs/software-factory-ui/qa/design-review/states/dark-1440-long-x1.png
  - agents/runs/software-factory-ui/qa/design-review/report.md
  - agents/runs/software-factory-ui/qa/native/CORRECTION.md
  - agents/runs/software-factory-ui/qa/b25/RECORD.md
  - agents/runs/software-factory-ui/qa/b25/b25-matched.json
  - agents/runs/software-factory-ui/qa/b25/run1.json
  - agents/runs/software-factory-ui/qa/b25/b25-idle.json
  - agents/runs/software-factory-ui/qa/b25/idle-frames.json
  - agents/runs/software-factory-ui/qa/b25/zz-b25-matched.spec.ts.txt
  - agents/runs/software-factory-ui/qa/b25/zz-b25-idle.spec.ts.txt
  - agents/runs/software-factory-ui/qa/native2/RECORD.md
  - agents/runs/software-factory-ui/qa/native2/CORRECTION.md
  - agents/runs/software-factory-ui/qa/native2/facts.json
  - agents/runs/software-factory-ui/qa/native2/ko-light-graph.png
  - agents/runs/software-factory-ui/qa/native2/en-dark-graph.png
  - agents/runs/software-factory-ui/qa/native2/ko-light-graph-right.png
  - agents/runs/software-factory-ui/qa/native2/ko-light-task-T-3.png
  - agents/runs/software-factory-ui/qa/native2/ko-light-task-T-1.png
  - agents/runs/software-factory-ui/qa/native2/ko-light-turn.png
  - agents/runs/software-factory-ui/qa/native2/en-light-graph.png
  - agents/runs/software-factory-ui/qa/native2/ko-dark-graph.png
  - agents/runs/software-factory-ui/qa/review/merge-664-review.md
  - agents/runs/software-factory-ui/qa/native3/RECORD.md
  - agents/runs/software-factory-ui/qa/native3/facts.json
  - agents/runs/software-factory-ui/qa/native3/ko-light-graph.png
  - agents/runs/software-factory-ui/qa/native3/en-dark-graph.png
  - agents/runs/software-factory-ui/qa/native3/ko-light-turn.png
- agents/runs/software-factory-ui/qa/native3/en-dark-create-projects.png
  - agents/runs/software-factory-ui/qa/review/merge-692-review.md
- Changed paths: 634 (see Files changed)

</details>
yansfil added a commit that referenced this pull request Oct 8, 2026
…re-host-node 2b) (#751)

Related: #692 (core-host-node 2a)

## Summary

core-host-node 2b입니다. 기기(SSH device)가 별도 `hide-host-helper` 대신 같은 프로그램
`hided node serve`를 node로 돌립니다.
- 기기 pane의 `hide`는 workspace bridge 없이 node link 하나로 core에 닿습니다. node가
커널로 caller를 증명하고 core가 그 link에 묶인 credential을 줍니다.
- SSH transport는 `hide-node/src/ssh`로 옮겼습니다. 기기당 SSH 연결은 하나이고 session
channel은 8개까지, 끊긴 link는 2초에서 60초까지 두 배씩 기다려 다시 붙습니다.
- Software Factory의 machine 작업(git, gh, 검증 실행)은 core 자신의 node에서 돕니다.
node contract suite가 core 자신의 node와 기기 link가 같은 답을 주는지 확인합니다.
- #692 리뷰 후속(세션 파일 범위 제한, PathFacts 답 크기 상한, gh/git 인자 정확 일치, 기기
allowlist)과 이번 리뷰의 수정이 함께 들어 있습니다.

## Review

- **판단해 주세요**: the allowlist decides which machine answers, not what a
trusted core may ask for. core는 이미 그 계정으로 아무 명령이나 돌리는 SSH 로그인을 갖고 있어서,
손상된 core에 대한 방어는 이 경계가 아닙니다. 속은 core(기기가 알려 준 repository 정보로 경로를 고른 경우)에
대비한 기기 쪽 재검사(`SetAsideFolder`, `DrainTrash`, `TerminateGroup`)는 후속 이슈로
둡니다.
- **조심해서 볼 파일**:
- `hide-node/src/lib.rs` - core 자신의 node 호출이 호출마다 스레드 하나(최대 64)에서 돕니다.
늦은 호출은 끝날 때까지 자리를 쥐고, `node.busy`/`node.call_unanswered`로 남습니다.
- `hide-node/src/ssh/host.rs` - 연결 하나 공유(`Arc<Connection>`), 마지막 holder가
갈 때 끊김. 동의 철회 drain은 Git watch만 cancel로 멈추고 clone 같은 효과 있는 호출은 결과까지 둡니다.
연결 단계마다 `host.establish_stage`를 남깁니다.
- `hide-host/src/serve.rs` - 기기 helper reader는 이제 기다리지 않습니다(32칸 queue,
넘치면 busy, 아직 도는 id는 거절). cancel과 입력 끝을 항상 읽습니다.
- `hide-node-link/src/protocol.rs` - main의 `process_descendants`가 23을 써서
이 층은 protocol 24입니다. 기기는 `ProcessDescendants`에 답합니다.
- `Cargo.toml` - dev build에서도 SSH crate(`russh`, `russh-sftp`, cipher와
hash)를 `opt-level = 3`으로 짓습니다. 이전에는 개발 daemon이 자기 debug `hided`(99 MiB)를
기기에 약 4 MiB/s로 올려 remote mailbox lane이 30초 안에 준비되지 않았습니다. release 설치는 이
crate를 원래 최적화하므로 영향이 없었습니다. CI dependency cache는 한 번 다시 짓습니다.
- `hide-node-link/src/git.rs` - `git config`는 `--` 뒤에 값을, `git
checkout`은 branch 뒤에 `--`를 둡니다. branch 이름은 `* ? [ ~ ^ @{`를 거절합니다.
- `hided/src/node_panes.rs`, `hide-host/src/panes.rs` - 기기 pane 증명 경로와
거절 기록(`pane.refused`, 기기가 고른 값은 길이 제한). 거절과 stream close 답은 link reader
밖에서 보내고, 모든 기기를 합쳐 32개(`MAX_CONTROL_REPLIES`)를 넘으면 그 link를
닫습니다(0fc7a8e). 답이 오지 않아도 link를 닫습니다.
- `hide-node/src/ssh.rs`, `hide-node/src/ssh/{host,attachments}.rs` -
기기의 Herdr socket, SFTP home, helper root는 기기 경로라서 core가 어느 OS에서 돌든 `/`로
쓴 경로(`hide_platform::path`)로 판단합니다. `IdentityAgent`는 core 자신의 경로라 그
machine의 규칙을 씁니다.
- `hide-node/src/ssh/host.rs` `private_walk` - helper root까지 private 폴더를
만드는 길은 빈 이름(`//`, 끝의 `/`)을 먼저 빼고, home 밖일 때만 `/`부터 걷습니다.
- `herdr-core/src/terminal_attachments.rs` - 기기에 올린 첨부의 붙여넣기 경로도 기기 경로로
판단합니다(Windows core에서 업로드 뒤 거절되던 것).
- `herdr-core/src/factory.rs`, `hide-host/src/factory.rs` - main의
Factory done-today가 core에서 읽던 time zone offset을 core 자신의 node가
답합니다(`FactoryCall::UtcOffset`). 이 층의 다른 Factory machine 작업과 같은 길입니다.
node가 바쁘면 마지막 답을 그대로 써서 done-today 날짜가 흔들리지 않습니다.
- `web/e2e/s8.spec.ts` - 세션 파일을 agent 세션 폴더 안에서 먼저 확인하므로, 목록을 읽은 뒤 지워진
파일은 OS 문구 대신 화면이 이미 가진 "The session file is missing."으로 보입니다.
- **비용 검토**: own-node 호출당 추가 비용은 스레드 시작과 채널 하나로 p50 약 15us, p99 29us(부하
23-29), 14개 CPU spinner를 더하면 p99 약 100us입니다. 기록용 요청 이름(`op_name`)은 p50
0.2-0.4us를 더합니다. 가장 잦은 호출자는 200ms마다 도는 Explorer watch입니다.
- **질문**: device connect가 60초 안에 `host.ready`에 닿지 않은 일이 remote-workspace
6회 중 1회 있었고 원인은 아직 모릅니다. 이번에 단계별 기록(`host.establish_stage`)을 넣었습니다.
flaky 이슈로 격리할까요?

## Evidence

- **확인한 것**:
- 최종 head 2d55342(main 8ea9503 merge 포함, 충돌 없음): Rust 전체 3279 통과, 0
실패, 17 ignored. `verify-cargo.sh lint`(clippy, fmt, 검사 스크립트) 통과. 그 앞
head c3598748의 CI 21개는 모두 통과했습니다.
- 7006ee0(main merge bc71a44 포함): 손댄 crate(hide-factory, hide-node,
hide-node-link, hide-host, herdr-core, hide-platform) 2224 통과, clippy,
fmt-check, `check-core-touches-no-machine.py` 통과. `sasu implement
verify`는 아래 Verification record에 적습니다.
- Rust 전체(main merge 5283e57): 3196 통과, 0 실패, 17 ignored. clippy와
fmt-check도 통과했습니다.
- remote mailbox lane(로컬, debug, Herdr 0.9.3): 5283e57b에서 CI와 같게 실패한 것을
재현했고, 9b526a97에서 28.9초에 통과했습니다(설치 6.4초, 준비 7.7초).
- node contract 7개는 loopback SSH 위의 실제 `hided node serve`에서 돌았습니다. 대상:
pane 증명 accept와 refuse, 노드 caller 상한 거절, drain 중 watch 멈춤, 연결 하나 공유.
- 수정 전 코드로 돌린 red: drain 테스트는 200초 넘게 멈췄고, verify poll 테스트는 Busy를
Failed로 읽었습니다.
- web e2e 전체(d7ebb32 build): 208 통과, 1 실패. 실패한 s8은 위 세션 파일 문구 변경 때문이었고,
기대값을 고친 뒤 s8 2개가 통과했습니다.
- 기기 desktop spec 재실행(d7ebb32 build, pin과 sha256 `5173a3e0…`이 같은 Herdr
0.9.3): device-kit 3개와 remote-browser-agent가 통과했습니다. device-home과
remote-workspace는 아래 base와 같은 자리에서 실패합니다.
  - desktop e2e 전체(654c22a): 61 통과, 3 실패, 1 skip.
- device-home(`[data-agent-counts]`)과 remote-workspace TLS route(474행)는
base 3f3444de에서도 똑같이 실패합니다.
- terminal-links dense hover(cols 184 > 215)는 화면 work area에 맞춘 창 크기
검사입니다. 2b는 web과 desktop 소스를 바꾸지 않습니다.
- device-kit 3/3과 remote-browser-agent는 통과했습니다. remote-workspace는 link를
잃은 뒤 다시 붙어 `host.panes_started`가 두 번 나오는 데까지 통과합니다.
- Mac mini 실측(343ec36b release payload, Tailscale 너머 실제 link): 격리된 sshd,
HOME, Herdr와 절대 경로 helper root만 썼습니다.
- 첫 설치는 등록부터 `host.ready`까지 83초, 3개 파일, 77 MiB(unstripped release)였습니다.
- 기기 pane의 `hide workspace info`는 `ok:true, device_id: mini-iso`로 답했습니다.
    - 기기를 지우면 kit도 지워졌습니다(`device.kit_removed`).
- 실제 `~/.hide`, `~/.local/bin`, `~/Library/LaunchAgents`,
`~/.config/herdr`의 sha256, mtime과 pid는 전후가 같았습니다.
- **확인하지 못한 것**:
- 실제 기기 run(mini 343ec36b, remote mailbox lane 9b526a9, 기기 desktop spec
d7ebb32)은 그 뒤 설치와 붙여넣기 경로를 바꾼 b839f88, 16535d1, c14e83d, 7006ee0a보다
앞섭니다. 바뀐 경로는 단위 테스트로만 봤고, 최종 head로 기기 설치를 다시 돌리지 않았습니다.
- `sasu implement verify`와 리뷰는 c3598748까지입니다. 그 뒤의 main merge 세 번과 node
reader 상한 수정(0fc7a8e, 2680249, 76180bf, 7758252)과 fixture TLS 수정은
Rust 전체, lint, CI로만 확인했습니다.
  - web e2e와 기기 desktop spec은 최종 head에서 CI로만 돌렸습니다.
- b839f88c의 windows check는 위 기기 경로 판단 때문에 hide-node ssh 테스트 5개가 실패했고,
16535d1d에서 고쳤습니다.
- node contract의
`a_device_pane_s_proof_crosses_the_link_and_its_refusals_are_reported`가
로컬 38회 중 1회 실패했고 출력이 남지 않아 원인을 모릅니다.
- core 쪽 proof 32칸, stream 8칸 상한을 넘는 테스트는 없습니다. 거절 기록 내용은
`refusal_record` 단위 테스트로만 봅니다.
  - mini에서 증명하지 못한 것:
    - 양쪽 연결 수(lsof): 연결 하나는 loopback 테스트로만 증명했습니다.
    - link 손실 뒤 revoke와 재연결.
- 실제로 배달된 `hide request send`: pane에 agent가 없어 `agent_pane_required`로
답했습니다.
    - 옮긴 reader의 idle/driven 측정.
    - 옛 helper 대비 크기와 시간.
- Windows의 root identity 테스트와 hide-node ssh 테스트는 CI에서만 돕니다. 이 Mac에서는
Windows target이 C 의존성(ring, sqlite)에서 멈춥니다.
- 기기 하나가 공용 credential 64칸과 proof 32칸을 다 쓸 수 있습니다(base부터 공용). link별
quota는 후속입니다.

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

- 테스트 fixture 수정: device-home의 fake `codex daemon stop` 답을 Codex CLI
0.160 답으로 맞췄습니다(main cc9c309 계약). remote-workspace의 bridge 수는 연결을 받는
socket만 셉니다.
- 간헐 flake: 부하가 클 때 hide-host git fixture 테스트, node_session_activity,
그리고 위의 device connect 멈춤.
- 리뷰 1차(654c22a): Fidelity 6건, Code 5건, Security 5건의 Fix now를 받았습니다.
8c9e316, 8f7d8a6, f6e5eda, ef90a8e6에서 고쳤거나, 위 판단과 후속으로 남겼습니다.

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