Skip to content

feat: preserve task context during plan handoff - #73

Closed
jefft72 wants to merge 3 commits into
stack/native-plan-10-tui-workflowfrom
stack/native-plan-11-profile-context
Closed

jefft72 wants to merge 3 commits into
stack/native-plan-10-tui-workflowfrom
stack/native-plan-11-profile-context

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserves the active task identity throughout native plan implementation handoffs by keeping the current profile, routing mode, and harness visible above both the built-in footer and extension-provided footers.
It also adds the interactive resolution path for an accepted plan whose implementation route is ambiguous, presenting the candidate profiles with their expertise, safeguards, and tool-policy consequences before execution starts.

Reasoning

Accepted plans can survive navigation and session rebinds and can activate a different profile or harness for implementation, so the TUI needs to derive task context from current runtime state on every render instead of leaving users with stale or hidden routing information.
Profile and harness labels can originate outside the core UI, which also makes terminal-sequence stripping, control-character removal, and width-aware truncation part of the display contract rather than a cosmetic detail.

An ambiguous implementation route can change the model's domain instructions, safety constraints, and available tools.
The chooser therefore needs to explain those consequences while preserving exclusive editor ownership, settling exactly against the active handoff, and leaving the accepted continuation retryable when the user cancels.

Changes

  • Adds a dedicated task-context footer component that reads the active profile, automatic or pinned routing mode, harness, and plan status from live session and runtime state on every render.
  • Keeps task context mounted above extension-provided footers, updates its session reference during rebinds, and separates it from the model, thinking-level, and context-window statistics line.
  • Allocates narrow-terminal width between profile and harness values so both remain identifiable, truncates oversized values without exceeding the viewport, and falls back cleanly when no harness is selected.
  • Strips ANSI, OSC, and control sequences from profile names, harness names, routing notices, autocomplete entries, task-boundary choices, session selectors, and session details before those values reach the terminal.
  • Adds an accepted-plan profile chooser that marks the recommended option, summarizes the profile description, wraps its safeguard summary, and condenses required, denied, or default tool policy into bounded terminal output.
  • Maps rendered chooser labels back to stable profile IDs, including when long or duplicate display names truncate to similar text, so the selected implementation profile remains unambiguous.
  • Extends editor-UI replacement so the loader and profile chooser can transfer cancellation and session-rebind ownership under one token, then restore the exclusive implementation handoff only while that token is still current.
  • Treats profile-selection cancellation as a retryable accepted-plan state with a focused status notice, while still surfacing genuine preflight and post-start implementation failures through their distinct error paths.
  • Reports a waiting accepted continuation after either tree-navigation path and includes the sanitized active harness in /session details so recovery state stays visible outside the footer.
  • Adds shared native-plan fixtures, reflected method bindings, virtual-terminal setup, input recorders, and ownership helpers used by the focused lifecycle and UI regression suites later in the stack.

Testing

  • npm run check passed against the final rebased 14-PR stack.
  • Focused Vitest validation passed against the final rebased stack with 451 tests across 28 affected files.
  • This intermediate PR branch was not checked independently after stack reconstruction.

@jefft72 jefft72 added enhancement New feature or request UI coding-agent labels Aug 16, 2026
@jefft72
jefft72 requested review from Issacboy123 and Pepps233 and removed request for Issacboy123 August 16, 2026 00:11
@Issacboy123
Issacboy123 force-pushed the stack/native-plan-11-profile-context branch from b70fe1a to 518d5bd Compare August 16, 2026 03:14
Keep profile, harness, and accepted-plan state visible across footer variants while sanitizing task-facing labels.
Present bounded profile safeguards and tool policies during plan handoff, and preserve retryable ownership on cancellation.
Centralize native plan fixtures, reflective method bindings, virtual terminal setup, and editor ownership helpers.
@Pepps233
Pepps233 force-pushed the stack/native-plan-11-profile-context branch from 518d5bd to 56ea02b Compare August 16, 2026 04:19
@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