Skip to content

feat: RPC spawn lifecycle/modelFallback params + schedule verb (#83) - #92

Merged
rz1989s merged 2 commits into
mainfrom
feat/83-rpc-lifecycle-schedule-modelfallback
Aug 30, 2026
Merged

rz1989s merged 2 commits into
mainfrom
feat/83-rpc-lifecycle-schedule-modelfallback

Conversation

@rz1989s

@rz1989s rz1989s commented Aug 30, 2026

Copy link
Copy Markdown
Member

Closes #83. Spec: docs/superpowers/specs/2026-08-30-spec-rpc-lifecycle-schedule-modelfallback.md (Option B — schedule as its own verb, approved by RECTOR).

What

RPC reaches subagent-tool parity for external consumers — the SPEC-6-4 §7 deferral lifted:

spawn gains:

  • lifecycle — with background: true routes through the bg runner (replaces the hardcoded "default"); without it, a detached foreground-semantics lifecycle run (mode auto, session lock on phase spawns, failed-phase checkpoint aborts, pre-minted runId via the genRunId override, registered in lifecycleRuns for panel visibility).
  • modelFallback — per-request retry-once on retryable provider failures, winning over the global default. bg leg: RunBackgroundOpts.modelFallbackRunLifecycleOpts → the phase-spawn retry wrapper. fg leg: new retryForegroundOnce helper — the retry mints a fresh runId (the primary's pre-minted id stays retired; reuse would double-emit run:started) and relinks the primary's todo, mirroring the tool's direct path.

New schedule verb (additive — frozen surface untouched, zero new error codes):

  • { 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. params.schedule on spawn now points at this verb.
  • Gated with the other control verbs; scheduler.register throws (invalid expression) surface as E-BAD-PARAMS with the parser message.

Verification

  • 799/799 tests (+11: schedule verb 4, spawn param validation 1, retryForegroundOnce 5, modelFallback forwarding 1), typecheck clean
  • Review round 1: 1 IMPORTANT (lifecycle leg dropped validated params.skills — now merged via mergeLifecycleSkills, tool parity) + 1 NIT fixed (defensive scheduler guard); frozen-surface byte-identity + validation-before-mint + retry contract all verified

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.
@rz1989s
rz1989s merged commit bf3160f into main Aug 30, 2026
1 check passed
@rz1989s
rz1989s deleted the feat/83-rpc-lifecycle-schedule-modelfallback branch August 30, 2026 07:52
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.

RPC spawn: lifecycle/schedule/modelFallback params (SPEC-6-4 deferral)

1 participant