Repository navigation
Conversation
Reserve runtime replacements and guard session mutations so overlapping operations cannot corrupt active session state.
Configure plan-aware tools and prompts while constraining collaboration behavior to the active session mode.
Persist submitted plan state and resume accepted plans through the normal prompt lifecycle.
- A stray closing brace in setActiveToolsByName stopped agent-session.ts from parsing, which masked every other error in the file - The manual compaction path also called the profile-only _compactionInstructions helper and never read the result, so the dead assignment is dropped rather than reimplemented
- Plan mode rebuilt the canonical read-only tools from the built-in registry, so --no-tools builtin still exposed read, grep, find, and ls while planning - The session now carries the built-in tool decision from the caller, leaving submit_plan as the only planning tool when built-ins are disabled
Issacboy123
approved these changes
Aug 17, 2026
Issacboy123
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Cleanly puts plan lifecycle, persistence, and tool policy in the session layer. It also preserves a disabled built-in tool policy while plan mode is active, which avoids reopening access through the new mode. Didn't find any significant issues in review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Teaches
AgentSessionto enter and leave plan mode safely, swap its tool registry while planning, and hand back a one-shot continuation when a plan is accepted.Replaces #64, which could not build against
main.Reasoning
Plan mode changes what the agent is allowed to do, so the transition needs to be refused while work is in flight rather than applied optimistically.
A submitted plan also has to be resolved before the session can return to default mode, otherwise an accepted plan could be silently abandoned.
The accepted plan is handed back as an opaque, single-use continuation rather than a plain string.
That lets the session reject stale or replayed tokens and bypass command, template, and input transformation for a handoff it already trusts.
The canonical read-only tools exposed while planning are built-ins, so a caller that disables built-ins must not get them back through plan mode.
The session now carries that decision explicitly and leaves
submit_planas the only planning tool in that case.Changes
setCollaborationModewith idle, queue, and pending-plan guards, plus persisted mode transitionssubmit_planintrinsicresolvePlan,pendingPlan,pendingPlanContinuation, andpromptPlanContinuationwith stale-token rejectionbuiltinToolsDisabledso planning honours--no-tools builtinsetActiveToolsByNamethat prevented the file from parsingTesting
npx vitest --run test/suite/agent-session-plan-mode.test.ts test/plan-mode-tools.test.ts test/compaction.test.tstsgo --noEmitreports zero errorsbiome check .clean