test: the mock remote server closes the descriptors it inherits at startup - #1156
Merged
Merged
Conversation
fujibee
force-pushed
the
agdev-cc3-1107-mock-fd
branch
from
September 11, 2026 16:53
671cbf2 to
71c33a5
Compare
…artup A helper that a test backgrounds and that runs until killed holds every descriptor it inherits for as long as it lives -- including, under a parallel bats run, the harness's own high pipes. #575 fixed this class for the sync engine (scripts/lib/close-fds.sh); the mock was not covered. It now closes every descriptor at or above 3 before it opens the listen socket, so a survivor holds nothing the harness opened; 0/1/2 stay (the port is printed on stdout). This is HYGIENE, not a fix for the macOS shard cancellations tracked in #1107. Reading the hang-samples as a time series shows the shard still starting new tests right up to the cut-off: it is a wall-clock cap being reached by a still-progressing shard (the workflow's own #848/#857 note), not a descriptor-inheritance hang. Kept separate so the review and the ledger stay accurate; the mock/fd was a bystander caught in a snapshot, not the cause. test_engine_inherited_fds.bats grows the matching regression (baseline comparison, mutation-checked); test_team_list.bats reaps its mock in teardown.
fujibee
force-pushed
the
agdev-cc3-1107-mock-fd
branch
from
September 11, 2026 22:29
71c33a5 to
610345b
Compare
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.
Independent hygiene, not a fix for #1107.
The hazard
A helper that a test backgrounds and that runs until killed holds every descriptor it inherits for as long as it lives. Under a parallel bats run that includes the harness's own high pipes, and
tests/helpers/mock_remote_server.pyis exactly that shape — every mock-using test backgrounds it (test_remote,test_perf_harness,test_team_list,tests/perf/join-harness.sh) and closes only fd 3 by name (3>&-), which never reaches a high harness fd. #575 solved this class for the sync engine (scripts/lib/close-fds.sh); the mock was not covered. A survivor could hold a harness pipe open, which is a real hazard worth removing on its own.The fix
mock_remote_server.pycloses every descriptor at or above 3 before it opens the listen socket, mirroringscripts/lib/close-fds.sh(enumerate/dev/fd, fall back to a bounded range).0/1/2stay — the port is printed on stdout. A survivor now holds nothing the harness opened.test_engine_inherited_fds.batsgrows the matching regression, measured against a baseline the way the engine case is, and mutation-checked (it fails when the close is disabled).test_team_list.batsreaps its mock in teardown, so a case that fails before its inlinekillleaves no process (or port) behind.Not #1107
The
#1107macOS shard cancellations are a wall-clock cap being reached by a still-progressing shard, not a descriptor-inheritance hang. Read as a time series, the hang-samples show new tests starting right up to the cut-off (the suite advances throughtest_terminal_registry → test_remote → … → test_codex_bridge_launcher), and the surviving mocks are all from an early window, gone before the cut-off. The workflow's own #848/#857 note warns that a shard passing tests up to the cap looks identical to a stuck one. #1107's cause is the suite having outgrown the partitioner's baseline; that is separate from this change, which stands as hygiene.Verification
test_perf_harness.bats(9/9, curl paging through the mock),test_team_list.bats, andtest_remote.bats --filter connect(60/60) green locally.