Repository navigation
test: lock in the process-tree and identity-file leak fixes with regression contracts - #11935
Conversation
…ession contracts Adds end-to-end regression tests that fail if a previously fixed leak path reopens: descendant reclaim after a session ends (including reparented descendants), cancel terminating only the failed session, escaped processes left to the periodic sweep, identity-record retirement counts, and frontend tool-output and chunk-buffer clamps that must not copy unbounded data.
|
Intent: Add end-to-end regression contracts so the 0.7.0 process-tree and identity-file leak fixes fail a test if any single cleanup step is removed or weakened again. |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] e40f702 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the reverse-check claim by disabling one guarded cleanup step locally — the "each test fails when disabled" assertion isn't provable from the diff. [DESIGN-REVIEWED] e40f702 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (6 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: test/spec files only -- four new pytest regression files (ACP spawn offload, member-binding reclaim, runtime cleanup, session-scope reap) plus two vitest files; zero production files touched, so no runtime behaviour changes. The only annotation on the Semgrep run is GitHub's own level=notice runner-image migration message at .github:1, not a Semgrep finding.
Cover real Darwin zombie identity, reaped-root group recovery and escaped descendants. Exercise idle and warm-pool expiry over repeated small process trees, and route these contracts through the existing macOS CI lane. Complements #11935.
Cover real Darwin zombie identity, reaped-root group recovery and escaped descendants. Exercise idle and warm-pool expiry over repeated small process trees, and route these contracts through the existing macOS CI lane. Complements #11935.
Cover real Darwin zombie identity, reaped-root group recovery and escaped descendants. Exercise idle and warm-pool expiry over repeated small process trees, and route these contracts through the existing macOS CI lane. Complements #11935.
Cover real Darwin zombie identity, reaped-root group recovery and escaped descendants. Exercise idle and warm-pool expiry over repeated small process trees, and route these contracts through the existing macOS CI lane. Complements #11935.
…ession contracts (kirodotdev#11935) Adds end-to-end regression tests that fail if a previously fixed leak path reopens: descendant reclaim after a session ends (including reparented descendants), cancel terminating only the failed session, escaped processes left to the periodic sweep, identity-record retirement counts, and frontend tool-output and chunk-buffer clamps that must not copy unbounded data.
Cover real Darwin zombie identity, reaped-root group recovery and escaped descendants. Exercise idle and warm-pool expiry over repeated small process trees, and route these contracts through the existing macOS CI lane. Complements kirodotdev#11935.
Problem / Motivation
The 0.7.0 memory leak was fixed by several PRs (#11309, #11565, #11456, #11594, #11712, #10985), each with its own unit tests. Nothing tests the fixes together: a session ends, its whole runtime tree is gone, identity files are retired, the browser buffers stay bounded. A refactor could reopen one path and every existing test would still pass.
Why it matters
Users saw 50 GB of orphaned
kiro-clitrees and 58k identity files build up over a day. Those fixes are now inv0.7.0-insider.5. Without end-to-end contracts, the same leak class can come back without any test turning red.What changed (motivation → approach → change)
Goal: make the leak fixes fail loudly if they regress. Approach: drive the real cleanup code with fake processes, then assert on what is left alive, not on log lines. Every new test was checked in reverse: disable the cleanup step it guards and the test fails.
Backend, in
test/test_runtime_cleanup_regression.py(new): a session that starts persists its new descendants (newandloadpaths); a cancelled descendant scan terminates only the failed session; repeated kills keep escaped processes for the periodic sweep instead of losing them.Backend, in existing files:
test/test_acp_spawn_offload.pychecks a spawn that fails infinish_suspended_spawn,initializeorcancelunwinds the live tree and its tracking.test/test_session_scope_reap.pychecks periodic ticks reclaim successive runtime trees without a gateway restart.test/test_member_binding_reclaim.pychecks repeated publication, retirement and maintenance keep live identity records and drop only dead ones.Frontend, in
website/src/test/pierre.diffWorker.test.tsandwebsite/src/test/useWebSocket.chunkBufOverflow.test.ts: the diff cache keeps exact retention through repeated eviction, bypass, abort and recreation; mixed chunk buffers and tool-output copies stay bounded across repeated active and background turns.No production code changes.
Backwards compatibility
Compatible: test-only change, no runtime behaviour touched.
Tests
test_session_start_persists_new_descendants[new|load]: descendants seen at session start are written to the PID ledger.test_cancelled_descendant_scan_terminates_only_failed_session[new|load]: cancel kills the failed tree, not a sibling.test_repeated_kill_retains_escapees_for_periodic_cleanup: an escaped PID stays recorded for the sweep.test_failed_spawn_unwinds_live_tree_and_tracking[3 stages]: no live process or ledger entry survives a failed spawn.test_periodic_ticks_reclaim_successive_runtime_trees_without_gateway_restart: Linux scope reap works on a long-running gateway.test_repeated_publication_retirement_and_maintenance_preserve_live_records: identity file counts converge; live records survive.keeps exact retention through repeated eviction, bypass, abort and recreation: diff worker cache size pinned.bounds mixed buffers and tool copies across repeated active/background turns: chunk buffer and tool output clamps pinned.All use fake processes; they do not prove native macOS or Windows reaping.
Manual verification
N/A — unit coverage sufficient: the change adds tests only. Related backend set (146 tests) and both frontend files pass locally; each new test fails when its guarded cleanup step is disabled.
Related Issues
no linked issue: regression coverage for already-merged fixes; no open issue tracks the missing tests.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)