Skip to content

Gate the Pi front door bootstrap on resume - #770

Closed
clkao wants to merge 3 commits into
mainfrom
spacedock-ensign/gate-pi-frontdoor-bootstrap-on-resume
Closed

Gate the Pi front door bootstrap on resume#770
clkao wants to merge 3 commits into
mainfrom
spacedock-ensign/gate-pi-frontdoor-bootstrap-on-resume

Conversation

@clkao

@clkao clkao commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

spacedock pi --resume re-loaded the Spacedock first-officer contract as a fresh start because the Pi front door appends piBootstrapPrompt ("Use $spacedock:first-officer for this whole Pi session.") unconditionally — zero containsResume gate, unlike the Claude/Codex front door (frontdoor.go:428,447) which suppresses its bootstrap prompt on --resume/-r/--continue/-c. A resume carries its own session intent and the FO contract survives in the system prompt via resources_discover, so re-injecting the prompt tells the resumed session to load the contract as if starting fresh.

Stacked on #764 (embed-stage-report-protocol-in-dispatch); merge #764 first.

What changed

  • internal/cli/pi.go: wrapped the launchPrompt(piBootstrapPrompt, fd) append in if !containsResume(fd.passthrough), reusing the shared containsResume helper at frontdoor.go:553 (the same one Claude/Codex use) — no new token set. Covers --resume, --resume=<id>, -r, --continue, -c.
  • internal/cli/pi_frontdoor_test.go (new): TestPiResumeSuppressesBootstrapPrompt — table-driven, asserts each resume token suppresses piBootstrapPrompt from the argv and non-resume passthrough (--model, a task string) keeps it as the last argv token.

No extension change (.pi/extensions/spacedock.ts): the FO_BOOTSTRAP_TEXT injection is transient (Pi's context hook deep-copies, non-destructive) and session_start fires reason: "startup" on CLI launch so it can't detect CLI resume anyway.

Evidence

  • go test ./internal/cli/ -run TestPiResumeSuppressesBootstrapPrompt -v — 7/7 subtests PASS (5 resume tokens suppress, 2 non-resume keep the prompt).
  • git diff --numstat shows only pi.go (9/1) + pi_frontdoor_test.go (70/0); .pi/extensions/spacedock.ts absent (pi.go-only).
  • gofmt/go vet/-race clean. TestVersionAmbiguousMarkersExitZero fails identically on main (pre-existing PI_CODING_AGENT env marker).

Residual (out of scope, follow-up): Pi's --session <path|id> flag is a resume form not covered by the shared containsResume token set.


4av

clkao added 3 commits August 26, 2026 09:16
Pi-dispatched ensigns missed the stage report on real dispatches because
skill="ensign" is discoverable, not auto-loaded, and the dispatch body
carried no stage-report format. build.go step 8 now emits a
### Stage Report format block (the ## Stage Report: {stage} heading +
DONE/SKIPPED/FAILED/Summary structure, sourced from
ensign-shared-core.md) conditional on host=="pi", and the Pi firstActionBlock
is narrowed from the full ensign discipline overclaim to the stage-report
format template only (the ensign skill supplies the rest).

AC-2: a fixture test in internal/dispatch builds an artifact with a
non-self-describing checklist for host=pi and asserts the body carries
## Stage Report:, - DONE:, - SKIPPED:, - FAILED:, ### Summary; the same
test asserts host=claude and host=codex do NOT carry the embedded block.

AC-1/AC-3: a non-self-describing live-lane variant in internal/ensigncycle
dispatches a Pi worker with a checklist equal to a real entity's acceptance
criteria (no skill-path, heading, or format hints) and asserts the worker
still writes a complete ## Stage Report: implementation with a clean
state-checkout commit. An offline build guard asserts the body carries the
protocol while the checklist stdin carries no format hint. Reverting the
body embed makes the Pi fixture and the offline guard RED (claude/codex stay
green) — the tautology the existing self-describing lanes could not close.

Registry: register the pi-non-self-describing-dispatch runtime proof and its
pi/non-self-describing-smoke fixture.
…oor-smoke step

AC-1 (a Pi-dispatched ensign writes a complete stage report on a real,
non-self-describing dispatch) was only proven offline / by the adversarial
revert; no CI step's -run filter selected TestLivePiNonSelfDescribingDispatch
(the front-door-smoke step ran TestLivePiFrontDoorSmoke, the common-journeys
step ran ^TestLiveCommon). Extend the front-door-smoke step's -run to
'TestLivePiFrontDoorSmoke|TestLivePiNonSelfDescribingDispatch' so AC-1 is
auto-proven in CI on every pi-live cadence and PR, reusing the shared front-
door fixture infra. CI-wiring only — no test or production code changed.
@clkao
clkao changed the base branch from spacedock-ensign/embed-stage-report-protocol-in-dispatch to main August 27, 2026 06:26
@clkao clkao closed this Aug 27, 2026
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