Repository navigation
feat(daemon): process-growth breaker that pauses automatic restores - #27437
Conversation
a8b2b8c to
8a72785
Compare
9ad27be to
47ae7cb
Compare
8a72785 to
0706f29
Compare
6656248 to
128b7cc
Compare
…er host and names the agent
…, observes on desktop
128b7cc to
4f6683d
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change adds a breaker that pauses automatic restores during process storms. It does not kill processes or block interactive actions. No actionable merge-blocking risk was found in the supplied context. Pre-merge checks |
|
ELI5
A restore storm does not have to come from Orca starting too many agents. It can come from agents that are already running, when each one starts helper processes that start more processes. This PR watches how many processes each terminal has under it. When one terminal's processes keep multiplying fast, Orca stops starting new agents automatically and writes down which terminal caused it. It never kills anything.
What Changed
Stacked on #27433. Review only the top commit.
psprocess table in a child process, never on a hot path. Windows uses the native process table, with no PowerShell.criticalwhile the storm lasts. Declared automatic restores are deferred. Undeclared ones (all current callers) wait out the storm for their admission window and are refused only if it outlasts that window. The refusal is the distinctterminal_spawn_refusederror, never the "daemon gone" message.process-growth-breaker-tripped, naming the terminals whose trees grew (by session id suffix), their counts, and their rates.Mechanism:
src/shared/process-growth-breaker.tsis a pure breaker. Its state is keyed by scope: one scope per terminal tree today, plus the host.unknown, which never trips and never resets a streak.DaemonAutomaticWorkGuardgathers the fork gate, the crash marker and the growth monitor in one place, soDaemonServerwires one object.Why
This is the "growth breaker" for #10493.
Linked Issue
Refs #10493
Visual Proof
N/A: no UI change yet. Today the trip shows up in the daemon log, and the paused state is enforced only for clients that declare intent (the client PR adds the visible state and the Resume control).
Testing
process-growth-breaker.test.ts: covers the following.unknownand neither trips nor resets.daemon-automatic-work-guard.test.ts: covers the following.terminal-spawn-gate.test.ts: covers the following.terminal_spawn_refused) only past its deadline.pressure.pnpm tc,pnpm lint,pnpm run check:code-quality:changedand the daemon and shared suites pass.Review
Agent skill upstream boundary
Notes
-EncodedCommandor WMI.Checklist
N/Afor visuals with reasonpnpm lint,pnpm typecheck, and focused tests pass locally; CI covers the rest