Work type
Bug
Problem
Parallel TestMatrix_ cases reserve an ephemeral address with freeLocalAddr, close it, then later accept any /healthz response at that recycled address. A sibling harness can acquire the same port, causing the custom-global-skill case to query the wrong server and intermittently receive an empty registry.
Evidence: hosted race run 30848795397 logged two harnesses on 127.0.0.1:44987; the intended runtime logged loaded 1 skill(s) but TestMatrix_SkillsEnabledWithCustomGlobalDir queried {"skills":[]}. Harness source and tests are byte-identical on origin/main 68a82ddf and the failing #1138 ancestor, so this is a baseline race.
Scope
- Add optional listener injection to
runDeps (default net.Listen).
- Have
runMatrixTest request 127.0.0.1:0 and record the actual acquired listener address through the injected wrapper.
- Await that exact listener (or early
runWithSignals failure) before /healthz and assertions.
- Remove
freeLocalAddr from matrix cases.
Out of scope
- Production skill loading behavior.
- Serializing matrix tests or increasing arbitrary timeouts.
Acceptance criteria
- A deterministic regression proves
runMatrixTest uses the address actually bound by its server.
- Custom-global-skill endpoint test passes through the corrected helper.
- Focused custom-skill normal/race stress and full
TestMatrix_ normal/race stress pass.
cmd/harnessd normal/race and ./scripts/test-regression.sh pass.
Impact and rollout
Test-harness-only dependency injection; production defaults remain net.Listen. No API, persistence, deployment, or rollback change.
Test plan
TDD: add deterministic red listener-identity regression, implement injected listener handoff, then run focused/race/full regression.
Work type
Bug
Problem
Parallel
TestMatrix_cases reserve an ephemeral address withfreeLocalAddr, close it, then later accept any/healthzresponse at that recycled address. A sibling harness can acquire the same port, causing the custom-global-skill case to query the wrong server and intermittently receive an empty registry.Evidence: hosted race run 30848795397 logged two harnesses on
127.0.0.1:44987; the intended runtime loggedloaded 1 skill(s)butTestMatrix_SkillsEnabledWithCustomGlobalDirqueried{"skills":[]}. Harness source and tests are byte-identical on origin/main68a82ddfand the failing #1138 ancestor, so this is a baseline race.Scope
runDeps(defaultnet.Listen).runMatrixTestrequest127.0.0.1:0and record the actual acquired listener address through the injected wrapper.runWithSignalsfailure) before/healthzand assertions.freeLocalAddrfrom matrix cases.Out of scope
Acceptance criteria
runMatrixTestuses the address actually bound by its server.TestMatrix_normal/race stress pass.cmd/harnessdnormal/race and./scripts/test-regression.shpass.Impact and rollout
Test-harness-only dependency injection; production defaults remain
net.Listen. No API, persistence, deployment, or rollback change.Test plan
TDD: add deterministic red listener-identity regression, implement injected listener handoff, then run focused/race/full regression.