Skip to content

refactor: serialize interactive editor ownership for plans - #87

Closed
jefft72 wants to merge 4 commits into
plan/08-output-modesfrom
plan/09-tui-ownership
Closed

jefft72 wants to merge 4 commits into
plan/08-output-modesfrom
plan/09-tui-ownership

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Serializes interactive editor UI ownership and routes interactive prompts through the runtime, so an accepted plan can take exclusive ownership of the prompt path without racing other editor UI.

This is the first half of #72, which was 1484 lines and is split here to stay under the review size limit.

Reasoning

Plan decisions mount their own editor UI, and the existing code allowed two owners to mount at once, which left a stale loader behind when a decision was superseded.
Giving editor UI a single owner with explicit handoff makes the plan decision safe to open and cancel at arbitrary lifecycle points.

Prompts now go through runtimeHost.prompt rather than session.prompt so they queue behind an in-flight plan continuation instead of interleaving with it.
The compaction flush test is updated to assert on that path for the same reason.

Task routing progress, the /profile command, and harness session labels are removed here rather than carried, since they resolve against the task profile stack.

Changes

  • Adds exclusive editor UI ownership with explicit handoff and cancellation
  • Routes interactive prompts and compaction flush through the runtime prompt path
  • Preserves asynchronous UI ownership across session rebind
  • Removes the task boundary resolver, harness status indicator, /profile command, and harness session labels
  • Updates the compaction flush test to assert on the runtime double

Testing

  • npx vitest --run test/interactive-mode-compaction.test.ts test/interactive-mode-status.test.ts
  • tsgo --noEmit reports zero errors

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.
- Routing prompts through the runtime pulled the task boundary resolver, harness status indicator, and /profile command into the TUI, none of which resolve against main
- Removing them leaves the exclusive prompt ownership that plan continuations depend on, keeping the interactive mode free of task profile modules
- Flushing the compaction queue now submits through the runtime so queued prompts serialize against plan continuations, but the test still asserted on the session double
- Asserting on the runtime double keeps the test aligned with the admission path it is meant to pin

@Issacboy123 Issacboy123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editor-ownership and async UI changes give plan decisions a sensible place to live without competing with selectors or extensions. However, in this PR, submitting a plan changes session state without opening a decision UI. #92 fixes that by keeping the pending-plan reconciliation centralized so new prompt paths cannot miss it. I didn't find any other issues in this PR.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants