feat: RPC spawn lifecycle/modelFallback params + schedule verb (#83) - #92
Merged
Merged
Conversation
Lifts the SPEC-6-4 §7 deferral — RPC reaches subagent-tool parity for
external consumers. Design: docs/superpowers/specs/2026-08-30-spec-rpc-
lifecycle-schedule-modelfallback.md (Option B approved by RECTOR).
spawn gains:
- lifecycle: with background:true routes through runBackground (replaces
the hardcoded 'default'); WITHOUT background runs as a detached
foreground-semantics lifecycle (mode auto, session lock on the phase
spawn, failed-phase checkpoint aborts, pre-minted runId via the
genRunId override — the asyncRunLifecycle pattern), registered in
lifecycleRuns for panel visibility.
- modelFallback: per-request retry-once on retryable provider failures.
bg leg threads RunBackgroundOpts.modelFallback → RunLifecycleOpts →
the asyncRunLifecycle wrapper (per-request wins over the global
default). fg single-delegate leg retries via the new
retryForegroundOnce helper: fresh runId (the primary's pre-minted id
stays retired — reuse would double-emit run:started) + todoId relink,
mirroring the tool's direct path.
New schedule verb (frozen-surface addition, gated like the other control
verbs): { task, expression, lifecycle?, auto?, isolation?, cwd? } →
{ scheduleId, nextFire }. Schedules run lifecycles only (ScheduleSpec has
no agent field), so spawn's uniform { runId } reply stays unbranched.
scheduler.register throws (invalid expression) surface as E-BAD-PARAMS
with the parser message. No new error codes.
params.schedule on spawn now points at the schedule verb instead of a
generic 'not supported yet'.
…uler guard (review round 1) Review IMPORTANT: the fg lifecycle leg passed skillsOverride: o.skills, silently dropping validated params.skills — the tool's fg lifecycle merges via mergeLifecycleSkills(o.skills, params.skills). Same merge applied; helper now imported from tools/subagent.ts. Review NIT: the schedule callback asserted deps.scheduler! — order-safe today (scheduler wired before the rpc listener), but a reorder would surface 'Cannot read properties of undefined' as E-BAD-PARAMS. Now an explicit actionable guard.
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.
Closes #83. Spec:
docs/superpowers/specs/2026-08-30-spec-rpc-lifecycle-schedule-modelfallback.md(Option B —scheduleas its own verb, approved by RECTOR).What
RPC reaches subagent-tool parity for external consumers — the SPEC-6-4 §7 deferral lifted:
spawngains:lifecycle— withbackground: trueroutes through the bg runner (replaces the hardcoded"default"); without it, a detached foreground-semantics lifecycle run (modeauto, session lock on phase spawns, failed-phase checkpoint aborts, pre-minted runId via thegenRunIdoverride, registered inlifecycleRunsfor panel visibility).modelFallback— per-request retry-once on retryable provider failures, winning over the global default. bg leg:RunBackgroundOpts.modelFallback→RunLifecycleOpts→ the phase-spawn retry wrapper. fg leg: newretryForegroundOncehelper — the retry mints a fresh runId (the primary's pre-minted id stays retired; reuse would double-emitrun:started) and relinks the primary's todo, mirroring the tool's direct path.New
scheduleverb (additive — frozen surface untouched, zero new error codes):{ task, expression, lifecycle?, auto?, isolation?, cwd? }→{ scheduleId, nextFire }ScheduleSpechas noagentfield) — sospawn's uniform{ runId }reply stays unbranched.params.scheduleon spawn now points at this verb.scheduler.registerthrows (invalid expression) surface asE-BAD-PARAMSwith the parser message.Verification
params.skills— now merged viamergeLifecycleSkills, tool parity) + 1 NIT fixed (defensive scheduler guard); frozen-surface byte-identity + validation-before-mint + retry contract all verified