docs(ultra): plan actionable failures
5bdb27b305b69102fb8f43ee1a4ec2ef54cd9570
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: b0c85f10fdd5
bugabingas pi extensions
5bdb27b305b69102fb8f43ee1a4ec2ef54cd9570
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+164 / −0 text lines
new file mode 100644+164 / −0 text lines
# Ultra Actionable Failures Implementation Plan> **For agentic workers:** REQUIRED SUB-SKILL: Use /skill:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.**Goal:** Give outer orchestrators and later linear phases typed, bounded, actionable diagnostics for every dropped Ultra step.**Architecture:** The runner classifies expected failures into a discriminated `RunStepResult`; the engine enriches failures with phase position and item context; interpolation exposes prior failures through `{PHASE.failures}`. The tool returns the same structures externally, while UI formatting stays compact unless expanded.**Tech Stack:** TypeScript, TypeBox, Vitest, Pi extension APIs**Roadmap:** None**Phase:** Single-plan implementation---## Task 1: Typed runner failures**Files:**- Modify: `extensions/ultra/runner.ts`- Modify: `extensions/ultra/__tests__/runner.test.ts`- [ ] **Step 1: Add failing tests**Cover auth, transport, invalid JSON, schema, missing structured output, session creation/prompt exceptions, manual/external abort, attempt counts, model/thinking metadata, and 2,000-character transcript-tail capping.- [ ] **Step 2: Run focused tests to verify RED**```bashmise //extensions/ultra:test -- runner```- [ ] **Step 3: Implement `StepFailure` and discriminated results**Remove top-level `reason`, classify every expected terminal runner failure, catch tool-session exceptions, track manual abort, and retain only a bounded transcript tail.- [ ] **Step 4: Run focused tests to verify GREEN**```bashmise //extensions/ultra:test -- runner```- [ ] **Step 5: Commit**```bashgit add extensions/ultra/runner.ts extensions/ultra/__tests__/runner.test.tsgit commit -m "feat(ultra): classify subagent failures"```## Task 2: Phase failures and interpolation**Files:**- Modify: `extensions/ultra/engine.ts`- Modify: `extensions/ultra/interp.ts`- Modify: `extensions/ultra/__tests__/engine.test.ts`- Modify: `extensions/ultra/__tests__/interp.test.ts`- Modify: other Ultra tests constructing failed `RunStepResult` values- [ ] **Step 1: Add failing interpolation tests**Cover `{PHASE.failures}` in templates, selectors, `where`, unknown phases, and recovery fan-out.- [ ] **Step 2: Add failing engine tests**Cover positional failure records, `phaseFailures`, item/index/agent enrichment, launched and unlaunched aborts, skipped phases, recovery `when`/`over`, and return selection.- [ ] **Step 3: Run focused tests to verify RED**```bashmise //extensions/ultra:test -- interp engine```- [ ] **Step 4: Implement failure context**Add the failures namespace to interpolation, derive `phaseFailures` during normalization, and include it in the final workflow result.- [ ] **Step 5: Update failed-result fixtures**Replace old `reason` fixtures with typed failures without adding compatibility paths.- [ ] **Step 6: Run focused tests to verify GREEN**```bashmise //extensions/ultra:test -- interp engine```- [ ] **Step 7: Commit**```bashgit add extensions/ultragit commit -m "feat(ultra): expose failures to recovery phases"```## Task 3: External result, UI, and authoring contract**Files:**- Modify: `extensions/ultra/wire.ts`- Modify: `extensions/ultra/index.ts`- Modify: `extensions/ultra/README.md`- Modify: `extensions/ultra/skills/authoring-workflows/SKILL.md`- Modify: `extensions/ultra/skills/authoring-workflows/references/spec-format.md`- Modify: `extensions/ultra/__tests__/wire.test.ts`- Modify: `extensions/ultra/__tests__/ui.test.ts`- Modify: `extensions/ultra/__tests__/harness.test.ts`- [ ] **Step 1: Add failing result-format tests**Require collapsed short failure lines, expanded typed diagnostics, and tool JSON containing `phaseFailures`.- [ ] **Step 2: Implement formatting and fallback result shapes**Render structured failures without exposing full transcripts in collapsed mode and update background/error fallback objects.- [ ] **Step 3: Document explicit linear recovery**Document failure fields, `{PHASE.failures}`, `when`/`over` recovery, bounded transcript tails, and the absence of automatic loops/timeouts.- [ ] **Step 4: Run Ultra tests**```bashmise //extensions/ultra:test```- [ ] **Step 5: Commit**```bashgit add extensions/ultragit commit -m "docs(ultra): document linear failure recovery"```## Task 4: Verification**Files:**- No new production files expected- [ ] **Step 1: Run repository gates**```bashmise run checkmise run lintmise run test```- [ ] **Step 2: Run a real recovery workflow**Use a temporary project and inline workflow where one phase deterministically fails structured output and a later phase consumes `{PHASE.failures}`.Assert the recovery agent receives code, retryability, attempts, item, model, and transcript tail, and the outer result contains identical diagnostics.- [ ] **Step 3: Verify infinite runtime remains unchanged**Confirm no timeout setting, timer race, or timeout failure code exists in Ultra runtime files.- [ ] **Step 4: Clean temporary artifacts**Delete only temporary verification files created for this plan.- [ ] **Step 5: Commit only verification-driven corrections**Do not create an empty verification commit.