Skip to content

perf: answer a new tab or split on the own engine before its holder starts - #2021

Merged
yansfil merged 15 commits into
mainfrom
fix/engine-own-perf-parity
Nov 3, 2026
Merged

yansfil merged 15 commits into
mainfrom
fix/engine-own-perf-parity

Conversation

@yansfil

@yansfil yansfil commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

새 엔진에서 탭과 분할을 만들 때 홀더 시작을 기다리느라 화면이 늦게 나타나고, 66개 셸 복원이 느렸습니다.
요청한 자리를 먼저 그리고 홀더가 준비되면 연결하며, 기록 저장과 잠금 대기의 비용을 줄였습니다.
시작에 실패한 pane은 이유와 닫기 버튼을 가진 기존 카드로 남습니다.

스크린샷 없음: 화면 코드는 바뀌지 않고 기존 실패 카드를 사용합니다. 성능은 앞선 동일 release 빌드의 격리된 브라우저에서 비교했습니다.

Review

  • 저장 경계: 홀더 기록과 incarnation만 UntilReboot를 쓰고 일반 저장은 sync_all을 유지합니다. 아래 저장 파일을 확인해 주세요.
  • 복구 경계: 부팅 전 손상은 정리하고 이번 부팅의 손상과 모르는 형식은 보존·거절합니다.
  • 시작 소유권: 조기 attach, 즉시 읽기의 시작 결과 대기, 닫힌 pane의 뒤늦은 홀더 정리를 확인해 주세요. 아래 엔진·노드 파일이 경계입니다.
  • 비용과 상한: 키 입력당 추가 작업은 없습니다. 실행 8개·대기 8개, attach 64를 유지하며 복원은 8개 작업자가 전체 pane을 순서대로 시작합니다.
  • 저장 비용: 저장 5회를 3회로 줄이고 용량 상한 미만의 전체 파싱을 없앴습니다. 공용 잠금은 1ms부터 20ms까지 기다리며 timeout·취소 계약은 유지합니다.
  • 판단 사항: 새 pane도 기존 “복구하지 못했어요” 문구를 씁니다. 복원 셸 응답의 +87.7ms 미달은 운영자 위임으로 예외 수용했고 c2는 skipped입니다.
  • 복구 delta: main에 병합된 #2020의 테스트 날짜 수정만 가져왔습니다. 고정 날짜로 인한 #438을 바로잡으며 성능 코드와 행동 기대값은 그대로입니다.

Evidence

  • 최종 검사: lint PASS, 전체 7,323 PASS·169 ignored. 홀더 최초 실패 1건은 같은 SHA 1회 재실행으로 PASS했고 원인은 미해결입니다.
  • 독립 검토와 CI: 최종 delta 재리뷰와 새 policy CI PASS입니다. 전체 실행은 ci-plan이 이전 run을 재사용했고 아래에 구분했습니다.
  • 탭·분할: 기존 5쌍의 화면·프레임 p50/p95가 기준 안입니다. 원본 재계산도 일치하며 최종 SHA의 새 측정으로 주장하지 않습니다.
  • 복원: 셸 응답 +87.7ms 미달, 탭 -93.2ms·앞 탭 -113.2ms입니다. 미달을 통과로 바꾸지 않았습니다.
  • 미실행: 이번 복구에서는 성능 재측정·release 빌드·네이티브 앱 검증을 하지 않았습니다. 최종 SHA의 Linux·Windows 전체 실행은 없으며 이전 CI 재사용으로 판단됐습니다.
검토 파일, 후속과 기존 기능 증거
  • 저장 파일: hide-platform/src/fs/atomic.rs, hide-holder-protocol/src/record.rs, hide-kit/src/panes.rs. 기록의 내구성과 용량 경계입니다.

  • 엔진·노드 파일: herdr-core/src/engine/own/{mod,starts}.rs, hide-node/src/terminal/{engine_panes,holder}.rs. 시작·실패·정리 소유권입니다.

  • 복구 delta: herdr-core/src/runtime/memory_analysis.rs의 테스트 모듈만 변경했습니다.

  • 노드 attach는 시작 실패를 별도 상태로 기억하지 않아 준비 기한 뒤 일반 오류를 낼 수 있습니다. 화면에는 엔진의 실패 이유가 남고 자동 재시도는 제한됩니다.

  • 홀더와 kit의 millis 중복, 폴더 정리의 버전 이름 재계산은 별도 정리 대상으로 남깁니다.

  • 읽기와 시작 허가의 대기 한도가 겹치면 holder_start_timeout이 먼저 날 수 있으며, 에이전트 resume 복원 경로의 엔진 참조 경합도 남습니다. 기존 독립 재리뷰에서는 사소한 후속으로 분류했습니다.

  • 기존 최종 성능 코드의 128 pane 복원·저장 재개방 시험, 홀더 통합 67/67, 실제 node→holder 즉시 읽기와 엔진 계약 각 1/1이 통과했습니다. 두 실행의 홀더 17개도 모두 종료됐습니다.

  • 즉시 읽기 대기 제거와 대기 상한 9 변이는 예상 검사에서 실패했습니다. 조기 attach 소유권과 용량 경계 변이도 각각 예상 검사에서 실패했습니다.

