Skip to content

feat(CC-434): extract shared detached-launch lib for gate/dispatch supervisors#356

Merged
screenleon merged 5 commits into
mainfrom
feat/CC-434
Jul 2, 2026
Merged

feat(CC-434): extract shared detached-launch lib for gate/dispatch supervisors#356
screenleon merged 5 commits into
mainfrom
feat/CC-434

Conversation

@screenleon

Copy link
Copy Markdown
Owner

Summary

  • Extracts the byte-identical setsid/nohup + nonce-authenticated sentinel mechanics shared by scripts/dispatch-supervisor.sh and scripts/gate-supervisor.sh into scripts/lib/detached-launch.sh (per CC-433 spike, GREEN verdict).
  • resolve_repo_root stays inline in both supervisors (bootstrap circular dependency); a new fixture test (test-detached-launch.sh) diffs the two marker-comment-delimited blocks to guard against drift.
  • Dispatch-side security preflight (native-arg smuggling guard, adapter/brief/guard checks) and gate-side result-integrity checks are untouched — confirmed zero weakening.
  • Records the poll→notify IPC migration evaluation as CC-435 (someday, conditionally triggered) rather than a committed follow-up — judged not worth the complexity/risk given the current single-waiter usage pattern.

Test plan

  • scripts/test-detached-launch.sh (new, 13 cases) — all pass
  • scripts/test-gate-lifecycle.sh (12 cases) — all pass
  • scripts/test-dispatch-lifecycle.sh (38 cases) — all pass
  • scripts/test-pmctl-gate.sh (17 cases) — all pass
  • scripts/test-pmctl-dispatch.sh (44 cases) — all pass
  • scripts/test-dispatch-record.sh (7 cases) — all pass
  • scripts/test-pmctl-adapter-generate.sh (16 cases) — all pass
  • scripts/lint-scripts.sh — 98 scripts checked, OK
  • pmctl backlog lint — OK
  • scripts/run-all-tests.sh full suite — all green

screenleon and others added 5 commits July 2, 2026 11:17
…pervisors

CC-433 spike judged the sentinel/setsid mechanics in dispatch-supervisor.sh
and gate-supervisor.sh as byte-identical and safely extractable; this lands
scripts/lib/detached-launch.sh with the 7 shared functions, migrates both
supervisors and their pmctl wait/run_detached counterparts to use it, and
adds a fixture test guarding the two inline REPO_ROOT resolution blocks
(kept inline due to a bootstrap circular dependency) against drift.

Also records the poll->notify IPC evaluation as CC-435: judged not worth
the added complexity/risk given the current single-waiter usage pattern,
tracked as a conditionally-triggered someday ticket rather than a committed
follow-up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-launch tests

pr-gate QA blocked on a sleep-based async wait red-line violation in the two
under_setsid test cases. Replace the sleep(0.2)-loop-on-marker-file pattern
with the codebase's established mkfifo blocking-read signal, matching
test-dispatch-lifecycle.sh's _install_fake_codex_blocking idiom.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…isory)

detached_launch_generate_nonce relied on the tr|head pipeline's exit status
to decide whether to fall back to the weaker $RANDOM-based nonce. Under
set -o pipefail (every caller has it), head -c 32 closing its read end
SIGPIPEs tr, so the pipeline always exits non-zero even though the captured
output is fully valid -- silently discarding the intended 32-char
/dev/urandom entropy for the much weaker fallback on every call. Judge
success by captured length instead of exit status, and add a regression
test that asserts the full-entropy path is reached under pipefail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ellcheck)

The test-skill-refine CI job runs raw shellcheck (no -x) over scripts/,
which -- unlike scripts/lint-scripts.sh's local invocation -- doesn't follow
dynamically-sourced libs and flags SC2154 on tmp_root as a hard failure.
Match the existing convention used by test-pmctl-safe.sh and siblings:
explicit `# shellcheck disable=SC1091` above each source line, plus
`# shellcheck disable=SC2154` for tmp_root supplied by the sourced harness.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@screenleon screenleon merged commit a2db151 into main Jul 2, 2026
45 checks passed
@screenleon screenleon deleted the feat/CC-434 branch July 2, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant