Gate the Pi front door bootstrap on resume - #773
Closed
clkao wants to merge 2 commits into
Closed
Conversation
Rewrite the Pi firstActionBlock to direct the worker to load the ensign discipline BEFORE reading the dispatch file, mirroring Claude's Skill(skill="spacedock:ensign") and Codex's $spacedock:ensign bootstrap. The worker is told to run /skill:ensign (Pi's skill-invoke slash command) or fall back to reading skills/ensign/SKILL.md and its references/, then read the dispatch file for the stage-specific assignment. This drops the false claim that the dispatch file itself contains the ensign discipline entry points (the skill is in available_skills but the worker must be told to load it). Also revert the comment-only piSpawnSkill loader-version pin from the prior (wrong-scope) commit; piSpawnSkill="ensign" is unchanged. Add offline guard TestPiFirstActionInvokesEnsignSkill asserting the firstActionBlock contains a skill-load instruction (/skill:ensign or skills/ensign/SKILL.md), does not carry the false claim, and loads the skill before the read-dispatch-file instruction. Update two sibling tests whose body assertions referenced the old firstActionBlock phrase.
clkao
force-pushed
the
spacedock-ensign/gate-pi-frontdoor-bootstrap-on-resume
branch
from
August 27, 2026 21:33
f7c4377 to
cd87ec3
Compare
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.
spacedock pi --resumere-loaded the Spacedock first-officer contract as a fresh start because the Pi front door appendspiBootstrapPrompt("Use $spacedock:first-officer for this whole Pi session.") unconditionally — zerocontainsResumegate, 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 viaresources_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 thelaunchPrompt(piBootstrapPrompt, fd)append inif !containsResume(fd.passthrough), reusing the sharedcontainsResumehelper atfrontdoor.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 suppressespiBootstrapPromptfrom the argv and non-resume passthrough (--model, a task string) keeps it as the last argv token.No extension change (
.pi/extensions/spacedock.ts): theFO_BOOTSTRAP_TEXTinjection is transient (Pi'scontexthook deep-copies, non-destructive) andsession_startfiresreason: "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 --numstatshows onlypi.go(9/1) +pi_frontdoor_test.go(70/0);.pi/extensions/spacedock.tsabsent (pi.go-only).TestVersionAmbiguousMarkersExitZerofails identically on main (pre-existingPI_CODING_AGENTenv marker).Residual (out of scope, follow-up): Pi's
--session <path|id>flag is a resume form not covered by the sharedcontainsResumetoken set.4av