Skip to content

feat: activate routed plan sessions - #81

Closed
jefft72 wants to merge 4 commits into
plan/02-sessionfrom
plan/03-runtime
Closed

jefft72 wants to merge 4 commits into
plan/02-sessionfrom
plan/03-runtime

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Gives AgentSessionRuntime the ownership model plan continuations need: exclusive runtime operations, a serialized prompt preparation queue, and a plan continuation entry point that cannot interleave with session replacement.

Replaces #65, which imported five modules that exist only on the task profile stack.

Reasoning

An accepted plan is submitted as a trusted prompt, and it must not race a /clear, /resume, or /fork that is already underway.
Serializing prompt preparation behind a single exclusive owner makes that race impossible rather than unlikely, and lets disposal wait for the in-flight operation to settle instead of tearing down under it.

Profile routing is deliberately absent.
The original PR interleaved harness resolution with plan activation inside the same methods, which is what coupled the two features.
Keeping the runtime plan-only here is what lets plan mode merge independently of the task profile stack.

Changes

  • Adds exclusive runtime operation ownership with an idle assertion and settlement tracking
  • Adds a prompt preparation queue so prompts and plan continuations admit in order
  • Adds promptPlanContinuation, which takes exclusive ownership and validates the continuation is still pending
  • Carries replacement diagnostics across session swaps
  • Adds SessionImportFileNotFoundError and target validation for import and resume

Testing

  • npx vitest --run test/suite/agent-session-runtime.test.ts test/suite/agent-session-plan-mode.test.ts
  • tsgo --noEmit reports zero errors
  • biome check . clean

Serialize runtime replacement and disposal so outgoing sessions remain valid until their successors are ready.
Prepare forked and restored runtimes without mutating the live session before replacement succeeds.
Activate routed harness sessions atomically and hand accepted plan continuations to the selected runtime.
- The replayed runtime carried the task profile router, harness descriptors, and evolved-notes loading, none of which exist on main, so the module could not resolve its imports
- Removing profile routing leaves the plan continuation path, exclusive operation ownership, and prompt preparation queue, which is everything plan mode actually needs
@Pepps233
Pepps233 self-requested a review August 16, 2026 18:50
@Pepps233 Pepps233 added enhancement New feature or request coding-agent labels Aug 16, 2026
@Pepps233
Pepps233 requested a review from Issacboy123 August 16, 2026 18:51

@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.

LGTM! Plan continuations now run through the runtime's normal ownership and replacement path, including forks and routed sessions. That gives them the same admission guarantees as other prompts. No issues discovered during review.

@Pepps233 Pepps233 closed this Sep 7, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants