feat: collapse chat reasoning and tool calls into one expandable row#87
Merged
Conversation
A turn with many tool calls used to stack one card per part, burying the
answer text far below the fold. Consecutive reasoning/tool/patch parts now
collapse into a single summary row ("Ran 12 commands, read 22 files"), split
only by body text so the narrative order of the answer survives.
Tapping the row opens a bottom sheet with every step, reusing the existing
ReasoningCard/ToolCard/PatchCard so input, output and truncation rendering
stay as they were. The sheet holds the group id rather than a snapshot and
re-resolves it against current messages, so a run that is still executing
keeps streaming steps into an open sheet.
While a step is in flight the row names that step instead of showing counts,
so the user can still see what the agent is doing right now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X45Xeoa1CPeUbr5XxdHXXV
yuga-hashimoto
marked this pull request as ready for review
July 25, 2026 16:08
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.
概要
エージェントが1ターンで多数のツールを呼ぶと、「思考」「bash …」「read …」のカードが1件ずつ積み上がり、肝心の回答本文がスクロールの遥か下に埋もれていた。
Claude のチャットと同じように、連続する思考/ツール実行を 1行のサマリに集約し、タップするとボトムシートで全ステップを確認できるようにした。
Before / After
Before — パーツごとに1カード
After — 1行に集約、タップでボトムシート
実行中は件数に畳まず、進行中のステップ名を出したままにする:
変更点
AssistantActivityGroup.kt(新規) — 純粋関数のグルーピング/集計。groupAssistantTimeline()が本文テキストを区切りとして連続する Reasoning/Tool/Patch を1グループに畳む。ストリーミング開始時に来る空テキストパートは区切りにしない(区切りにすると1件ずつ分断される)。グループIDは先頭パートのIDなので、runが伸びても Compose のkeyが安定する。AssistantActivityRow.kt(新規) — 集約行とボトムシート。シートの中身は既存のReasoningCard/ToolCard/PatchCardをそのまま再利用しているので、入力/出力の展開や出力の切り詰め表示は従来どおり。AssistantTimeline—message.partsを直接回す代わりにグルーピング結果を描画。ChatHomeScreen/OpenCodeChatScreen)に持ち上げた。LazyColumn の item 内に置くと、開いたまま item が画面外に出た瞬間に破棄されてしまうため。findActivityParts()で毎回state.messagesから引き直す。実行中のグループを開くと新しいステップがそのまま流れ込む。Buildから種別マップ(Terminal/Visibility/Description/Hub)に変更。i18n-check.ymlがキー一致を検査するため、8ロケール全部に入れた。リポジトリは plurals リソースを一切使っていないので、慣習どおり%1$dプレースホルダの通常の string リソースで統一。テスト
AssistantActivityGroupTest.ktを新規追加(10ケース):ChatPart.Patchを編集として数えるfindActivityParts()がメッセージ横断でグループを解決するローカル実行結果
./gradlew spotlessCheck./gradlew :app:testDebugUnitTest./gradlew :app:lintDebug./gradlew :app:assembleDebuglintDebugにPluralsCandidateの警告が6件増えるが、これは既存の%1$d+ 単語の文字列(values/strings.xmlの 174 / 388-390 / 553-554 行など)と同じパターンで、リポジトリが plurals リソースを使っていない方針に合わせたもの。エラーは0件。未実施
実機/エミュレータでの目視確認(実行中 → 畳まれる → タップでシートが開く → シートを開いたままチャットが伸びても閉じない)は行えていない。ロジックはユニットテストで担保しているが、見た目の最終確認は別途必要。