Skip to content

[Midtown !2] Fix channel read --text to show tool summary for tool-only messages#2331

Merged
btucker merged 1 commit intomainfrom
task-2-fix-channel-read-text-to-show-tool-summary
Apr 7, 2026
Merged

[Midtown !2] Fix channel read --text to show tool summary for tool-only messages#2331
btucker merged 1 commit intomainfrom
task-2-fix-channel-read-text-to-show-tool-summary

Conversation

@btucker
Copy link
Copy Markdown
Owner

@btucker btucker commented Apr 7, 2026

Summary

  • ChannelMessage struct was missing tool_data, so the field was silently dropped when deserializing daemon responses
  • Added tool_data: Option<Vec<ToolBlock>> to ChannelMessage with #[serde(default)] for backward compatibility
  • Updated Messages text formatting: when message is empty but tool_data is present, renders [Bash, Read, ...] — matching existing TUI behavior

Test plan

  • test_messages_pretty_shows_tool_summary_for_tool_only_message — empty message + tool_data → [Bash, Read]
  • test_messages_pretty_shows_text_when_message_is_present — non-empty message is shown as-is, no tool summary
  • test_channel_message_deserializes_tool_data_from_json — daemon JSON with tool_data is captured by ChannelMessage
  • All 48 existing cli::response::tests still pass

🌃 Co-built with Midtown

When a channel message has empty text but tool_data, `channel read --text`
now renders `[Bash, Read, ...]` instead of a blank line — matching the
existing TUI behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

@btucker btucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approve (can't formally approve own-account PRs)

Clean fix. The tool summary formatting exactly mirrors the TUI renderer (messages.rs:198-204), so --text and interactive output are now consistent.

Code is straightforward — serde(default) handles backward compat, tests cover the three key cases (tool-only, text+tools, deserialization). No concerns.

🌃 Co-built with Midtown

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.97%. Comparing base (05897b0) to head (52851c2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/bin/midtown/cli/response.rs 84.61% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2331      +/-   ##
==========================================
+ Coverage   63.70%   63.97%   +0.27%     
==========================================
  Files         100      100              
  Lines       38582    38590       +8     
==========================================
+ Hits        24578    24688     +110     
+ Misses      14004    13902     -102     
Files with missing lines Coverage Δ
src/bin/midtown/cli/response.rs 75.77% <84.61%> (+4.99%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@btucker btucker merged commit 1868d51 into main Apr 7, 2026
13 checks passed
@btucker btucker deleted the task-2-fix-channel-read-text-to-show-tool-summary branch April 7, 2026 03:23
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.

1 participant