Repository navigation
[code-review] Scripts module cleanup: preserve port allocator identity during teardown - #8652
Merged
Merged
Conversation
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.
Task
ORB-23146 — [code-review] Scripts module cleanup: preserve port allocator identity during teardown
Description
Whole-module review at pinned agent-main
de6897dac213c8aae3fc75ed19b2fbdfce0947ec. This is the single low/medium cleanup task for the scripts module in this sweep. Module ID:file:scripts/test-ci-await-jobs.py,file:scripts/test-ci-download-verified.py,file:scripts/test-ci-fast-guards.py,file:scripts/test-ci-p90.py,file:scripts/test-ci-repack-nextest.py,file:scripts/test-ci-test-affected.py,file:scripts/test-codeql-extension-schema.py,file:scripts/test-codeql-path-barriers.py,file:scripts/test-codeql-production-paths.py,file:scripts/test-codeql-rust-local.py,file:scripts/test-compiler-cache-namespaces.sh,file:scripts/test-compiler-cache.sh,file:scripts/test-cpu-utilisation.py,file:scripts/test-cross-revision-check.sh,file:scripts/test-desktop-advisories.py,file:scripts/test-installer-security.sh,file:scripts/test-linux-gated-test-items.py,file:scripts/test-make-install.py,file:scripts/test-mcp-registry-publish-workflow.sh,file:scripts/test-openpty-portability.py,file:scripts/test-path-leases-listener-sudo.py,file:scripts/test-pr-state-workflows.py,file:scripts/test-qa-full-sweep.py,file:scripts/test-refresh-dashboard-vendor.py,file:scripts/test-release-breaking-changes.py,file:scripts/test-release-promotion.py,file:scripts/test-release-readiness-adapter.py,file:scripts/test-release-workflow.py,file:scripts/test-shell-waits-allowlist.json,file:scripts/test-smoke-claude-mcp.py,file:scripts/test-state-backup.py,file:scripts/test-unit-test-inventory.py,file:scripts/test-validate-agent-plugin.sh,file:scripts/test-validate-codex-plugin.sh,file:scripts/test-visual-fixture-server.py,file:scripts/test-website-workflow.py,file:scripts/test-windows-portability.py,file:scripts/unit-test-baseline.json,file:scripts/unit-test-inventory.py,file:scripts/update-auto-task-body-history.py,file:scripts/validate-agent-plugin.sh,file:scripts/validate-codex-plugin.sh.scripts/test-compiler-cache-namespaces.sh:141-151,release_portpublishes the release marker and waits untilkill -0 "$HOLD_PID"fails, then unconditionally sends SIGKILL to that same numeric PID at :150. Bash can already reap the background Python allocator while running foreground commands, so retaining$!and waiting later does not reserve the kernel PID. After the failed liveness probe, PID reuse can make the final signal reach an unrelated same-user process. The EXIT cleanup allocator branch at :237-239 also signals the raw retained allocator PID. This is rated low for the narrow fixture-only reuse window; no actual unrelated process termination is claimed.Evidence: ORB-23106 artifacts
allocator-reproduction.pyandallocator-reproduction.json. The deterministic harness executes the exact pinnedrelease_portwith an intercepted process table: the liveness check observes ESRCH, the model admits numeric reuse, and the function then issuesSIGNAL args=-KILL 424242 owner=foreignbefore wait. It reproduces the same identity bug on the introducing commit (then SIGTERM). A separate exact cleanup model confirms its raw allocator signal. All signals, waits and cleanup operations in the model are intercepted; no kernel PID churn, synthetic load or unrelated process signaling is used. This is source/control-flow reproduction, not a live namespace/compiler run.Culprit: ORB-18359, landed commit
ca85777611715db6f26ee62af52b8cf33ebb2084(PR #6172), introduced the background allocator, both release_port callers, the unconditional post-exit signal, and the allocator cleanup branch. Confirmed by that commit's diff and the task record. ORB-18400 (4ea454cdbddd07689769dd9f4d7b2e6e49844c35) later changed TERM to KILL; it did not introduce the ownership defect. Classification: defect_in_new / no_test / low. At the introducing commit,scripts/test-compiler-cache.shcovers namespace readiness, disabled/refused namespaces, transport failures and bounded waits, but has no allocator exit/reuse ownership transition fixture.Shared invariant and consumers:
alloc_port(:108-139) creates the allocator and records HOLD_PID;release_port(:141-155) is called for client-side shared TCP (:596-597) and server-side shared TCP (:622-623); the EXITcleanup(:235-254) consumes the same allocator ownership, alongside its participant-PID loop. Search/update these together. Existing ownership fixtures are driven byscripts/test-compiler-cache.shandscripts/compiler_cache_process_regression.py; the latter currently covers embedded Python supervisor/watchdog ownership rather than the shell allocator. Preserve finite allocator termination and socket release, participant teardown and diagnostic behavior. Do not replace the stale signal with another check-then-signal numeric PID race. Any invariant shared with in-flight work needs integration-parent comparison, not just the task PR's own green base.Duplicate checks: all-status code-review searches for
release_port HOLD_PID reusedandrelease_port allocator process identity, plus open review-work listing, found no matching open repair. ORB-21051 repairs a different ci-test-affected PGID owner; ORB-19844 and subsequent namespace owner repairs cover embedded supervisors, not the port allocator.Acceptance Criteria
Validation
Branch Freshness
origin/agent-mainorbit/ORB-23146-c85b1ee7