fix(tui): lock journey stepper to canonical 5 tasks#449
Open
fix(tui): lock journey stepper to canonical 5 tasks#449
Conversation
… regress or reorder
The progress checklist was driven directly by agent TodoWrite output with
only an exact-label monotonic guard. When the LLM drifted ("Install
Amplitude SDK" vs "Install Amplitude"), renamed a step on retry, or
marked a later step in_progress while an earlier one was still pending,
tasks would un-check themselves and appear out of order.
Canonical 5 are now the source of truth in code (src/lib/canonical-tasks.ts),
pre-populated on RunPhase.Running so the user sees the journey from frame 1.
syncTodos buckets agent output into canonical steps via exact-label then
keyword fallback, applies a per-step monotonic guard, enforces single
in_progress + ordering, and drops unbucketed extras. ActiveForm still
surfaces the agent's latest wording on the correct row.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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.
Summary
syncTodoscouldn't catch any of those.src/lib/canonical-tasks.ts), pre-populated onRunPhase.Runningso the user sees0 done · 5 to gofrom frame 1.syncTodosbuckets each agent TodoWrite into a canonical step (exact-label first, keyword fallback), applies a per-step monotonic guard, enforces single-in-progress + ordering, and drops unbucketed sixth todos. The agent's latestactiveFormstill surfaces on the correct row, so users continue to see real-time progress text like "Installing project dependencies".Why
The contract was enforced only by system-prompt text in
commandments.ts. LLMs drift on long runs and after retries — the user reported seeing "Installing project dependencies" / "Inspecting project" / tracking-events updates appear before "Install Amplitude" started, then watching "Install Amplitude" un-check itself across an agent retry. Code-side enforcement is the only durable fix.Test plan
pnpm test— 2544 passing (5 new), 14 skipped, 0 failingpnpm lint— cleanpnpm build— clean (smoke test passes)pnpm tryagainst a Next.js test app, verify the 5-row list shows from frame 1, labels match canonical wording, activeforms surface during work, "Install Amplitude" stays ✓ across an agent retry.🤖 Generated with Claude Code
Note
Medium Risk
Touches core TUI run-progress aggregation logic (
setRunPhase/syncTodos), changing how agent TodoWrite output maps to UI state; bugs here could misreport progress or active step during runs.Overview
Locks the run progress checklist to a canonical set of 5 steps. Introduces
canonical-tasks.tsas the single source of truth for step labels/order plus abucketTodoToCanonicalStepmatcher (exact label, then keyword fallback) to map drifted agentTodoWriteitems into the right row.Updates the TUI store so entering
RunPhase.Runningpre-populates these five tasks immediately, and rewritessyncTodosto always render exactly five rows, enforce monotonic completion, collapse multiplein_progressstates to a single latest step, auto-complete earlier steps when the agent skips ahead, and drop unbucketed/extra todos while preserving the latest per-stepactiveForm.Adjusts tests to consume
CANONICAL_LABELSand adds/updates store tests to cover seeding, bucketing, drift/rename handling, ordering, and empty/unknown-status behaviors.Reviewed by Cursor Bugbot for commit ab11e94. Bugbot is set up for automated code reviews on this repo. Configure here.