Skip to content

Count an ended, unreaped process as ended in is_alive - #599

Merged
yansfil merged 1 commit into
mainfrom
fix/flaky-595
Oct 6, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/flaky-595

Conversation

@yansfil

@yansfil yansfil commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Refs #595

Summary

hide_platform::process::is_alive가 Unix에서 끝났지만 아직 거두지 않은 process(zombie)를 살아 있다고 답하던 제품 결함을 고칩니다. Windows는 같은 경우 끝났다고 답했습니다.
#595(Linux)는 run_to_end가 돌아온 직후 helper를 물었을 때, init으로 넘어간 helper가 아직 zombie여서 "outlived the call"로 실패했습니다.

  • 계약: "pid가 존재하는가"에서 "process가 아직 끝나지 않았는가"로 바꿨습니다. 세 OS가 같은 질문에 같은 답을 합니다.
  • Unix: signal 0으로 존재를 본 뒤 상태를 직접 읽습니다. Linux는 /proc/<pid>/stat의 Z/X, macOS는 KERN_PROC_PID sysctl의 p_stat == SZOMB.
  • macOS에서 proc_pidinfo(PROC_PIDTBSDINFO, PROC_PIDT_SHORTBSDINFO)는 zombie에 ESRCH만 돌려 pbi_status를 읽을 수 없어서 sysctl을 씁니다(ps가 읽는 곳).
  • 계약 test liveness_is_what_the_system_says: 죽인 자식을 거두지 않은 채(Unix waitid + WNOWAIT, Windows는 handle을 쥔 채 wait) false인지 봅니다. 그 자식이 아직 signal 0에 답하는지도 확인해 경우가 실제임을 보입니다.
  • docs/ARCHITECTURE.md 플랫폼 층 process 설명에 같은 계약을 적었고, herdr-core test 메시지 "reaped"를 "ended"로 고쳤습니다.
  • Flaky test: hide-platform::process normal_exit_ends_an_inherited_pipe_holder_before_draining #595 test는 바꾸지 않았습니다. 새 retry, timeout, sleep, allow는 없습니다.

Review

  • 판단해 주세요: 상태를 읽지 못하면(gone 경합, 권한) signal 0의 답을 그대로 둡니다. zombie라고 읽힐 때만 false로 바꿉니다.
  • 조심해서 볼 파일: hide-platform/src/process.rs macOS is_zombie - libc에 Apple kinfo_proc가 없어 extern_proc 앞부분(p_stat까지)을 repr(C)로 적고, 전체 크기 648 byte가 채워졌을 때만 읽습니다.
  • 비용 검토: 호출자(hide-kit labels 정지, hided still_the_daemon, hide-ai codex lock)는 runtime mutex 밖이고 고빈도가 아닙니다. 호출당 /proc 파일 하나 또는 sysctl 하나를 더합니다. fork는 없습니다.

Evidence

  • 확인한 것: verify-cargo.sh nextest -p hide-platform --test process에서 34개가 통과했습니다(macOS).
  • 확인한 것: clippy -p hide-platform --all-targets -D warnings가 macOS, x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc 세 target에서 통과했습니다.
  • 확인한 것 (planted defect): Unix is_alive를 이전처럼 signal 0만 보게 되돌리면 계약 test가 "an ended child counted as alive before it was reaped"로 실패합니다. 되돌리면 통과합니다.
  • 확인한 것 (부하): macOS에서 Flaky test: hide-platform::process normal_exit_ends_an_inherited_pipe_holder_before_draining #595 test와 계약 test를 yes x8(기본 QoS, 기계 load average 130~155) 아래 200번 돌려 200번 통과했습니다. 새 binary를 다시 빌드한 뒤 쟀습니다.
  • 확인한 것: macOS 로컬에서 zombie에 kill(pid, 0) == 0, proc_pidinfo는 ESRCH, sysctl p_stat는 5(SZOMB)이고 살아 있는 process는 2(SRUN)임을 확인했습니다.
  • 확인하지 못한 것: Linux 경로는 로컬에서 돌리지 못했습니다(Linux 기계와 Docker daemon 없음). 이 PR의 CI Linux와 Windows Rust lane으로 확인합니다. 원래 실패는 run 몇 번에 한 번 꼴이라, 녹색 run 하나는 재발이 없다는 증거가 되지 못합니다.

A Unix zombie answers signal 0 until its parent, or init once it is
orphaned, reaps it, so is_alive said a process run_to_end had already
ended was still running, while Windows said it had ended. Unix now also
reads the process state: Z or X in /proc/<pid>/stat on Linux, SZOMB from
the KERN_PROC_PID sysctl on macOS, where libproc has no answer for a
zombie. The contract test checks an ended child before it is reaped on
all three systems.

Refs #595
@yansfil
yansfil merged commit d128628 into main Oct 6, 2026
19 checks passed
@yansfil
yansfil deleted the fix/flaky-595 branch October 6, 2026 03:36
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 12, 2026
Closes with-hide/hide-private#526
Closes with-hide/hide-private#599
Refs with-hide/hide-private#395, with-hide/hide-private#530,
with-hide/hide-private#117, with-hide/hide-private#586
Refs with-hide/hide-private#832

## Summary

- Start the checkout PR flow on Main after its setup has focused another
workspace.
- Prevent Windows test browsers from losing local page or resource
requests during shell startup.
- Retain the failed row and pointer state for a separate, unreproduced
late card-hover failure.

## Review

- **Risky files**: browser-launch.cjs merges installed runner defaults;
the desktop preload extends effective flags.
- **Risky files**: checkout-pr.spec.ts retains discovery's connection,
then resets first-run selection before Main.
- **Risky files**: desktop browser.spec.ts uses the shared arguments for
its plain Chromium launch and checks the applied features through CDP.
- **Decide**: The narrow upstream fix uses the locked runner's internal
argument API; a changed shape fails startup.
- An entire runner upgrade would also replace the browser revision and
is outside this stabilization change.
- **Cost**: The hover observer exists only for one test phase, retains
32 transitions, and is removed on every exit.
- **Cost**: Splitting the plain-browser notice from the native-view
lifecycle adds one isolated fixture start so Windows CI checks that
launcher too; its existing notice assertions are retained.
- [Windows run
41016473655](https://github.com/with-hide/hide/actions/runs/41016473655/job/123933953907),
tracked by [private
with-hide#130](with-hide/hide-private#130), records the
same document-load error.
- [with-hide#832](with-hide/hide-private#832) tracks
one later card-hover failure; this PR does not claim its cause is fixed.

## Tests

- **Layer**: Unit feature merging; real browser startup and desktop
recovery cross the actual host launch boundary.
- The desktop plain-browser case checks the effective final
disabled-feature list, retained runner defaults and the Windows loopback
fix before opening the shell.
- It passed its first Windows CI attempt on the final head in [the
desktop
lane](https://github.com/with-hide/hide/actions/runs/42860546110/job/129985854339).
- Units cannot observe which feature list the launched browser applies;
the startup check reads that applied state.
- **Catches**: Removing the Windows feature fix failed two merge checks;
restoring it passed all three.
- **Repeat**: Linux/macOS: five flows x20, [100 passed
each](https://github.com/with-hide/hide/actions/runs/42832076296).
- Desktop recovery/relaunch: each x10 on macOS/Windows, retries 0, [40
passed](https://github.com/with-hide/hide/actions/runs/42831271844).
- Final Windows: five flows x20, retries 0, [100
passed](https://github.com/with-hide/hide/actions/runs/42844846265/job/129929485236).
- **Waits**: No new wait, delay, retry, timeout or threshold; the
existing Main assertion follows explicit state setup.

## Evidence

- **Verified**: Local startup/checkout flows, desktop recovery/relaunch,
unit 3, lint, types, builds and policy checks.
- **Verified**: The split desktop plain-browser and native-view flows
passed locally without retries; desktop lint and typecheck passed.
- **Verified**: A controlled trigger replacement preserved the original
failure and captured mounts=2 before teardown.
- **Verified**: [Required
CI](https://github.com/with-hide/hide/actions/runs/42860546110) and
independent review passed on final head c532660.
- **Not verified**: The historical reference-only causes and the late
hover cause.

<details><summary>Failure evidence and review boundaries</summary>

- with-hide#526's run 42780431716 drew Workspace while the test expected Main
after setup focused its agents.
- with-hide#599's run 42080456072 had an unmounted shell, a successful document
and a failed entry script with ERR_NO_BUFFER_SPACE.
- Private with-hide#130 is handled separately by public PR with-hide#2372; its Windows
host log recorded window.load_failed ERR_NO_BUFFER_SPACE after a normal
daemon start.
- The test-only startup fix follows [the upstream
fix](microsoft/playwright#43605) and [the
browser defect](https://issues.chromium.org/issues/572515601).
- The locked runner 1.63 lacks that fix.
The helper reads its installed defaults rather than copying a
version-specific list.
- with-hide#395's run 42140863283 attached its daemon before its shell wait
failed, with no page-side or failed-load signature for that exact wait.
Its initial report used the retired fixture startup path; neither
identifies this PR's connection cause.
- with-hide#530's original failure drew Main with a failed sidebar boundary.
A controlled stylesheet abort reproduced that screen and a missing
CSS-token diagnostic, but the original artifact retained no
asset-failure signature.
- with-hide#117's latest retained record has only a whole-test timeout.
  Its historical lost step remains unidentified.
- with-hide#586's run 42359435922 explicitly reports the loopback error, but its
initial whole-test timeout and its separate focus flow were not resolved
by the targeted repetitions.
- For those next failures, inspect pageSide screen/project state,
request status, failed requests, renderFailures and renderDiagnostics.
The dump now retains failed regions and the newest eight relevant render
diagnostics.
Each reference-only issue has a comment with its confirmed facts,
remaining gaps and next dump.
- with-hide#536 was closed separately because commit 8be1505 deleted its Home
collision test.
  The current no-project startup spec does not replace that behavior.
- The first Windows repetition had 99/100 passes:
checkout-pr.spec.ts:273 failed at the final light-theme hover after the
shell, row, PR glyph and browser display had already drawn.
- A diagnostic-only repeat at 5eefccb passed 100/100: all 20 checkout
attempts retained one trigger mount, had PR facts ready and hit that row
with the pointer.
  The card opened after its normal hover delay.
  This did not reproduce or establish the cause of the earlier failure.
- The replacement diagnostic captures the failing state inside that
step, before teardown can add a disconnected banner and move the row.
It records the checkout key, mounts, pointer hit, geometry, focus,
visibility, drag marks and tooltip state, preserves the original error,
and reports independent cleanup failures.
- The old conversation-date fixture also caused automatic sleep of the
Main setup agent in the failed run.
A current-clock proposal removes that sleep locally, but its
relationship to the hover failure is unconfirmed.
  It remains an uncommitted local patch documented in with-hide#832.
- No product input, runtime mutex, snapshot wire or rendering path
changes.
  The operator's installed application was untouched.

</details>

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

- Final head: c532660.
- Startup repeat candidate 4231d60:
Linux/macOS each five flows x20, no retry.
- Desktop repeat candidate ce0dffe:
JSON reports on each OS show expected=20, unexpected=0, skipped=0,
flaky=0, repeatEach=10 and retries=0.
- Diagnostic-only Windows candidate
5eefccb: run 42838637529, five flows
x20, no retry, 100 passed.
  The temporary early observer and trace flag were reverted.
- Final Windows repeat candidate
49b560a: run 42844846265, five flows
x20, retries=0, 100 passed; job log confirms the exact tested commit.
- All temporary workflow changes are reverted.
The repeated specs, shared startup fixtures and guide match the final
Windows repeat candidate; the later desktop browser.spec.ts regression
and its smaller size baseline are the only differences in those test
trees.
- Head 1933d66 is a source-identical verification commit after
f45c106, added to regenerate the synthetic merge against the corrected
base.
- Review follow-up c532660 applies the shared launch settings to the
desktop plain browser and separates that existing notice contract into a
Windows-covered case.
- Local current source: checkout hover flow passed without retries; a
controlled browser replacement captured the original failure and two
mounts; web lint and test-size budget passed.
- Earlier unchanged-source checks: web build; web/desktop lint; desktop
typecheck; startup/checkout 3; desktop recovery/relaunch 2; merge unit
3; design contract and policy checks passed.
- Manual repeat dispatches that skipped every test and draft-only verify
failures are excluded from verification evidence.
- Independent review and required CI 42860546110 passed on
c532660.
- Ready run 42849933157 checked synthetic merge
83a0f35 against base
8284fb6, which predates with-hide#2398.
- That merge still waited on the retired status.herdr field; current
main uses status.engine.
  All hard web failures were at that restart boundary.
  One required failed-job rerun was started.
- The regenerated merge f4ed9d1
includes the corrected status.engine wait.
- Final run 42860546110 tests merge
6b977ba containing c532660; completed
job logs confirm that checkout.
- Its Linux suite has 412 passes and eight Windows-only skips, the
retry-free changed-spec repeat has 80 passes, Windows web has 85 passes,
and Windows desktop has 24 passes and one existing platform skip.
The new plain-browser startup case passed its first attempt in 6.9
seconds.

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