Skip to content

feat: add native plan decisions to the TUI - #72

Closed
jefft72 wants to merge 3 commits into
stack/native-plan-09-output-modesfrom
stack/native-plan-10-tui-workflow
Closed

jefft72 wants to merge 3 commits into
stack/native-plan-09-output-modesfrom
stack/native-plan-10-tui-workflow

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the native plan review and acceptance workflow to the interactive TUI, including visible plan artifacts, mode status, pending-plan actions, accepted-plan handoff, retry behavior, and lifecycle-aware restoration after navigation or session replacement.
The change also replaces independent editor-replacement paths with one cancellable ownership model so delayed selectors, authentication flows, extension surfaces, sharing progress, and plan handoffs cannot restore stale focus over a newer interface.

Reasoning

Plan submission is not just another assistant message because the user must review a durable artifact and choose to implement it, continue planning, or discard it before ordinary prompting resumes.
Startup prompts, restored continuations, navigation, and runtime rebinds must respect that decision boundary instead of automatically sending input or losing the accepted implementation.

The TUI has several asynchronous features that replace the editor and later attempt to restore it.
Without a single ownership token, an older completion can clear a newer selector or loader, while the accepted-plan runtime handoff specifically needs exclusive ownership to survive the session rebind until prompt preflight succeeds.

Changes

  • Adds a first-class plan transcript component that sanitizes the title, renders Markdown with the configured theme and extension transformers, and preserves ordered-list markers and backslash escapes in both live and restored sessions.
  • Prefixes the footer with [plan] within the existing width budget and extends the session tree to render, search, preview, and copy plans while hiding mode and resolution bookkeeping in default and no-tools views.
  • Implements /plan [on|off] with completions, toggle semantics, explicit retry for accepted continuations, explicit reopening for pending decisions, confirmation before discarding a pending plan, and clear status or usage errors.
  • Presents Implement, Keep planning, and Discard actions only when the session is idle and no editor surface or overlay owns the UI, and suppresses automatic reopening after the user chooses to keep planning until /plan is invoked.
  • Starts accepted implementation behind a non-cancellable exclusive loader, preserves that owner across runtime session rebind, releases input only after successful prompt preflight, and leaves a durable retry path when routing or implementation startup fails.
  • Preserves startup prompts in the editor when a plan or continuation is already pending, stops dispatching remaining startup messages when a new plan is submitted, and warns that startup images must be reattached after the plan decision.
  • Introduces token-based mount, replace, close, and cancel operations for every editor-replacing surface so only the current owner can restore focus, with explicit exclusive and preserve-on-rebind policies for sensitive handoffs.
  • Migrates extension selectors, inputs, multiline editors, custom components, standard selectors, overlays, authentication dialogs, and share progress to the ownership model with idempotent disposal and cancellation behavior.
  • Combines dialog, prompt, and ownership abort signals for authentication, verifies the originating session before applying completion, and prevents replaced login or share operations from reclaiming the editor or reporting stale success.
  • Reopens pending decisions at safe boundaries after normal prompts, streaming steering, tree navigation, and session rebind, and renders collaboration, submission, and resolution events without duplicating restored plan artifacts.

Testing

  • Validation ran on the final rebased stack: npm run check passed.
  • Validation ran on the final rebased stack: the focused Vitest run across 28 affected files passed all 451 tests.
  • This intermediate branch was reconstructed as part of the stack and was not checked independently after reconstruction.

@jefft72 jefft72 added enhancement New feature or request UI coding-agent labels Aug 16, 2026
@jefft72 jefft72 self-assigned this Aug 16, 2026
@Issacboy123
Issacboy123 force-pushed the stack/native-plan-10-tui-workflow branch from 2d15d03 to cd85158 Compare August 16, 2026 03:14
Give every editor-replacing surface a single cancellable owner so selectors, extension inputs, custom editors, and overlays cannot restore stale focus. Preserve exclusive owners through controlled teardown and cover the custom UI regression.
Route plan decisions, authentication dialogs, and share progress through cancellable editor ownership. Preserve accepted continuation handoff state so delayed asynchronous completions cannot reclaim or corrupt the active interface.
Render submitted plans as transcript artifacts, expose plan state in footer and tree views, and reopen decisions only at safe interactive lifecycle boundaries. Preserve startup prompts and restored continuations across navigation and session rebinds.
@Pepps233
Pepps233 force-pushed the stack/native-plan-10-tui-workflow branch from cd85158 to 6e0ab8e Compare August 16, 2026 04:18
@jefft72

jefft72 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing to rebuild on a clean base.

This stack does not build. Two separate defects are present, and the first masks the second:

  1. A stray closing brace committed in feat: enforce native plan collaboration policy #64 stops packages/coding-agent/src/core/agent-session.ts from parsing at all.
  2. From feat: activate accepted plans in routed sessions #65 onward the stack imports five modules that exist only on the task profile stack: evolved.ts, harness-descriptors.ts, profile-router.ts, profiles.ts, and runtime-telemetry.ts.

Replacement stacks:

  • plan/* for native plan mode standing alone on main
  • plan-harness/* for the plan and profile integration

The branch behind this PR is retained unchanged as a backup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coding-agent enhancement New feature or request UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant