feat(spec-5a): operational runtime — async/bg + scheduling + git-worktree isolation - #6
Merged
Merged
Conversation
…tree isolation) Brainstorm output (9 Q&A, locked: Q1=B Q2=A Q3=A Q4=A Q5=A Q6=C Q7=A Q8=A Q9=A). Layer above the unchanged SPEC-1..4 engine seam: async/bg runs on isolated git worktrees (per-lifecycle, foreground unchanged), cron/interval/one-shot scheduling (session-scoped, PID-locked, in-process), JSONL run journal + auto-resume after crash, worktree-diff artifact discovery (replaces the prompt-baked Artifacts block for isolated runs), results inbox + fleet.results() auto-delivery, /fleet scheduled tab + bg row status. Vendored cron-parser (MIT) + greenfield worktree service. Targets v0.5.0.
…g + scheduling) 15 tasks: WorktreeService, DiffService, RunJournal, ConcurrencyPool, ResultsInbox, vendor cron-parser + expressions, PidLock, Scheduler, AsyncRunner, Resume, subagent background/schedule params, fleet.results tool, /fleet scheduled tab + bg row status, index wiring + resume-on-init, end-to-end smoke + TUI checklist. Self-reviewed (spec coverage, placeholders, type consistency — one cross-task amendment flagged: WorktreeService.pathFor public exposure).
…ivery queue + bounded hint)
…xpressions (cron/interval/once)
…le + inbox + notify)
… + scheduling routing)
…it + fleet.results tool
…overy) + clean up completed-run worktrees Code-review findings (self-review before merge): - Important: Q3=A was not realized — DiffService was in AsyncRunnerDeps but never called; isolated runs used the same parseArtifacts path as foreground. Added an optional artifactDiscovery hook to LifecycleRunDeps + worktreePath/baseRef to LifecycleRunOpts (additive — foreground unchanged). The index.ts async adapter now wires DiffService.diffPhase as the discovery fn for isolated runs. +2 tests (hook used when worktreePath set; NOT used for foreground). - Important: completed runs leaked the worktree dir (.pi/fleet/worktrees/<runId> accumulated). Added WorktreeService.removeWorktree (git worktree remove, KEEPS the branch for merge/inspection); the async runner calls it on completion. +1 test (worktree dir gone, branch kept). - Minor: dropped unused existsSync import in async-runner.ts.
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.
SPEC-5a — Operational runtime
The 6th of 9 pipeline phases (PRD + research + SPEC-1..4 done; this PR → v0.5.0). Layers three capabilities above the unchanged SPEC-1..4 engine seam (
ChildSessionFactory/BackendRegistry/runLifecycle— untouched):Foreground sync subagent (v0.1..0.4) is unchanged — zero breaking change.
Brainstorm → spec → plan → implement (full cycle)
specs/SPEC-5a-operational-runtime.mdplans/SPEC-5a-operational-runtime.mdWhat's in it
src/worktree/— WorktreeService (git worktree create/remove) + DiffService (worktree-diff artifact discovery: tracked + untracked)src/runtime/— RunJournal (JSONL append/replay/partial-line-skip/scan) + ConcurrencyPool (N-slot semaphore, default 3) + ResultsInbox (delivery queue + bounded hint) + AsyncRunner (the bg path) + resume (scan non-terminal journals)src/scheduling/— expressions (cron/interval/one-shot) + PidLock (session-scoped firing ownership + stale reclaim) + Scheduler (in-process firing)src/vendor/cron-parser/(vendored MIT, v1.1.1 dep-free — see deviation note) + NOTICE.mdsrc/tools/subagent.ts— background + schedule params (routing)src/tools/fleet-results.ts— fleet.results({ runId? }) toolsrc/panel/fleet-panel.ts+ rows.ts — new scheduled tab + bg row status icons (▶ ⏸ ✓ ✗ ⏳ ●phase n/total)src/index.ts— async runner + scheduler + resume-on-init + fleet.results tool wiringscripts/spec-5a-smoke.mts+docs/SPEC-5a-smoke-checklist.md— manual end-to-end + TUI smokeGate
pnpm typecheck— cleanpnpm test:run— 227/227 pass (was 172 at branch start; +55 SPEC-5a tests)Deviations from the plan (recorded)
Design decisions (locked, do not re-litigate)
Deferred (recorded with landing SPEC)
Release
After merge: bump to 0.5.0 on main + tag v0.5.0 → release.yml publishes @getpipher/armory-fleet@0.5.0 (mirrors v0.3.0/v0.4.0). Then the term-driven TUI smoke (docs/SPEC-5a-smoke-checklist.md).