feat(claude): Reflect Claude’s autonomous plan transitions to the UI#1452
Open
AbdulelahHajjar wants to merge 1 commit intopingdotgg:mainfrom
Open
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…e UI Signed-off-by: Abdulelah Hajjar <aab.hajjar@gmail.com>
3db4f34 to
e21c2d7
Compare
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.
What Changed
interaction.mode.changedruntime event to the shared contracts layer (ProviderRuntimeEvent)EnterPlanModeandExitPlanModetool calls in stream events (content_block_start) and emitsinteraction.mode.changedto propagate the mode transitionthread.interaction-mode.setto update the thread's read model, which the UI observesWhy
When the Claude agent autonomously decides to enter plan mode (i.e., the agent calls
EnterPlanModeon its own without the user toggling it from the UI), the T3 Code UI didn't reflect the mode change. The user would remain in "default" mode visually while the agent was already operating in plan mode internally.Approach and Certain Trade-off's I faced
1- Manual tool mapping required. Due to the Claude SDK only exposing setPermissionMode() with no
getter, we detect mode changes by intercepting tool names in stream events. If Claude adds new interaction modes in the future, the mapping ininteractionModeForTool()must be updated manually.2- Codex does not support this behavior. I realized that Codex has no mechanism for the agent to autonomously enter plan mode from a message, therefore, I intended to keep this PR as Claude-only for now.
UI Changes
Before
CleanShot.2026-03-27.at.01.21.37.mp4
Notice "Chat" incorrectly persisted despite Claude entering plan mode.
After
CleanShot.2026-03-27.at.01.29.28.mp4
Notice "Chat => Plan" transition upon Claude entering plan mode.
... and "Plan => Chat" transition upon Claude exiting plan mode.
Checklist
Note
Medium Risk
Introduces a new cross-layer runtime event and updates orchestration ingestion to mutate thread interaction mode, which could affect UI state for all providers if mis-emitted or mis-handled. Scope is contained and covered by new adapter/ingestion tests, lowering regression risk.
Overview
Adds a new runtime event
interaction.mode.changedto shared provider-runtime contracts, carrying the currentinteractionMode.Updates the Claude provider adapter to detect
EnterPlanMode/ExitPlanModetool-use starts in the stream and emitinteraction.mode.changedaccordingly.Extends
ProviderRuntimeIngestionto translateinteraction.mode.changedinto athread.interaction-mode.setcommand only when the mode differs, with tests covering both mode updates and deduping duplicate mode events.Written by Cursor Bugbot for commit e21c2d7. This will update automatically on new commits. Configure here.
Note
[!NOTE]
Reflect Claude's autonomous plan mode transitions to thread interaction mode
EnterPlanModeandExitPlanModetool-use detection in ClaudeAdapter.ts, emittinginteraction.mode.changedruntime events with the corresponding mode (planordefault).interaction.mode.changedhandler in ProviderRuntimeIngestion.ts that dispatches athread.interaction-mode.setcommand when the incoming mode differs from the thread's current mode.ProviderRuntimeEventV2union in providerRuntime.ts with the newinteraction.mode.changedevent type and itsinteractionModepayload.Macroscope summarized e21c2d7.