Skip to content

fix: end six crate flakes from product budgets, inherited git settings and a Windows Node warm-up - #1863

Merged
yansfil merged 14 commits into
mainfrom
fix/flaky3-crates
Oct 30, 2026
Merged

yansfil merged 14 commits into
mainfrom
fix/flaky3-crates

Conversation

@yansfil

@yansfil yansfil commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes with-hide/hide-private#331
Closes with-hide/hide-private#332
Closes with-hide/hide-private#333
Closes with-hide/hide-private#338
Closes with-hide/hide-private#329

Summary

Six flaky tests in five crates came from three causes, and each is fixed once for its class.

  • Tests read through a product time budget they are not about: Memory reads were cut at the hook's 100 ms and returned no cards, and the usage store's 250 ms step cut a 40,000-row prune.
    A Memory read now has no deadline of its own (the 100 ms stays in the hook alone), and the usage store's tests hold its clock still.
  • Fixture git read the account's settings, so a commit failed whenever the commit-signing agent did not answer; the fixtures now read no global or system git file.
  • The Windows Node test warmed Node with --version, which skips most of Node's start, so the guarded run still paid the slow first start; the warm-up now runs the same script.

Per issue:

Issue Handling
#331 usage store prune Cause fixed: store budgets measured on an injected clock; store tests open it on a still one
#332 herdr-core memory tests Cause fixed: MemoryStore::retrieve has no deadline; memory_hook tests use answer_until with a still clock
#338 hide-memory store tests Same cause as #332, same fix; the store and hook tests in its latest comments read through retrieve_with_expiry, which no longer adds a wall clock of its own
#333 hide-host fixture commit Cause fixed: GIT_CONFIG_GLOBAL=/dev/null, GIT_CONFIG_NOSYSTEM=1; four other fixtures with the same inheritance too
#329 hide-kit Windows Node Cause fixed: the first start runs the guarded script, not --version
#334 omp observed false Stays open by the lead's decision: the helper's 1.2 s send budget is in another process; the failure now prints the time, the recorded cause and the stand-in's calls