행 화면 p50 / p95 여유 프레임 p50 / p95 여유 판정
22 탭 만들기 -0.26 / -8.10ms -3.97 / -14.31ms 통과
23 분할 -2.43 / -3.13ms -21.18 / -3.11ms 통과

두 측정은 동일 빌드의 H/P 순서를 교대했습니다.
운영자 결정에 따라 시작 load<12, 최고 load<=15, 빌드 0을 적용했고 제외 실행도 보존했습니다.
여유는 쌍별 P - (1.1H + 0.5ms)의 중앙값, 복원은 P - 1.1H이며 0 이하면 기준 안입니다.

Verification record
  • Recovery final head: 4250e5ce37ec92cbe2bead59340e04a833163143.

  • Recovery delta: cherry-pick -x 4c051dd12815776664392479b5c425ea1947e32b from merged fix: keep memory ranking tests independent of the date #2020. Only the test module in herdr-core/src/runtime/memory_analysis.rs changed (+51/-38); the complete file matches main at c4b89aad35ba641fd7fee393740be11fc2849ce3, and production code matches the previously reviewed head.

  • Before the fix, the exact Send local Herdr tab and pane controls through one ordered lane #438 fork-cutoff test failed on its one allowed retry at 6ce4e4d2b ([3,1] instead of [3,2]). The main fix replaces fixed dates with one relative clock capture; behavior assertions remain unchanged.

  • Final-head scripts/verify-cargo.sh lint: exit0. scripts/verify-cargo.sh test: exit101 at holder integration after 15 targets; herdr-core 3,928 passed /0 failed /21 ignored, including Send local Herdr tab and pane controls through one ordered lane #438 and the OMP fork test.

  • First failure: hide-holder::it::lifecycle::a_holder_runs_its_shell_and_carries_input_and_output_across_connections, support.rs:478, ProgramExited before 40 100. This matches the reported signature of with-hide/hide-private#426; its root cause remains unresolved.

  • Only that failed test was retried once on the same final head through scripts/verify-cargo.sh test-scoped -p hide-holder --test it lifecycle::a_holder_runs_its_shell_and_carries_input_and_output_across_connections -- --exact: exit0, 1 passed /66 filtered.

  • Continued all 23 targets in the 14 packages not reached by fail-fast with test-scoped --tests --no-fail-fast; then all 20 workspace documentation targets with test-scoped --workspace --doc --no-fail-fast. Both exit0. Cargo metadata, executable dependency sources and result logs account for all 38 test targets plus 20 documentation targets, with no missing or repeated passing target.

  • Combined first attempts: 7,322 passed /1 failed /169 ignored. With the one failed-test retry: 7,323 passed /0 unresolved failures /169 pre-existing ignored. Mission check recorded PASS with --rerun; no test or required gate was newly skipped.

  • Independent delta review PASS at final head: original patch byte-identical, all 67 tests and 377 assertions retained; no blocker, product change or acceptance weakening. This review covers the delta from 6ce4e4d2b, whose product review remains recorded below.

  • C1 original measurements remain pinned to 98770406f; c2 remains skipped by the operator's delegated exception (+87.7ms). No new performance run, release build or native app verification was performed.

  • Final-head policy CI: https://github.com/with-hide/hide/actions/runs/41566242903, attempt1 SUCCESS; plan, policy and verify passed. Design contract run 41566242941 also passed.

  • The CI plan at final head / main c4b89aad35ba641fd7fee393740be11fc2849ce3 automatically reuses full run 41501891830, verified head 6ce4e4d2bde84c79aca5c1a91a1b0b0e7c085b38 / base 4b61785aa02a727a2e446b90a32cd83190504324. The same fixture fix is already on main, so the effective PR change remains identical under the existing ci-plan comparison. Other lanes were skipped by that plan; this is not fresh Linux/Windows full execution at the final head.

  • Parent will evaluate current merge order and locked premerge checks. After-push merge-order says stay on this branch, do not stack on risky test: run the e2e suite on both engines and close bundle 3's gate #2017, and merge main once after test: run the e2e suite on both engines and close bundle 3's gate #2017 lands.

  • Local log SHA-256: lint 35f4b464852210e9de451fbe821bc80fbe5bee8a29f67a0285355f509e3a291c, initial test 349457b1a579c84edb8c86b0963de44fb4b536d7ba6c586370f7c8083785451d, failed-only retry f2b3b320cd05d45ed562cc50ac459b8fe3df439d94f150e8b7aeb56c5c5c9d1a, continuation dbce71e5dc8659e6772e234da41f5f79d15b7adb1f239c8ce7001af99f19319e, docs 97a7726c2a083e330ced2577eae5b69e891fbc76a10dcba5d2f9b9fdb8f0398e.

  • Base: 9305a846b.

  • Previous reviewed head: 6ce4e4d2b. Previous full-run head: 76097c943.

  • Previous 76097c943: scripts/verify-cargo.sh lint exit0. Full workspace exit101, 7,320 passed /2 failed /168 ignored; Send local Herdr tab and pane controls through one ordered lane #438 fixed-date and Make Windows web e2e specs write pane commands and paths the way the product and shell expect #439 own_devices.rs:158 no engine asked the node. Holder integration67/67. Release exit0. Make Windows web e2e specs write pane commands and paths the way the product and shell expect #439 same-head focused follow-up1/1 passed; the first full-run failure remains recorded.

  • Previous 6ce4e4d2b: strict final-SHA lint exit0, full workspace exit101: 7,322 passed /1 failed (Send local Herdr tab and pane controls through one ordered lane #438 fork cutoff) /169 ignored. Holder integration67/67. Real holder immediate-read and engine-contract tests each1/1; all17 holder PIDs gone. No new release build or performance measurement.

  • Earlier same-source full run: 7,320 passed /3 failed /169 ignored. Failures were Send local Herdr tab and pane controls through one ordered lane #438, Flaky e2e: agent-tab-groups가 외부에서 만든 포커스 탭을 막대에 못 붙임 (Linux) #426 holder ProgramExited before expected grid output, and guarded process spawn EINVAL22 at process.rs:1897. The guarded-process focused run passed1/1 and the final full run passed that test; neither explains the first failure, which remains preserved.

  • Default file barrier regression: 7 passed; removing the full-sync barrier failed the expected assertion, then source restored.

  • Early holder attach: public ownership before registration, real holder first frame and echoed input; ownership removal failed the expected assertion, then source restored.

  • Holder admission: records suite 16/16; concurrent starts preserve cap128 including unreadable records, ended records preserve room and retention128. Treating all files as live at the boundary failed with Cap130, then source restored.

  • pairs-3 at 98770406f: 5 pairs, 20 load-valid runs, 3 discarded, accepted peak13.39, all23 runs left0 processes; new_tab/split20 samples each, no timeouts or no-Herdr errors. Row28 outside this node: echo slack p50+0.2 / p95+1.6ms, preserved for the gate owner.

  • pairs-4 at 699f322c9: 5 restore pairs, 10 valid runs, 3 build-contaminated runs discarded, accepted peak11.09, all13 runs exit0 and left0 processes. Release hashes verified before/after. All5 own restores have66 holder starts and no terminal.session_failed/no-Herdr error.

Row30 Herdr 5 runs (ms) Own 5 runs (ms) Median slack
Shells 653, 718, 669, 622, 655 806, 1139, 744, 742, 873 +87.7ms, failed
Tabs 660, 725, 676, 630, 662 666, 1147, 532, 532, 635 -93.2ms
Front 898, 962, 917, 866, 912 920, 1410, 808, 813, 890 -113.2ms

A holder start now writes its record three times instead of five
(incarnations taken 64 at a time, the program and running in one write),
names its version folder without hashing the holder on every start, and
logs when each step of the start was reached.
…olders

An engine let go while a new pane's holder starts now ends and saves at
once; the holder runs on for the next restore to gather.
… own engine

A new tab or split answered before its holder starts no longer vanishes
when the holder fails: it stays where it was drawn with the holder's
reason as its restore error, so the screen shows it could not start and
offers to close it.
…flush

A pane holder's start writes its record three times under one lock, and
on macOS each write's F_FULLFSYNC cost about 5 ms against 0.2 ms for
fsync, so a restore of 66 panes queued about a second of flushes. The
full barrier stays with write_file_durable.
A new tab or split on the own engine is drawn before its holder starts,
and its view attached at once: the node took the pane for a Herdr one,
whose refusal wrote a failure line into the pane and reported an error.
The node now knows a pane as starting while its holder starts, and an
attach to it waits for that start and opens the holder.
…block a start

Pane records are flushed to the device but not past its cache, so a power
loss may leave one empty, cut off or older. A node that opens the state
folder now sets aside records that cannot be parsed and were written
before this boot, and moves the incarnation counter past every number a
record holds, so the panes start again from the saved session. Waits for
a file lock also try again after 1 ms, doubling up to 20 ms, so a start
that meets another's brief record write does not lose 20 ms to it.
@yansfil
yansfil marked this pull request as ready for review November 2, 2026 18:01
@yansfil
yansfil merged commit c0d94e1 into main Nov 3, 2026
67 checks passed
@yansfil
yansfil deleted the fix/engine-own-perf-parity branch November 3, 2026 02:48
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