Skip to content

fix: surface plan content to IM channel on ExitPlanMode#59

Merged
quick-sort merged 1 commit into
mainfrom
fix/plan-mode-content-not-sent
Jun 17, 2026
Merged

fix: surface plan content to IM channel on ExitPlanMode#59
quick-sort merged 1 commit into
mainfrom
fix/plan-mode-content-not-sent

Conversation

@hilr

@hilr hilr commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Bug: plan 模式退出时计划内容未发送到 IM channel #58. When the agent exits plan mode (ExitPlanMode tool), the plan text was never sent to the IM channel — the ToolUseBlock handler only emitted the generic ⚙️ ExitPlanMode summary.
  • Investigation of real session transcripts confirmed ExitPlanMode carries the full plan in its tool input (input.plan). This PR extracts input.plan and forwards it as a text OutGoingMessage; when the field is absent or empty it falls back to the existing tool summary.
  • Applied in both the main run() loop and the _recover_from_context_limit() replay path for consistency.

Test Plan

  • test_exit_plan_mode_surfaces_plan — plan text yielded to channel
  • test_exit_plan_mode_without_plan_falls_back_to_summary — no plan field → generic summary
  • test_exit_plan_mode_empty_plan_falls_back_to_summary — whitespace-only plan → generic summary
  • uv run pytest tests/test_agents.py -k "exit_plan or tool_summary" — 15 passed
  • Full suite — 164 passed (1 pre-existing failure in test_ask_user_question_resume, unrelated: it calls a real LLM for answer parsing)

Closes #58

ExitPlanMode carries the plan text in its tool input (`input.plan`), but the
agent's ToolUseBlock handler only emitted a generic "⚙️ ExitPlanMode"
summary, so the user never saw the plan on the IM channel. Extract and
forward `input.plan` when present; fall back to the summary otherwise.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@quick-sort quick-sort merged commit 571cfd5 into main Jun 17, 2026
1 check passed
@quick-sort quick-sort deleted the fix/plan-mode-content-not-sent branch June 17, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: plan 模式退出时计划内容未发送到 IM channel

2 participants