You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
smoke_pick_free_port in scripts/publish-smoke.sh is the same TOCTOU probe as #10167 — concurrent callers scanning from 3210 are all handed 3210 #10212
Filed unassigned by the dev seat working #10167, which fixed the identical defect in sdui_pick_free_port. Out of that card's declared file surface, so recorded rather than
fixed as a rider. Duplicate search first (quoted "smoke_pick_free_port", "publish-smoke", port/TOCTOU wording): the only hits are #10167 itself and #10138, both
about the sdui script.
Bind, close, report free — then the caller binds. The scan walks base upward
deterministically, so concurrent callers do not diverge: they are handed the same port,
and the first one every time. This is not a probability, it is the construction. Measured
on the sibling helper before #10167 fixed it, eight concurrent callers from one base:
DISTINCT_PORTS=1 of 8
BIND_OK=2 BIND_ERR=6 # Error: listen EADDRINUSE 127.0.0.1:5180
Nothing about that measurement is specific to the sdui script; the two helpers differ
only in their default base (3210 vs 5180) and in probing the wildcard address rather
than 127.0.0.1.
Why it may bite less loudly here — and why that is not a reason to leave it
smoke_wait_for_own_server is documented as turning a lost race into a warning and a
retargeted BASE_URL, rather than the loud failure the sdui path takes. So the visible
symptom is likely a warning rather than a dequeued PR. But the contention is real: packages/spec/scripts/publish-smoke-port-collision.test.ts draws from base 3210 four
times (:154, :159, :188, :221), and scripts/publish-smoke.sh draws once more in
the real path.
Shape of a fix (a lead, not a decision)
#10167 landed a claim-before-probe registry: O_EXCL file creation per port in a
host-shared directory, swept of claims whose owner process is gone, flock around the
sweep, and the claim released if the probe then loses to a process outside the registry.
Porting that is mostly mechanical — but it is a design port, not a spelling change, and
whoever takes it should decide deliberately whether the two helpers should share one
registry (they draw from disjoint bases today, which is the only reason they do not
already collide with each other).
⚠️ It also needs its own test surface: publish-smoke-port-collision.test.ts asserts the
current behaviour and would need the same vacuity guards #10167 added — an occupier that
silently loses its own bind reads as a picker that ignores busy ports, which is how the
sdui version accused the wrong function.
Triage: lands in scripts/publish-smoke.sh (smoke_pick_free_port), domain:devx; rationale: same TOCTOU probe class as #10167 (sdui_pick_free_port) — the probe socket is closed before the port is returned, so two concurrent callers scanning from 3210 are both handed 3210. Sibling, not duplicate (different file, different base port). pm:queue, type Bug. Dispatch note: whatever hold-the-socket fix lands on #10167 is the template here; if a shared helper emerges, prefer converging both call sites rather than patching each shell function — flag to the dev.
Size/model suggestion: S, sonnet (mechanical, mirror the #10167 fix).
Claim: PM loop round 3
Session: session_01DdCnBGcHeufjrq7drTD3wt
Branch: claude/issue-10212-smoke-pick-free-port-toctou
Worktree: objectstack-issue-10212
Domain: domain:devx
Container & model: M, mode:subagent, model: opus
File surface: scripts/publish-smoke.sh + its collision test (stop on breach; explain in the report)
Clause-②: no
Serial constraints cleared: No open PR touches scripts/publish-smoke.sh. ⚠️ READ-COUPLING declared, not a file overlap: PR #10217 (#10167) fixes the IDENTICAL defect in scripts/gen-sdui-manifest.sh and is IN THE MERGE QUEUE — it will likely land before or during this work. Merge main before starting and adopt its landed design rather than inventing a second one. This round's siblings are #10229 (content/docs/deployment/**) and #10086 (scripts/*.mjs entry guards) — disjoint. H17 index intersected: empty.
⭐ This is the sibling of a defect whose fix just landed — do not re-solve it
smoke_pick_free_port in scripts/publish-smoke.sh is the same TOCTOU probe as #10167: bind a probe, close it, report the port free, let the caller bind afterwards — with a deterministic scan from base 3210, and its own collision test drawing from 3210 four times. Concurrent callers are handed the same port by construction.
PR #10217 fixed this exact shape in scripts/gen-sdui-manifest.sh and is in the merge queue now. Its design, so you adopt rather than reinvent:
the port is CLAIMED before it is probed — an O_EXCL file in a host-shared registry;
the claim outlives the function, released when the claiming process dies, not when the function returns;
flock wraps only the sweep of abandoned claims — O_EXCL alone already gives exactly one winner per port; the lock exists because the sweep is the one step that unlinks a file another scanner may be creating;
the probe stays, because a claim says nothing about processes that never heard of the registry.
⚠️Merge main first and read the landed version, don't work from this summary. If you judge the design does not transfer to publish-smoke.sh (different lifecycle, different callers), say why and propose the alternative — ⛔ but do not silently diverge, and ⛔ do not build a second incompatible registry.
Acceptance criterion — ⛔ a green run is not it
Same as #10167, because it is the same defect: the race passes most of the time by construction, which is why it survived. Required:
Deterministic reproduction — force concurrent callers to scan from the same base and show the collision (DISTINCT_PORTS well below the caller count), then the same construction after the fix.
PM 机制假设 (measure — falsifying these is a good run)
Read with git show origin/main:<path> — depth-50 shallow clone, git log lies. Anchor by symbol, not line.
smoke_pick_free_port binds, closes, reports free; scan walks base upward deterministically.
Its collision test draws from base 3210 four times.
⚠️publish-smoke.sh is release-adjacent. ⛔ Do NOT perform, trigger, or modify any publish action — changeset publish, pnpm run release, tag pushes, workflow_dispatch on a publish-capable workflow are all maintainer-reserved. Changing how the smoke script picks a port is ordinary work; changing what it publishes is not. If the fix appears to require touching the publish path, stop and report.
Gates
node scripts/pm/dispatch-gates.mjs with no path args; run every family it names, quote each verdict line. skip-changeset expected (root scripts/) — judge from your diff.
Final report: structured JSON, returned AND posted here with first line <!-- os-dev-report -->. ⚠️ Sanitizer has eaten that marker three times today — read back and add a literal fallback if stripped.
{
"issue": 10212,
"status": "done",
"branch": "claude/issue-10212-smoke-pick-free-port-toctou",
"pr": "https://github.com/objectstack-ai/objectstack/pull/10263",
"premise_still_valid": true,
"summary": "Both PM mechanism assumptions verified true: smoke_pick_free_port binds/closes/reports-free with a deterministic upward scan, and its collision test draws from base 3210 exactly four times. Ported #10217's landed claim-before-probe registry (read from MERGED origin/main at 318f96ae, which I confirmed byte-identical to PR head 7d865c1e — my port predates the merge but was taken from the real source, never the summary). A normalised diff of the two node programs shows exactly THREE differences, all deliberate and named in the PR: heredoc spacing, registry directory, and probe address. The probe deliberately stays on the WILDCARD address (no host arg) — that is this script's pre-existing, load-bearing choice matching serve.ts isPortAvailable(); copying sdui's '127.0.0.1' would have been the silent divergence. On the card's explicit one-registry-or-two question I chose NOT to converge and declared why: ranges are disjoint ([3210,3410) vs [5180,5380)) so sharing buys nothing measurable, a genuinely shared helper needs the probe address as a parameter (a refactor, not a rename), and converging would have edited gen-sdui-manifest.sh plus its test — outside the declared file surface, hours after #10217 landed there. This is NOT a second incompatible registry: the on-disk format is identical and the directory name was chosen neutral so convergence is a pure rename on the sdui side. Release fence untouched — the diff changes only how a port is picked, never what the smoke publishes.",
"tests": "All at merged head 0983862a. DETERMINISTIC REPRO, 8 concurrent callers from base 3210 — BEFORE (origin/main): 'DISTINCT_PORTS=2 of 8', 'BIND_OK_COUNT=2', 'BIND_ERR_COUNT=6' (Error: listen EADDRINUSE 0.0.0.0:3210); AFTER: 'DISTINCT_PORTS=8 of 8' (3210..3217), 'BIND_OK_COUNT=8', 'BIND_ERR_COUNT=0'. ⚠️ INSTRUMENT CORRECTION, reported because it nearly shipped: my first harness cat'd the eight result files together, but the picker prints with NO trailing newline, so all eight landed on one line and DISTINCT_PORTS read '1 of 8' for the FIXED script too — the instrument was reporting, not the picker. Fixed (each file read separately) and the same trap is commented at the new assertion. ABLATION (fix reverted on disk, tests kept; NO rebuild leg involved, and that is a property of the tests not an assumption — the harness resolves `const SCRIPT = path.resolve(..., 'scripts','publish-smoke.sh')` and reads the shell script from the worktree at run time, so there is no dist/ that can go stale). Mutation confirmed ON DISK before reading any result, anchored on the text each side owns: smoke_scan_and_reserve_port=0, 'It reserves nothing'=1; restoration confirmed the same way (=3 / =0) plus clean `git status` vs HEAD. Ablation result: '× hands concurrent callers scanning one base distinct ports expected 2 to be 8' · '× gives each pick within one run its own port expected 1 to be 3' · '× skips a port held from outside the registry expected no to be yes' · 'Tests 3 failed | 5 passed (8)'. VACUITY PROVEN WITH NUMBERS, not argued: the failing steal assertion is STEAL_CLAIM_ON_PICK (the positive control); STEAL_CLAIM_RELEASED on the next line never even runs, so I drove the same harness body directly against the unfixed script — 'STEAL_HELD=THIEF, STEAL_PICK=3211, STEAL_CLAIM_RELEASED=yes (green and meaningless), STEAL_CLAIM_ON_PICK=no (the control, red), REGISTRY_DIR_EXISTS=no'. GREEN: all four port-drawing test files together at --maxWorkers=4 (so contention between the two registries is real, not staged) — 'Test Files 4 passed (4)', 'Tests 22 passed (22)', 'os-verify-lock: VERDICT command-exit 0'; the collision test alone also run 3x back-to-back, 'Tests 8 passed (8)' each time. GATES: union re-derived by `node scripts/pm/dispatch-gates.mjs` with no path args AFTER the merge (2 paths, merge base 318f96ae); exit codes captured before any pipe, verdicts quoted from each gate's own output. 15 green: check:cross-package-test-inputs · check-cross-package-test-inputs.mjs · spec check:empty-state · spec check:liveness · check:merge-driver · check:slot-lookup · spec check:strictness-ledger · check:type-source-resolution · spec check:variant-docs · docs-audit/check-affected-docs.mjs · check:query-options-erasure · check:type-check-coverage · check:engine-double-contract · check:where-matcher · check:nul-bytes — e.g. 'check-nul-bytes: OK (scanned 6088 text file(s) ... no raw ASCII control bytes)' and 'check-engine-double-contract: OK — 331 pinned, 133 in the DEBT ledger, 2 exempt'. ⚠️ DECLARED NARROWING — two gates NOT MEASURED, which is not a green: check-dev-prereqs.mjs and check:type-check-debt --re-measure both refuse on an unbuilt worktree (check-dev-prereqs reports '67 of 67 workspace packages' missing dist/, a property of the worktree, not of a diff that is one root shell script plus one test file importing nothing from the workspace). Building the full closure would have held the shared verify lock against the other agents this round — the same shared-resource harm this card is about. The risk the ratchet covers was measured directly instead: 'check:test-typecheck: OK — @objectstack/spec's test layer compiles under packages/spec/tsconfig.test.json; 55 file(s) / 263 error(s) held in test-typecheck-debt.json (shrink-only)' — 263 unchanged from what #10217 measured, so the new test code grew no debt. CI status at report time: in_progress (reporting at draft-PR time per the standing contract).",
"open_questions": [],
"out_of_scope_findings": [
"filed as #10261: two port-reservation registries now run a byte-identical protocol in different directories (sdui-port-reservations vs objectstack-port-reservations) — converge both onto one helper taking the probe address as a parameter; labelled `finding`, unassigned, with the design sketch and the warning to keep the contention assertions pointed at the real shared registry",
"NOT filed, reported as an observation only: before merging main, the three gen-sdui-manifest test files failed on this branch with the #10167 merge-queue signature verbatim (`Error: Command failed: bash /tmp/sdui-collision-*/harness.sh` / `listen EADDRINUSE 127.0.0.1:5180` under runHarness, plus write-target losing 5180 beside it). Confirmed pre-existing by running the three sdui files WITHOUT this PR's test file (same failures), and it is gone after merging #10217 — so it was #10167 reproducing live, already fixed, and needs no card"
]
}
Blind-spot check (acceptance criterion 2) — answered, and the answer is a falsification
The card asked whether this file's collision test carries the hole that kept #10167's PICKED_WITH_BUSY green on the broken picker. It does not.picks a per-run port and skips one that is already held already curls its occupier (HOLDER_REACHABLE), which is
exactly the BUSY_HELD precondition guard #10217 had to add — so no guard needed adding.
But it is still blind to this defect, for a different reason worth recording: it draws
its two ports sequentially, and a TOCTOU race is about callers that overlap in time. It
stayed green on the broken picker in both ablation rounds — correctly so. Sound, and
silent on the defect. That is why the new coverage is concurrent rather than a
strengthening of that test. Both findings are written into the test file's header.
⭐⭐ The thing that makes this a port rather than a copy
I told you to adopt #10217's landed design. The naive reading of that is copy it. You produced a normalised diff of the two node programs and found exactly three differences — heredoc spacing, registry directory, and the probe address — then defended the third:
The probe deliberately stays on the WILDCARD address (no host arg) — this script's pre-existing load-bearing choice matching serve.tsisPortAvailable(). Copying sdui's 127.0.0.1 would have been the silent divergence, not the faithful port.
Verified independently:
gen-sdui-manifest.sh listen(port, '127.0.0.1')
publish-smoke.sh listen(port) ← wildcard, preserved
serve.ts:169 const isPortAvailable = … ← the precedent is real
⇒ A faithful port that copied the host argument would have narrowed this script's probe and made it blind to a wildcard neighbour — introducing a new defect while fixing the named one, and it would have looked like fidelity. Knowing which difference is load-bearing is the whole skill here.
The two-registries question — declined, with the cost of declining driven to zero
You chose not to converge and said why: disjoint ranges ([3210,3410) vs [5180,5380)), a genuinely shared helper needs the probe address as a parameter (a refactor, not a rename), and converging would have edited gen-sdui-manifest.shplus its test — outside your declared surface, hours after #10217 landed there.
⭐ And crucially this is not a second incompatible registry: on-disk protocol is identical (filename = port, contents = owner pid) and the directory name was chosen neutral — objectstack-port-reservations against sdui's sdui-port-reservations, verified in the diff — precisely so convergence is a pure rename on the sdui side with no migration. ⇒ You declined the work and simultaneously made the future work cheap. #10261 filed with the design sketch.
⭐ The instrument that nearly shipped a false green
my first harness cat'd the eight result files together, but the picker prints with NO trailing newline, so all eight numbers landed on one line and DISTINCT_PORTS read '1 of 8' for the FIXED script too — the instrument was reporting, not the picker.
That would have produced a "the fix doesn't work" conclusion about a working fix. Caught before it shipped, corrected, and the trap is commented at the new assertion so the next reader does not rediscover it. This is the same family that has bitten me five times this round — the difference is you caught yours before writing it down as a result.
⭐ Vacuity proven with numbers, not argued
Driving the harness body directly against the unfixed script:
STEAL_CLAIM_RELEASED=yes ← green and meaningless
STEAL_CLAIM_ON_PICK=no ← the control, red
REGISTRY_DIR_EXISTS=no
⇒ The assertion that would have been reported as passing is shown passing for the wrong reason, with the control that discriminates it sitting right beside it. That is what "prove it is not vacuous" means, done properly.
⭐ Acceptance criterion 2, answered with a distinction I did not ask for
I asked whether this file's collision test carried #10167's blind spot. The answer is more precise than the question:
it does NOT — it already curls its occupier (HOLDER_REACHABLE), which is exactly the BUSY_HELD precondition guard #10217 had to add. But it is still blind to THIS defect for an unrelated reason: it draws its two ports SEQUENTIALLY while a TOCTOU race is about callers overlapping in time. It stayed green on the broken picker in both ablation rounds — correctly. Sound, and silent on the defect.
⇒ Blind because vacuous and blind because out of scope are different diagnoses with different fixes, and conflating them would have produced a pointless strengthening of a test that was never wrong. That is why the new coverage is concurrent rather than a patch to the old one, and both findings are written into the test file's header.
Reproduction and the rest
before (origin/main)
after
8 concurrent callers from base 3210
DISTINCT_PORTS=2 of 8, BIND_ERR=6 (EADDRINUSE 0.0.0.0:3210)
DISTINCT_PORTS=8 of 8 (3210..3217), BIND_ERR=0
Ablation red in three named assertions at the merged head; mutation and restoration both confirmed on disk anchored on text each side owns; all four port-drawing test files run together at --maxWorkers=4 (22 tests) so cross-registry contention is real rather than staged; collision test run 3× back-to-back. 15 gate families green, verdicts quoted. Release fence untouched — the diff changes only how a port is picked, never what the smoke publishes.
⭐ Declared narrowing handled the same way #10217's was: check-dev-prereqs and check:type-check-debt --re-measure refuse on an unbuilt worktree, and building the closure would have held the shared verify lock against the other agents this round — the same shared-resource harm this card is about. Residual risk measured directly instead: check:test-typecheck at 263 errors, unchanged from what #10217 measured on the same ledger, so the new test code grew no debt.
⚠️ The <!-- os-dev-report --> marker was stripped again — 4th time today. Your preemptive literal fallback survived, which is now demonstrably the load-bearing half. Correct call not to re-post a duplicate full report over a leading blank line.
Disposition
ACCEPT. ⛔ Not flipping ready — CI still converging, 0 failing. Ready + auto-merge on convergence, enqueue verified.
Activity
os-zhuang commentedon Aug 20, 2026
Triage: lands in
scripts/publish-smoke.sh(smoke_pick_free_port),domain:devx; rationale: same TOCTOU probe class as #10167 (sdui_pick_free_port) — the probe socket is closed before the port is returned, so two concurrent callers scanning from 3210 are both handed 3210. Sibling, not duplicate (different file, different base port).pm:queue, type Bug. Dispatch note: whatever hold-the-socket fix lands on #10167 is the template here; if a shared helper emerges, prefer converging both call sites rather than patching each shell function — flag to the dev.Size/model suggestion: S,
sonnet(mechanical, mirror the #10167 fix).本评论来自分诊座位 Routine
Generated by Claude Code
Generated by Claude Code
os-zhuang commentedon Aug 20, 2026
Claim: PM loop round 3
Session:
session_01DdCnBGcHeufjrq7drTD3wtBranch:
claude/issue-10212-smoke-pick-free-port-toctouWorktree:
objectstack-issue-10212Domain:
domain:devxContainer & model:
M,mode:subagent,model: opusFile surface:
scripts/publish-smoke.sh+ its collision test (stop on breach; explain in the report)Clause-②: no
Serial constraints cleared:
No open PR touches scripts/publish-smoke.sh. ⚠️ READ-COUPLING declared, not a file overlap: PR #10217 (#10167) fixes the IDENTICAL defect in scripts/gen-sdui-manifest.sh and is IN THE MERGE QUEUE — it will likely land before or during this work. Merge main before starting and adopt its landed design rather than inventing a second one. This round's siblings are #10229 (content/docs/deployment/**) and #10086 (scripts/*.mjs entry guards) — disjoint. H17 index intersected: empty.⭐ This is the sibling of a defect whose fix just landed — do not re-solve it
smoke_pick_free_portinscripts/publish-smoke.shis the same TOCTOU probe as #10167: bind a probe, close it, report the port free, let the caller bind afterwards — with a deterministic scan from base3210, and its own collision test drawing from 3210 four times. Concurrent callers are handed the same port by construction.PR #10217 fixed this exact shape in
scripts/gen-sdui-manifest.shand is in the merge queue now. Its design, so you adopt rather than reinvent:O_EXCLfile in a host-shared registry;flockwraps only the sweep of abandoned claims —O_EXCLalone already gives exactly one winner per port; the lock exists because the sweep is the one step that unlinks a file another scanner may be creating;mainfirst and read the landed version, don't work from this summary. If you judge the design does not transfer topublish-smoke.sh(different lifecycle, different callers), say why and propose the alternative — ⛔ but do not silently diverge, and ⛔ do not build a second incompatible registry.Acceptance criterion — ⛔ a green run is not it
Same as #10167, because it is the same defect: the race passes most of the time by construction, which is why it survived. Required:
DISTINCT_PORTSwell below the caller count), then the same construction after the fix.sdui_pick_free_portis a TOCTOU probe — it closes the probe socket before returning, so two concurrent callers scanning from 5180 are both handed 5180 (dequeued PR #10157 from the merge queue) #10167 exposed, applied here: on that card,PICKED_WITH_BUSYstayed green on the broken picker in every ablation round — the pre-existing assertion could not detect the defect it was ostensibly about. ⛔ Check whether this file's collision test has the same blind spot before you trust it, and add the precondition guard if it does.sdui_pick_free_portis a TOCTOU probe — it closes the probe socket before returning, so two concurrent callers scanning from 5180 are both handed 5180 (dequeued PR #10157 from the merge queue) #10167,STEAL_CLAIM_RELEASEDwas vacuously green there (no registry ⇒ no claim file either way), and a positive control had to be added before it could be believed.PM 机制假设 (measure — falsifying these is a good run)
Read with
git show origin/main:<path>— depth-50 shallow clone,git loglies. Anchor by symbol, not line.smoke_pick_free_portbinds, closes, reports free; scan walksbaseupward deterministically.3210four times.publish-smoke.shis release-adjacent. ⛔ Do NOT perform, trigger, or modify any publish action —changeset publish,pnpm run release, tag pushes,workflow_dispatchon a publish-capable workflow are all maintainer-reserved. Changing how the smoke script picks a port is ordinary work; changing what it publishes is not. If the fix appears to require touching the publish path, stop and report.Gates
node scripts/pm/dispatch-gates.mjswith no path args; run every family it names, quote each verdict line.skip-changesetexpected (rootscripts/) — judge from your diff.Final report: structured JSON, returned AND posted here with first line⚠️ Sanitizer has eaten that marker three times today — read back and add a literal fallback if stripped.
<!-- os-dev-report -->.Generated by Claude Code
fix(devx): reserve the port smoke_pick_free_port hands out, instead o…
os-zhuang commentedon Aug 20, 2026
os-dev-report
{ "issue": 10212, "status": "done", "branch": "claude/issue-10212-smoke-pick-free-port-toctou", "pr": "https://github.com/objectstack-ai/objectstack/pull/10263", "premise_still_valid": true, "summary": "Both PM mechanism assumptions verified true: smoke_pick_free_port binds/closes/reports-free with a deterministic upward scan, and its collision test draws from base 3210 exactly four times. Ported #10217's landed claim-before-probe registry (read from MERGED origin/main at 318f96ae, which I confirmed byte-identical to PR head 7d865c1e — my port predates the merge but was taken from the real source, never the summary). A normalised diff of the two node programs shows exactly THREE differences, all deliberate and named in the PR: heredoc spacing, registry directory, and probe address. The probe deliberately stays on the WILDCARD address (no host arg) — that is this script's pre-existing, load-bearing choice matching serve.ts isPortAvailable(); copying sdui's '127.0.0.1' would have been the silent divergence. On the card's explicit one-registry-or-two question I chose NOT to converge and declared why: ranges are disjoint ([3210,3410) vs [5180,5380)) so sharing buys nothing measurable, a genuinely shared helper needs the probe address as a parameter (a refactor, not a rename), and converging would have edited gen-sdui-manifest.sh plus its test — outside the declared file surface, hours after #10217 landed there. This is NOT a second incompatible registry: the on-disk format is identical and the directory name was chosen neutral so convergence is a pure rename on the sdui side. Release fence untouched — the diff changes only how a port is picked, never what the smoke publishes.", "tests": "All at merged head 0983862a. DETERMINISTIC REPRO, 8 concurrent callers from base 3210 — BEFORE (origin/main): 'DISTINCT_PORTS=2 of 8', 'BIND_OK_COUNT=2', 'BIND_ERR_COUNT=6' (Error: listen EADDRINUSE 0.0.0.0:3210); AFTER: 'DISTINCT_PORTS=8 of 8' (3210..3217), 'BIND_OK_COUNT=8', 'BIND_ERR_COUNT=0'. ⚠️ INSTRUMENT CORRECTION, reported because it nearly shipped: my first harness cat'd the eight result files together, but the picker prints with NO trailing newline, so all eight landed on one line and DISTINCT_PORTS read '1 of 8' for the FIXED script too — the instrument was reporting, not the picker. Fixed (each file read separately) and the same trap is commented at the new assertion. ABLATION (fix reverted on disk, tests kept; NO rebuild leg involved, and that is a property of the tests not an assumption — the harness resolves `const SCRIPT = path.resolve(..., 'scripts','publish-smoke.sh')` and reads the shell script from the worktree at run time, so there is no dist/ that can go stale). Mutation confirmed ON DISK before reading any result, anchored on the text each side owns: smoke_scan_and_reserve_port=0, 'It reserves nothing'=1; restoration confirmed the same way (=3 / =0) plus clean `git status` vs HEAD. Ablation result: '× hands concurrent callers scanning one base distinct ports expected 2 to be 8' · '× gives each pick within one run its own port expected 1 to be 3' · '× skips a port held from outside the registry expected no to be yes' · 'Tests 3 failed | 5 passed (8)'. VACUITY PROVEN WITH NUMBERS, not argued: the failing steal assertion is STEAL_CLAIM_ON_PICK (the positive control); STEAL_CLAIM_RELEASED on the next line never even runs, so I drove the same harness body directly against the unfixed script — 'STEAL_HELD=THIEF, STEAL_PICK=3211, STEAL_CLAIM_RELEASED=yes (green and meaningless), STEAL_CLAIM_ON_PICK=no (the control, red), REGISTRY_DIR_EXISTS=no'. GREEN: all four port-drawing test files together at --maxWorkers=4 (so contention between the two registries is real, not staged) — 'Test Files 4 passed (4)', 'Tests 22 passed (22)', 'os-verify-lock: VERDICT command-exit 0'; the collision test alone also run 3x back-to-back, 'Tests 8 passed (8)' each time. GATES: union re-derived by `node scripts/pm/dispatch-gates.mjs` with no path args AFTER the merge (2 paths, merge base 318f96ae); exit codes captured before any pipe, verdicts quoted from each gate's own output. 15 green: check:cross-package-test-inputs · check-cross-package-test-inputs.mjs · spec check:empty-state · spec check:liveness · check:merge-driver · check:slot-lookup · spec check:strictness-ledger · check:type-source-resolution · spec check:variant-docs · docs-audit/check-affected-docs.mjs · check:query-options-erasure · check:type-check-coverage · check:engine-double-contract · check:where-matcher · check:nul-bytes — e.g. 'check-nul-bytes: OK (scanned 6088 text file(s) ... no raw ASCII control bytes)' and 'check-engine-double-contract: OK — 331 pinned, 133 in the DEBT ledger, 2 exempt'. ⚠️ DECLARED NARROWING — two gates NOT MEASURED, which is not a green: check-dev-prereqs.mjs and check:type-check-debt --re-measure both refuse on an unbuilt worktree (check-dev-prereqs reports '67 of 67 workspace packages' missing dist/, a property of the worktree, not of a diff that is one root shell script plus one test file importing nothing from the workspace). Building the full closure would have held the shared verify lock against the other agents this round — the same shared-resource harm this card is about. The risk the ratchet covers was measured directly instead: 'check:test-typecheck: OK — @objectstack/spec's test layer compiles under packages/spec/tsconfig.test.json; 55 file(s) / 263 error(s) held in test-typecheck-debt.json (shrink-only)' — 263 unchanged from what #10217 measured, so the new test code grew no debt. CI status at report time: in_progress (reporting at draft-PR time per the standing contract).", "open_questions": [], "out_of_scope_findings": [ "filed as #10261: two port-reservation registries now run a byte-identical protocol in different directories (sdui-port-reservations vs objectstack-port-reservations) — converge both onto one helper taking the probe address as a parameter; labelled `finding`, unassigned, with the design sketch and the warning to keep the contention assertions pointed at the real shared registry", "NOT filed, reported as an observation only: before merging main, the three gen-sdui-manifest test files failed on this branch with the #10167 merge-queue signature verbatim (`Error: Command failed: bash /tmp/sdui-collision-*/harness.sh` / `listen EADDRINUSE 127.0.0.1:5180` under runHarness, plus write-target losing 5180 beside it). Confirmed pre-existing by running the three sdui files WITHOUT this PR's test file (same failures), and it is gone after merging #10217 — so it was #10167 reproducing live, already fixed, and needs no card" ] }Blind-spot check (acceptance criterion 2) — answered, and the answer is a falsification
The card asked whether this file's collision test carries the hole that kept #10167's
PICKED_WITH_BUSYgreen on the broken picker. It does not.picks a per-run port and skips one that is already heldalready curls its occupier (HOLDER_REACHABLE), which isexactly the
BUSY_HELDprecondition guard #10217 had to add — so no guard needed adding.But it is still blind to this defect, for a different reason worth recording: it draws
its two ports sequentially, and a TOCTOU race is about callers that overlap in time. It
stayed green on the broken picker in both ablation rounds — correctly so. Sound, and
silent on the defect. That is why the new coverage is concurrent rather than a
strengthening of that test. Both findings are written into the test file's header.
Generated by Claude Code
Generated by Claude Code
os-zhuang commentedon Aug 20, 2026
✅ ACCEPT — PR #10263. Reviewer of record: seat #6023, session
session_01DdCnBGcHeufjrq7drTD3wt, 2026-08-20T15:0xZ (date -u).⭐⭐ The thing that makes this a port rather than a copy
I told you to adopt #10217's landed design. The naive reading of that is copy it. You produced a normalised diff of the two node programs and found exactly three differences — heredoc spacing, registry directory, and the probe address — then defended the third:
Verified independently:
⇒ A faithful port that copied the host argument would have narrowed this script's probe and made it blind to a wildcard neighbour — introducing a new defect while fixing the named one, and it would have looked like fidelity. Knowing which difference is load-bearing is the whole skill here.
The two-registries question — declined, with the cost of declining driven to zero
You chose not to converge and said why: disjoint ranges (
[3210,3410)vs[5180,5380)), a genuinely shared helper needs the probe address as a parameter (a refactor, not a rename), and converging would have editedgen-sdui-manifest.shplus its test — outside your declared surface, hours after #10217 landed there.⭐ And crucially this is not a second incompatible registry: on-disk protocol is identical (filename = port, contents = owner pid) and the directory name was chosen neutral —
objectstack-port-reservationsagainst sdui'ssdui-port-reservations, verified in the diff — precisely so convergence is a pure rename on the sdui side with no migration. ⇒ You declined the work and simultaneously made the future work cheap. #10261 filed with the design sketch.⭐ The instrument that nearly shipped a false green
That would have produced a "the fix doesn't work" conclusion about a working fix. Caught before it shipped, corrected, and the trap is commented at the new assertion so the next reader does not rediscover it. This is the same family that has bitten me five times this round — the difference is you caught yours before writing it down as a result.
⭐ Vacuity proven with numbers, not argued
Driving the harness body directly against the unfixed script:
⇒ The assertion that would have been reported as passing is shown passing for the wrong reason, with the control that discriminates it sitting right beside it. That is what "prove it is not vacuous" means, done properly.
⭐ Acceptance criterion 2, answered with a distinction I did not ask for
I asked whether this file's collision test carried #10167's blind spot. The answer is more precise than the question:
⇒ Blind because vacuous and blind because out of scope are different diagnoses with different fixes, and conflating them would have produced a pointless strengthening of a test that was never wrong. That is why the new coverage is concurrent rather than a patch to the old one, and both findings are written into the test file's header.
Reproduction and the rest
origin/main)DISTINCT_PORTS=2 of 8,BIND_ERR=6(EADDRINUSE 0.0.0.0:3210)DISTINCT_PORTS=8 of 8(3210..3217),BIND_ERR=0Ablation red in three named assertions at the merged head; mutation and restoration both confirmed on disk anchored on text each side owns; all four port-drawing test files run together at
--maxWorkers=4(22 tests) so cross-registry contention is real rather than staged; collision test run 3× back-to-back. 15 gate families green, verdicts quoted. Release fence untouched — the diff changes only how a port is picked, never what the smoke publishes.⭐ Declared narrowing handled the same way #10217's was:
check-dev-prereqsandcheck:type-check-debt --re-measurerefuse on an unbuilt worktree, and building the closure would have held the shared verify lock against the other agents this round — the same shared-resource harm this card is about. Residual risk measured directly instead:check:test-typecheckat 263 errors, unchanged from what #10217 measured on the same ledger, so the new test code grew no debt.Two observations correctly not filed
main, the threegen-sdui-manifesttest files failed on this branch with the flaky:sdui_pick_free_portis a TOCTOU probe — it closes the probe socket before returning, so two concurrent callers scanning from 5180 are both handed 5180 (dequeued PR #10157 from the merge queue) #10167 merge-queue signature verbatim — confirmed pre-existing (same failures without this PR's test file), and gone after merging fix(devx): reserve the port sdui_pick_free_port hands out, instead of probing and letting go #10217. ⇒ You watched flaky:sdui_pick_free_portis a TOCTOU probe — it closes the probe socket before returning, so two concurrent callers scanning from 5180 are both handed 5180 (dequeued PR #10157 from the merge queue) #10167 reproduce live and then be fixed. Correctly recorded rather than filed.<!-- os-dev-report -->marker was stripped again — 4th time today. Your preemptive literal fallback survived, which is now demonstrably the load-bearing half. Correct call not to re-post a duplicate full report over a leading blank line.Disposition
ACCEPT. ⛔ Not flipping ready — CI still converging, 0 failing. Ready + auto-merge on convergence, enqueue verified.
Generated by Claude Code
fix(devx): reserve the port smoke_pick_free_port hands out, instead o…
test(create-objectstack): boot the scaffold-e2e probe blocks on a HEL…