The Windows process end (with-hide/hide-private#327) was in this pull request and moved to a pull request of its own; its commits here are taken back out, so hide-platform, hide-ai's omp test and its documentation are as on main.

스크린샷 없음: no screen changes.

Review

  • 조심해서 볼 파일:
    • hide-memory/src/store.rs, hide-memory/src/hook.rs - RetrievalQuery.deadline is removed. The product's only Memory reader is the hook (hook::context_for and herdr_core::memory_hook::answer, both through hide_memory::hook::within_hook_budget, which adds the 100 ms); every retrieve call left is in a test.
    • herdr-core/src/usage_ledger/store.rs - Store carries clock: fn() -> Instant; open passes Instant::now, so product timing is unchanged.
    • hide-host/src/worktrees.rs and four test fixtures - git runs with no global or system configuration file.
  • 질문: Agent 탭이 마크로 접히기 전에 세 단계로 연속해서 줄어듭니다 #329's readying pays Node's first full start before the 30 s guard; the test is about the environment the kit hands Node (it aborts without SystemRoot), not its start time. If a cold first start is ever the operator's own concern, that is a separate product issue.

Evidence

@yansfil yansfil changed the title test: end seven crate flakes from product budgets, inherited git settings and Windows process ends fix: end seven crate flakes from product budgets, inherited git settings and Windows process ends Oct 30, 2026
… handles

The job counts a process out before the system closes the handles it held and signals its object, so a capture that ended its tree on the job's count returned while the helper it ended still held its pipe, and is_alive, which now waits on the object, read the helper alive. The end now holds each process the job lists before it terminates the job, and the tree has ended only once each of them is signalled.
A list of the job read once at the end missed a process started after it and one that had just ended on its own, and both could still hold a file when the end was confirmed. The job now announces each process on a completion port set before the child starts, each is held until it is signalled, and the notices are counted against the job's own count, so a missed notice is an error rather than a confirmed end. A wait or exit-code read that fails in is_alive keeps the process counted and is logged.
macOS does not hold back a fork made by a parent the group kill has not stopped yet, so the new process kept running and a capture never confirmed its tree's end. While the end is confirmed, a member still running has the group signalled again; on Windows the job is ended again while it counts a process running.
The Windows is_alive wait, the job's tree end and their tests and documentation return to main's; the Windows tree end, with-hide/hide-private#327, moves to a pull request of its own.
@yansfil yansfil changed the title fix: end seven crate flakes from product budgets, inherited git settings and Windows process ends fix: end six crate flakes from product budgets, inherited git settings and a Windows Node warm-up Oct 30, 2026
@yansfil
yansfil merged commit 51914ab into main Oct 30, 2026
60 checks passed
@yansfil
yansfil deleted the fix/flaky3-crates branch October 30, 2026 06:48
yansfil added a commit that referenced this pull request Oct 30, 2026
…et go of what it held (#1872)

Closes with-hide/hide-private#327

## Summary

On Windows a capture or run said a process tree had ended while a
process in it still held a file, so removing the folder right after was
refused.
Windows takes a process off its job's count, and sets its exit code,
before it closes what the process held.
Now every process a child's job runs is followed from its start, and the
end is answered only once each one has let go; `is_alive` waits for the
same signal.
On every system, a process the tree starts while it is being ended is
ended too; on macOS it used to keep running.

스크린샷 없음: no screen changes.

## Review

- **운영자 결정 (2026-10-30)**: the kernel's completion-port queue is owned
by Windows and has no limit Hide can set; it is accepted as a known
limit, not capped. One thread per hided/hide process
(`hide-job-notices`) reads every child's job notices from that port for
the life of the process, and notices wait in the queue only while the
children's processes start and end faster than it reads them. What Hide
owns is capped, and crossing a cap is a failure the caller sees: each
notice costs the thread a fixed amount of work, at most 1,024 jobs are
followed at once (a child past it is refused at its start), and at most
4,096 processes are held per job (past it, every question about that
job's end answers with the reason). `docs/ARCHITECTURE.md` records the
same.
- **조심해서 볼 파일**:
- `hide-platform/src/process.rs` `Followed::notice`,
`let_go_of_signalled` - each notice checks the next two held processes
in turn; one not yet signalled goes behind the rest, so a process slow
to end holds up no other, and one whose exit notice never came is let go
on its turn.
- `hide-platform/src/process.rs` `Members`, `Notices::stop`,
`left_running` - failure path: a process that cannot be held, a failed
wait, past 4,096 held, or the thread stopping is kept as the reason and
every later end answers it; held handles are never dropped on an error.
When the thread stops, each job's notices are taken off the port; if the
system refuses that for a job, it is only logged
(`process.job_notices_left_set`) and that job's notices keep reaching
the unread port.
- `hide-platform/src/process.rs` `capture_until`, `capture_run`, Unix
`tree_ended` - the leader is reaped only after the tree's end is
confirmed, so a second group signal cannot reach a reused group id.
- `hide-platform/src/process.rs` Windows `is_alive` - a failed wait or
exit-code read keeps the process counted and logs
`process.alive_unconfirmed`.
- **비용 검토**: every notice costs one port read and at most two
zero-timeout waits on held processes, however many are held. A process
joining a job adds one `OpenProcess`, one `IsProcessInJob` and one wait.
Since each held process came with a notice that checked two, checks
outpace holds even when exit notices are lost, and every ended process
is let go within one turn of the held ones; the owner lets go of all
ended ones whenever it asks about the end. The thread blocks on the port
and does nothing otherwise.
- **질문**: Microsoft does not guarantee job notices arrive; a missing one
leaves the end owed until the caller's deadline (never confirmed). Is
that the outcome you want, rather than an immediate error?

## Evidence

- **확인한 것**:
- The earlier form of this change ran in #1863: Windows OS
contract 256/256 first try with the signal-based `is_alive`, after the
job-count end failed both capture tests every time (runs 40996135782,
40996147032).
-
`an_ended_process_is_let_go_behind_one_slow_to_end_without_its_exit_notice`
(Windows unit test): three held objects not yet signalled ahead of one
signalled whose exit notice never comes; the signalled one is let go
within one turn while the oldest one's exit is announced over and over,
and the slow one is let go once it signals.
-
`a_job_followed_before_the_notices_stopped_answers_why_and_none_joins_after`
and
`a_child_past_the_followed_jobs_cap_is_refused_and_an_ended_one_frees_its_place`
(Windows unit tests, real empty jobs and a port) cover the stop and the
job cap.
- CI on 30b4409 (run 41016473655) green on every lane: Windows OS
contract 260 passed, 5 skipped, with the stop and job-cap tests passing
on the first try.
- Local macOS: `hide-platform` 310 passed, 2 skipped; `clippy
--all-targets -D warnings` clean for `hide-platform` on macOS and on the
Windows target (`x86_64-pc-windows-msvc`), with the new Windows test
compiled.
- The race test failed 5 of 8 local macOS runs before the second group
signal (a holder forked during the kill kept running); after it, 22/22
in #1863 and 10/10 here under load.
- **확인하지 못한 것**:
- Windows and Linux run only on this PR's CI; this Mac cannot run them.
-
`a_capture_waits_for_a_holder_started_while_the_tree_ran_and_one_that_ended_before_its_end`
orders the starts and the ending against the end, but when the system
closes a handle is its own timing, so the test can pass without the fix
too.
- A lost job notice, a refused hold and a process whose handles take
long to close are not driven end to end; the rotation is proved with
event objects standing in for process objects.
- The kernel queue's growth under heavy process churn was not measured.
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