Skip to content

test: cover plan runtime routing races - #67

Closed
jefft72 wants to merge 2 commits into
stack/native-plan-04-session-testsfrom
stack/native-plan-05-runtime-tests
Closed

jefft72 wants to merge 2 commits into
stack/native-plan-04-session-testsfrom
stack/native-plan-05-runtime-tests

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expands runtime and profile-routing coverage for native plan mode, accepted implementation handoff, exclusive replacement ownership, and recovery from failures at every asynchronous switch boundary.
Adds characterization tests showing when implementation should select a harness, stay in an existing or pinned scope, retain its continuation for retry, or leave the outgoing session untouched.

Reasoning

An automatic handoff can cross routing, confirmation, switch hooks, candidate creation, shutdown, invalidation, activation, and host rebinding before a prompt reaches the model.
Tests need to prove that no queued or competing prompt crosses that boundary, that pre-shutdown failures remain reversible, and that post-shutdown failures still leave one adopted runtime.

Plan lifecycle state makes automatic resume and tool suppression part of the same contract.
A routed session must never consume another transcript's unresolved plan, and SDK tool restrictions must remain effective when collaboration mode changes.

Changes

  • Verifies that plan-mode prompts bypass both initial and future automatic profile routing and remain in the current session and profile.
  • Covers routing an accepted plan before its implementation turn, preserving the existing session manager and file, and recording exactly one trusted continuation message in the activated harness.
  • Confirms that already task-scoped harnesses and explicitly pinned profiles implement accepted plans in place without rerouting or creating another harness.
  • Exercises preflight and harness-activation failures so the correct original or rebound continuation remains retryable and a successful retry does not repeat completed routing.
  • Proves that accepted-plan routing excludes competing prompts and replacements, while disposal waits for routing to settle and prevents late activation after shutdown begins.
  • Covers races where plan mode starts during routing, confirmation, a switch hook, or candidate creation, ensuring the prompt stays in its original session, is delivered once, and routing ownership is released for a later retry.
  • Verifies that queued pre-switch prompts never enter a rebound session and that stale outgoing-session mutations remain blocked throughout shutdown and invalidation.
  • Exercises candidate-creation and related-session precommit failures before shutdown, plus invalidation and activation failures after shutdown, to distinguish reversible handoffs from one-way transitions and keep a usable runtime in both cases.
  • Rejects automatic harness resume when the target session is in plan mode or contains an accepted continuation, preserving the current transcript and active profile.
  • Extends runtime characterization for target validation, independent in-memory forks, failed fork creation, delayed rebinding, and noTools behavior so plan mode keeps only intrinsic submission when built-ins are disabled.

Testing

  • Final rebased stack: npm run check passed.
  • Final rebased stack: focused Vitest validation across 28 affected files passed all 451 tests.
  • This intermediate branch was not checked independently after reconstruction.

@jefft72 jefft72 self-assigned this Aug 16, 2026
@Issacboy123
Issacboy123 force-pushed the stack/native-plan-05-runtime-tests branch from dbbf6fb to 922d9fd Compare August 16, 2026 03:14
Exercise replacement reservations, concurrent transitions, and disposal ordering across runtime operations.
Exercise accepted plan routing, profile metadata, and built-in tool suppression across harness activation.
@Pepps233
Pepps233 force-pushed the stack/native-plan-05-runtime-tests branch from 922d9fd to 1b9cce7 Compare August 16, 2026 03:59
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant