Skip to content

feat: route accepted plans through harnesses - #69

Closed
jefft72 wants to merge 1 commit into
stack/native-plan-06-persistence-hardeningfrom
stack/native-plan-07-accepted-routing
Closed

jefft72 wants to merge 1 commit into
stack/native-plan-06-persistence-hardeningfrom
stack/native-plan-07-accepted-routing

Conversation

@jefft72

@jefft72 jefft72 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Routes accepted plans through a dedicated one-time classifier that can retain the active harness, reuse an evolved harness, select an immutable base profile, or ask the host to resolve a genuine profile-policy ambiguity.
The implementation fails closed on malformed, unavailable, or low-confidence routing results and keeps the accepted continuation available for retry when routing or runtime activation does not complete safely.

Reasoning

The implementation profile must be chosen from the accepted plan itself rather than from the synthetic continuation wrapper, because the plan contains the actual outcome, constraints, and safety implications that should govern execution.
Accepted-plan routing is also more consequential than ordinary task classification because it can change tool access, guardrails, the active harness, and the runtime that will perform the work.

Some plans materially span multiple specialized profiles whose safeguards and tool policies differ, so silently choosing one would discard a user-relevant tradeoff.
The routing contract therefore exposes a bounded, immutable selection proposal to the host while revalidating continuation ownership around every asynchronous decision and activation boundary.

Changes

  • Adds an accepted-plan router prompt that classifies the plan title and Markdown with recent task context, treats all candidate and harness metadata as untrusted data, and includes immutable profile tool policies plus high-stakes, current-source, and human-review guardrails.
  • Defines validated stay, reuse, select, ambiguous, and unresolved outcomes, including confidence thresholds, exact active-harness checks, harness-to-profile consistency, and fail-closed fallbacks for completion errors or invalid output.
  • Restricts ambiguous outcomes to two or three unique specialized profiles, excludes the general profile, preserves the router's recommended order, and rejects weak or unavailable candidate sets.
  • Exposes an immutable host selection proposal with profile names, descriptions, copied tool policies, and bounded safeguard summaries, then validates cancellation and the selected profile before proceeding.
  • Reuses the exact active harness only after a valid stay decision, reuses existing evolved harnesses only when their immutable base profile still exists, and otherwise creates a task-scoped descriptor for the selected profile.
  • Revalidates the session object, exact continuation identity, default collaboration mode, disposal state, and exclusive runtime operation after routing, after user selection, and immediately before committing harness activation.
  • Caches an ambiguity proposal for the continuation so retries do not rerun or reorder the decision, and records successfully routed continuations so adopted runtimes do not classify the same accepted plan twice.
  • Aborts a pending profile selection during runtime disposal and preserves the pending continuation, current runtime, and preflight failure signal when routing, selection, activation, or session ownership changes.
  • Removes only a newly created, unadopted harness descriptor after failure, with exact path, regular-file, size, schema, identity, and content checks that refuse to delete a replaced or already adopted descriptor.
  • Adds focused router and descriptor tests for ambiguity ordering, policy metadata, low-confidence and malformed fallbacks, exact stay validation, completion errors, and replacement-safe descriptor cleanup.

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 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-07-accepted-routing branch from 4a1a26f to 6d95aa3 Compare August 16, 2026 03:14
Route accepted plan continuations through classified harnesses while preserving single-owner runtime activation.
@Pepps233
Pepps233 force-pushed the stack/native-plan-07-accepted-routing branch from 6d95aa3 to 8787f45 Compare August 16, 2026 04:05
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant