Repository navigation
feat(showcase): fix --isolate slot picker (pinning, port probe, slot 0 reservation, bin/showcase slots) - #5543
Merged
Merged
Conversation
… probe, and slot 0 reservation - Centralize ISOLATE_MAX_SLOT=45 constant - Add helpers: _slot_offset_ports, _slot_liveness, _slot_ports_free, _slot_state - Rewrite _claim_isolate_slot to reserve slot 0, honor SHOWCASE_ISO_SLOT, port-probe via lsof - Document benign mkdir/rmdir race in auto-pick path - Shift dashboard host port 3200 → 3210 in apply_isolation / restore_isolation - Pass slot entry path + project to _reap_isolate_slot in pinned-path retry - _slot_state reports offset=0 for the base stack (slot 0) - _slot_state degrades gracefully to ports=? when lsof is missing
- docker-compose.local.yml: host port mapping - harness/src/cli/doctor.ts: dashboard probe - harness/src/cli/lifecycle.ts: dashboard URL - harness/src/cli/config.ts: default port - harness/src/cli/control-plane-run.test.ts: test expectations
…command, and lsof-graceful inspector - Update 12 slot-0-assumption tests for slot-0 reservation contract - Add lsof stub and foundation smoke for isolate.bats - Tests #1-#3: slot pinning behavior - Tests #4-#7: port-probe and stale-reap behavior - Tests #8-#10: slot state, slots subcommand, concurrent claim - New test for _slot_state ports=? when lsof unavailable
…n in TESTING.md - Update items 8/9 for slot pinning and conflict detection - Correct item 8/9 column names to match bin/showcase slots header
jpr5
requested review from
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
June 18, 2026 17:03
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Contributor
Production Digest-Pinning Audit12 of 41 service(s) not digest-pinned.
Run 2026-06-18 10:04:31 PDT — 12 finding(s). |
6 tasks done
jpr5
added a commit
that referenced
this pull request
Jun 18, 2026
…_ISO_SLOT (#5547) ## Summary Follow-up to #5543. Adds `--isolate=<N>` CLI form so users don't need to set `SHOWCASE_ISO_SLOT=<N>` as an env var prefix. ## Before ``` SHOWCASE_ISO_SLOT=9 bin/showcase test agno --d5 --isolate ``` ## After (both forms work) ``` bin/showcase test agno --d5 --isolate=9 # OR SHOWCASE_ISO_SLOT=9 bin/showcase test agno --d5 --isolate ``` ## Implementation ~10 lines in `showcase/scripts/cli/cmd-test.sh` arg parser: a new `--isolate=*` case sets `use_isolate=true` and exports `SHOWCASE_ISO_SLOT=<N>`. The existing picker (`_claim_isolate_slot` in `_common.sh`) handles all validation, slot-0 rejection, port-probe, liveness, etc. — no logic duplication. Help text in `cmd-test.sh` and the existing `SHOWCASE_ISO_SLOT` references in `showcase/TESTING.md` now show both forms as equivalent. ## Tests Four new bats tests in `showcase/scripts/__tests__/isolate.bats`: - `--isolate=<N> arg form exports SHOWCASE_ISO_SLOT and pins the slot through the picker` — replays the parser branch, verifies env export + picker pinning. - `--isolate=0 arg form drives the picker's reserved-slot rejection` — proves `--isolate=0` flows through the same `slot 0 is reserved` die as the env-var form. - `--isolate=99 arg form drives the picker's out-of-range rejection` — proves `--isolate=99` flows through the same `exceeds ISOLATE_MAX_SLOT=45` die as the env-var form. - `cmd-test.sh --isolate=<N> actually wires the arg through to SHOWCASE_ISO_SLOT` — drift guard that sources the REAL `cmd-test.sh`, stubs `apply_isolation`, and snapshots `SHOWCASE_ISO_SLOT` to catch any future regression of the parser branch. All 58 bats tests in `isolate.bats` pass locally (54 pre-existing + 4 new). ## Docs `showcase/TESTING.md` items 8 and 9 updated to show both forms. Repo-wide grep confirmed TESTING.md is the only doc that references `SHOWCASE_ISO_SLOT`. ## Test plan - [x] `bats showcase/scripts/__tests__/isolate.bats` → 58/58 green - [x] `--isolate=9` → `SHOWCASE_ISO_SLOT` exported, slot 9 claimed - [x] `--isolate=0` → picker dies "slot 0 is reserved" - [x] `--isolate=99` → picker dies "exceeds ISOLATE_MAX_SLOT=45" - [x] `shellcheck showcase/scripts/cli/cmd-test.sh` → no new warnings (only the pre-existing SC2034 on `CMD_TEST_DESC`, consumed by dispatcher parallel arrays) - [x] `oxfmt --check showcase/` → clean
This branch was successfully deployed
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
--isolateslot picker inshowcase/scripts/cli/_common.shand adds a newbin/showcase slotsinspector subcommand. Resolves five compounding bugs that made multi-agent local testing unreliable.Bugs fixed
SHOWCASE_ISO_SLOT=<N>env var was ignored. The picker walked 0→N regardless. Now: validates input (positive integer,1 ≤ N ≤ 45, slot 0 rejected as base stack), tries exactly that slot, fails loudly on conflict.mkdir'd a slot dir without checking whether the slot's host ports were free. A slot whose dir was absent but whose ports were taken (foreign Docker project, host service like macOS AirPlay on 5000) was picked then failed atdocker compose up. Now:lsof-probe every candidate port before committing the claim; rmdir + try next on conflict.3200+ slot 8 offset+1800=5000, permanently bound by macOS Control Center's AirPlay Receiver. Shifted dashboard base port3200 → 3210acrossdocker-compose.local.ymlandshowcase/harness/src/cli/*.tsso slot 8 → port5010(free)._slot_statereturns all 4 axes (dir/pid/liveness/ports/offset/project); newbin/showcase slotsexposes the state via table /--json/--free --brieffilters.mkdirlock self-resolves contention.Implementation
_common.sh:_slot_offset_ports,_slot_liveness(extracted from sweeper),_slot_ports_free(with own-project docker-listener filter),_slot_state(composite axis report)._claim_isolate_slot: pinned-path (validate / try / die loudly) and auto-pick-path (1..MAX_SLOT, rmdir + skip on port-held). Slot 0 reserved with explicit die message.ISOLATE_MAX_SLOT=45centralized as a constant.3200 → 3210across 6 files (compose + 4 harness TS + comment updates).cmd-slots.shplugin (auto-discovered bybin/showcase): default table,--json(JSONL),--free(filter to claimable slots),--brief(numeric IDs only).Tests
Bats — 54/54 GREEN in
showcase/scripts/__tests__/isolate.bats:_slot_offset_ports 8 → 5010 ≠ 5000, foreign-process skip, own-project no-skip)_slot_state5 axes,bin/showcase slotsoutput, concurrent claim distinct slots)_slot_state emits ports=? when lsof is unavailableVitest — 17/17 GREEN in
showcase/harness/src/cli/control-plane-run.test.ts(port-shift stub consistency).Value-test (live local, plan §6 scenarios) — all 3 PASS:
SHOWCASE_ISO_SLOT=9with per-port diagnostics (proving the fail-loud half of the contract). Re-ran withSHOWCASE_ISO_SLOT=15(first free slot) and the pin was honored cleanly:ISOLATE_SLOT=15,OFFSET=3200. Both halves of the pin contract verified.127.0.0.1:5010(slot 8's dashboard port) → picker logged "Slot N ports held" + "trying next" for each conflict, walked past 9..13 (Docker-held), and landed on slot 14 withOFFSET=3000. No silent collision.bin/showcase slotsmatches reality: slot 0 →OFFSET=+0 PROJECT=showcase (base); pre-claimed slot 5 →DIR=present PID=<pid> LIVE=live PORTS=held OFFSET=+1200 PROJECT=showcase-iso5-test.--free --briefoutputs only fully-claimable slot IDs (44 in this run, slot 5 excluded).Code review
Full 7-agent cr-loop with
pr-review-toolkitreviewers (Round 1 + confirmation round). 4 subject-scope load-bearing findings fixed:_reap_isolate_slotarg shape in pinned-path retry_slot_statebase-stack offset (slot 0 →+0, not+200)SLOT DIR PID LIVE PORTS OFFSET PROJECTheader)bin/showcase slotslsof-graceful degradation (inspector reportsPORTS=?instead of dying whenlsofis missing)Plus 1 trivial comment-phrasing fix (race-comment wording). ~50 pre-existing harness/compose findings partitioned out-of-subject and deferred to follow-up PRs (see below). Procedure 3 bucket-(c) promotion audit returned zero PROMOTE_TO_A items — full convergence.
Follow-up PRs (out-of-subject, separate subjects)
These coherent subjects surfaced during CR but belong to distinct PRs (the diff merely brushed against them for the
3200→3210shift):up()/doctorshould health-checkharness-control-plane(port 8081)._slot_offset_portsincludes 8081;INFRA_PORTSindoctor.ts/lifecycle.tsdoes not.doctor.tsport + image diagnostic loud-failure pass (checkStaleImages,checkPorts,isPortListening,checkDepotInterceptionswallow errors).lifecycle.tserror-surfacing pass (broad catches inloadPortsFile,isRunning,compose,healthCheck,diffLogs, etc.).docker-compose.local.ymlhealthcheck error visibility (.catch(() => process.exit(1))swallows; dashboard/returns 307).apply_isolationPython rewriter fail-loud pass (nore.subncount checks, hand-rolled YAML demos parser).lifecycle.ts:11-13staleops/path comment (file lives atharness/).cmd_slots --jsonpidfield typing (string vs number) — settle when first JSON consumer appears.Test plan
bats showcase/scripts/__tests__/isolate.bats→ 54/0pnpm vitest run src/cli/control-plane-run.test.ts(inshowcase/harness/) → 17/0pnpm exec tsc --noEmit(inshowcase/harness/) → cleanoxfmt --check showcase/→ cleandocker compose -f showcase/docker-compose.local.yml config→ valid YAML