Bug flow shares the engine
Goal
Run bug plans and /fix-next-bug batches on the shared workflow/context/invocation engine. Direct bugs may own roots; nested bugs are child frames; bug close/archive becomes a root finalization intent when folded.
Self-hosting constraint
Run on the new engine. Include bug-flow scenarios in the verified inventory; re-sync current fix-bug runtime first.
Implementation sketch
- Re-verify
/fix-bugphase mechanics against the running code: RCA gate, close-flip, parity/leak-via-shared-technical-mission — emitdecisions/11-fixbug-phase-audit.md. - Wire
bug.jsonwith a fixed reconcile entry over the bug plan/tracker APIs, then reusework_item.json/section.json/ledger_grind.jsonwith bug-specific gates layered on (rca_proven,close_flip_bug). Tracker/plan state selects the semantic phase; a frame cursor only resumes an unresolved effect. - Reuse shared plan-start prep and
bug.detour_will_resumemapping; preserve origin frame capability + resume obligations across nested bug detours. - Confirm parity/leak (L9/L10) come via the SHARED technical-mission gate (sec 4), NOT a bug-specific path.
- Use the same ContextSnapshot selectors and Reminder lifecycle; represent bug-specific guidance as mapping data.
- Use capability push/typed return for plan-to-bug and bug-to-origin transitions; preserve root and origin resume obligations.
- Implement fix interference as data: classify failure disposition, persist ShelvedReceipt, invoke/reuse tracked blocker or add-bug child, then resume the exact origin and rerun proof. Never use an edited implementation note as control state.
- On proof/test failure, run known-blocker matching before any LLM call. If judgment remains, dispatch a read-only failure-classifier prompt with mandatory interference reminder and closed disposition output; scripts route its result.
- Canonicalize raw failure evidence through versioned FailureEvidenceFingerprint before retry/classification limits; use
classify_failure, generic invoke with atomicshelve_originon-push, andresume_shelved_originas the closed primitives. - Restore shelved origin on every fix-child error/cancel/abandon path before recovery; transfer surviving obligations and forbid stranded ShelvedReceipt state.
- On accepted fix-child return, consume the ShelvedReceipt and clear suspension/ownership before stale-proof invalidation and exact-target resume.
- Carry origin phase and symbolic target through FailureContext and ShelvedReceipt; never hardcode post-work proof as the resume target for pre-work or dispatch failures.
- Merge deterministic/LLM/human classification into one normalized FailureContext shape; tracked disposition and untracked add-bug return populate the same blocker_bug_id field.
- Derive bug-register and bug-fix child capabilities from root authority during generic invocation push; FailureContext carries no authority token.
- Append DEAD attempt evidence only after
active_attempt_regression; blocker/environment/human dispositions do not mutate attempt selection.
Spec references
- plans/workflow-engine-rework/spec/workflow-state-machines.md sec 9 (bugs are plans + the REQUIRED verification). Research: bug template slugs grounded; fix-bug phase mechanics must be re-verified against the running runtime.
Test strategy / acceptance
Matrix: feature/bug x root/child x active-regression/tracked/untracked/transient blocker x push/return/resume/crash. Pins: every bug entry reconciles from bug-plan/tracker state; unbound frame state rejects; one engine/selector; exact origin resumes; duplicate/cyclic blocker rejects; no prose-selected route.
Work Items
- Re-verify
/fix-bugphase mechanics vs running code; emitdecisions/11-fixbug-phase-audit.md -
bug.jsonenters through fixed bug-plan/tracker-derived reconcile, then reuses work_item/section/ledger_grind workflows with bug-specific gates layered on - Bug-specific gates:
rca_proven(RCA-before-fix) +close_flip_bug(open->closed + delivered_to_roadmap) - Confirm L9/L10 come via the shared technical-mission gate, not a bug-specific path
- Prove feature and bug plans use the same reminder catalog, resolver, envelope contract, and persistence lifecycle with bug-specific differences represented only as mapping data
- Implement the bug-domain adapter for the canonical virtual-batch loop; direct invocation owns a virtual root and nested invocation owns a batch frame
- Implement the bug-domain adapter for the canonical virtual-batch loop: a directly invoked bug fix (/fix-bug BUG-XX-NNN) owns its own bug-plan-backed root — the bug plan is its domain artifact and remains the sole authoritative workflow state, never root-store-owned; a /fix-next-bug batch invocation (no synthetic plan) owns the virtual-batch root under the mission’s no-domain-artifact exception, and each bug the batch selects becomes a bug-plan-backed batch frame nested under that virtual root, never itself root-store-owned.
- Map canonical typed batch dispositions to bug-domain dependency, ownership, skip, pause, fixed, and OBE semantics without defining another selector
- Add accepted_pending_root_close projection so the owning parent resumes, queue reselection excludes the accepted bug, foreign roots see ownership, and tracker/archive finalization remains root-only
- Batch-finalize accepted bug tracker flips, delivered_to_roadmap propagation, and plan archives under one root write-ahead journal with forward recovery from every partial mutation
- Implement stable failure fingerprinting and fix-interference routing through classify, generic child invoke with atomic shelve-on-push, folded return, and exact-origin proof resume
Intel dossier — pointer and tier disposition
Dossier: bug-flow-shared-engine--s-0128e846.intel.md (this section’s content/intel/ sidecar)
Read that dossier from line 1 through EOF before acting on this section. This block is a pointer and an audit record, never a substitute: not the BLUF, not a summary, not selected tiers.
| Dossier tier | Title | Lines | Disposition | Where / why |
|---|---|---|---|---|
| 0 | 0. Bottom line up front | 21 | pending | |
| 1 | 1. The target, verbatim | 22 | pending | |
| 2 | 2. Terrain — the shipped surface | 64 | pending | |
| 3 | 3. Code-graph recon | 104 | pending | |
| 3S | 3S. Defect-class sweep — gates whose blindness reads as a pass | 111 | pending | |
| 3D | 3D. Diagnostic / observability surface | 24 | pending | |
| 3H | 3H. Hygiene constraints the downstream work inherits | 27 | pending | |
| 4 | 4. Cluster / family — the sibling sections, quoted | 53 | pending | |
| 5 | 5. Conformance audit | 22 | pending | |
| 6 | 6. Plan ownership | 27 | pending | |
| 7 | 7. Prior art — interrogated, and mostly refuted | 24 | pending | |
| 8 | 8. Sentiment | 12 | pending | |
| 9 | 9. Declared coverage gaps | 38 | pending | |
| 10 | 10. Recon entry points — the ordered read path | 21 | pending |