Repository navigation
test: keep ACP process-tree fake PIDs from aliasing the worker PID - #1007
Merged
Merged
Conversation
The 130-parent rotation fixture used fake PIDs 1000-1129 and 11000-11129. When the vitest worker's real process.pid landed in that range (common on fresh ubuntu-24.04 runners), the fake parent replaced the server identity, and terminatePosixOwnedProcessTree correctly refused to signal its own PID, process group and session, failing with "retained owned processes: N, N+10000". Allocate the fixture's synthetic PIDs above Linux PID_MAX_LIMIT (2^22) so they can never alias a real PID. Assertions are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the recurring
Test Server 2failure inAcpSessionRuntime.processTree.test.ts > terminatePosixOwnedProcessTree > rotates more than 64 live parents without scanning retained tombstones(ACP process tree 100 retained owned processes: 1088, 11088, and the same error for 1001/11001 and 1047/11047).Root cause
This was a fixture PID collision. It was not a timing problem, and no merged change introduced a production regression.
server()at the realprocess.pidand adds 130 fake parents at PIDs1000–1129plus children at+10000in the sameMapkeyed by PID.ubuntu-24.04runners the vitest worker's real PID often falls in1000–1129. When it does, the fake parent replaces the server entry.controller.identity(process.pid)then returns that parent, socurrent.pgid/current.sidbecome the parent's group.terminatePosixOwnedProcessTreeintentionally never signalsprocess.pidor anything in the current process group or session. It skips that parent and its child, and the final residual check reports exactlyN, N+10000. The production behavior is correct.it.liveand the 10 ms sleeps don't matter here. Becausegrace: 0, the outcome depends only on the PID.Evidence
Reproduced by setting
process.pidin a temporary copy of the file (removed before committing):process.pidretained owned processes: 1001, 11001retained owned processes: 1047, 11047retained owned processes: 1088, 11088retained owned processes: 1088, 11088The before messages match the CI errors exactly.
Fix
The test now allocates its synthetic parent, child, and tombstone PIDs above Linux
PID_MAX_LIMIT(2^22; macOS PIDs stay below 100000), so they can never alias a real worker PID. Every assertion is unchanged, includingsnapshotCalls === 10,fixture.processes.size === 1, and the ≤64 work bound per pass. No production code changed.Validation
vp test run src/provider/acp/AcpSessionRuntime.processTree.test.ts×50: 50 passed, 0 failedAcpSessionRuntime.test.ts+AcpSessionRuntime.processTree.test.ts: 37/37 passedvp run -F t3 typecheck: clean; scopedvp lint/vp fmt --check: cleanImpact: test-only. No change to runtime, providers, wire contracts, or clients.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.