Skip to content

fix(server): show Implement button more reliably for Claude plan mode#2597

Closed
imabdulazeez wants to merge 4 commits intopingdotgg:mainfrom
imabdulazeez:fix/claude-plan-feedback
Closed

fix(server): show Implement button more reliably for Claude plan mode#2597
imabdulazeez wants to merge 4 commits intopingdotgg:mainfrom
imabdulazeez:fix/claude-plan-feedback

Conversation

@imabdulazeez
Copy link
Copy Markdown
Contributor

@imabdulazeez imabdulazeez commented May 8, 2026

What Changed

Adds a fallback in ClaudeAdapter that captures plan-like assistant text at turn completion when Claude finishes a plan-mode turn without invoking the ExitPlanMode SDK tool. The captured text is routed through the existing emitProposedPlanCompleted path, so the Implement button surfaces unchanged on the client.

  • Track interaction mode on session context + per-turn state instead of re-deriving from input.
  • Add looksLikePlan heuristic (≥200 chars, heading or list markers, no refusal stems, ≥3 list items or plan-keyword heading).
  • On successful plan-mode turn completion with no prior ExitPlanMode capture and no pending user input, emit proposed.completed with raw source claude.sdk.text-fallback.
  • Add claude.sdk.text-fallback to RuntimeEventRawSource.
  • Null-safety guard on assistant text block access.

Server-only change. No web/client edits.

Why

Fixes #2519. With Opus 4.6/4.7, larger plan-mode responses could finish without ever calling ExitPlanMode, so nothing emits proposed.completed and the Implement button never appears. This change recognises the de facto plan output and reuses the existing capture path.

The fallback is gated conservatively (plan mode, successful completion, no prior capture, no pending input) and dedup via capturedProposedPlanKeys prevents double-capture when ExitPlanMode does fire. New raw source keeps fallback captures distinguishable in event telemetry.

Known concerns: heuristic is English-only (refusal stems / plan keywords), and thresholds are tuned by inspection — happy to extract to constants or adjust on review.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A, just that the implement button now should appear more reliably for Claude plan mode)
  • I included a video for animation/interaction changes

Note

Add promote and revert controls for the Implement button in Claude plan mode

  • Adds thread.proposed-plan.promote and thread.proposed-plan.revert orchestration commands so users can promote the latest assistant message to a proposed plan or revert it back to a message.
  • The Implement button area in ChatComposer and CompactComposerControlsMenu now renders promote/revert controls when in plan mode and the appropriate state is met.
  • Promoted source messages are hidden from the timeline in deriveTimelineEntries; only the plan entry is shown.
  • Adds a thread.proposed-plan-removed event type through contracts, server projection pipeline, in-memory projector, and client store to propagate plan removal end-to-end.
  • Behavioral Change: assistant messages promoted to a plan are filtered out of the chat timeline and replaced by the plan entry.

Macroscope summarized 30d31cf.

Adds a heuristic to detect and capture plan-like text when Claude completes
a plan-mode turn without calling ExitPlanMode. This makes the Implement
button appear for structured text plans that don't explicitly use the SDK tool.

The fallback gates on all of:
- Turn ran in plan mode
- No ExitPlanMode already captured
- No pending user input request
- Turn completed successfully

The heuristic checks for:
- Text length >= 200 chars (filters trivial responses)
- Structural markers (headings, bullet/numbered lists)
- Not starting with refusal stems
- Either 3+ total list items OR a plan-related heading keyword

Captures via the same emitProposedPlanCompleted path, with rawMethod
"claude/text-fallback" for observability. Deduplication prevents double-firing
when ExitPlanMode already captured the turn.

No web/client changes required—the capture flows through existing
turn.proposed.completed → activeProposedPlan → Implement button path.
- Store currentInteractionMode in context to properly reflect plan/default mode
- Use tracked mode instead of input-based derivation for resolvedInteractionMode
- Add null safety check for text block access
- Support claude.sdk.text-fallback event source
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fc56821b-593d-44cf-9284-4639ae3ee784

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels May 8, 2026
Comment thread apps/server/src/provider/Layers/ClaudeAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeAdapter.ts
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 8, 2026

Approvability

Verdict: Needs human review

This PR introduces new user-facing capabilities (promote/revert plan buttons) with new orchestration commands, events, persistence operations, and UI state management across multiple packages — constituting a new feature rather than a simple fix.

You can customize Macroscope's approvability policy. Learn more.

- Initialize interactionMode from context instead of hardcoding
- Fix plan detection regex to support multiline matching with 'm' flag
- Introduce thread.proposed-plan.promote to allow users to promote assistant messages to proposed plans
- Introduce thread.proposed-plan.revert to allow reverting promoted plans back to messages
- Remove automatic text-fallback plan capture (looksLikePlan logic)
- Update backend event handling, persistence layer, and frontend UI for plan mode interaction
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels May 9, 2026
@imabdulazeez
Copy link
Copy Markdown
Contributor Author

Closing since not super happy with this implementation. Reverted to a "promote to plan" button for Claude plan mode messages that do not trigger a plan mode in my own fork for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Implement Plan Button Does not Appear after plan has be generated successfully

1 participant