Skip to content

#615 Show growing tool arguments in Session Chat - #767

Merged
ivanfenenko merged 1 commit into
mainfrom
feature/ope-185-growing-tool-arguments
Oct 20, 2026
Merged

ivanfenenko merged 1 commit into
mainfrom
feature/ope-185-growing-tool-arguments

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • While a v2 server streams a tool's arguments, the pending Shell, Read, Edit and Write cards now show the value read so far from input.preview (the command or the file path). Until one can be read, they show the TUI v2 placeholder: "Writing command…", "Preparing read…", "Preparing edit…" or "Preparing write…". iOS and Android match.
  • ToolArgumentsPreview (domain, both platforms) reads top-level string fields from partial JSON leniently. A string still being written counts as its prefix so far, an unfinished escape is dropped, and garbage ends the scan without throwing. The last parse is cached because each delta is read several times per frame.
  • Lifecycle: tool.input.started opens an empty preview. Deltas append to it as before. tool.input.ended replaces it with the final text, which becomes the settled arguments when it parses. A settled input from tool.called now drops the preview in the store merge instead of keeping it beside the arguments.
  • v2 history: a streaming tool whose input string doesn't parse yet keeps it as the preview, so reconnecting mid-stream still shows it.
  • Tool cards get a product-level isReceivingArguments flag; the growing value goes in the existing subtitle slot, so no design-system component change. Chip labels for Shell and Read follow the same value.
  • Completed, error and v1 cards keep today's chrome: the preview is only read for pending or running tools that have no settled arguments yet, and v1 never sends a preview. The generic card's key=value fallback no longer shows a stray preview=….
  • Scenario harness: a new shell-command variant of tool-input-streaming-pending streams a long Shell command slowly. The scenario's expect text no longer lists this issue as open.

Server note

Only opencode beta publishes session.tool.input.delta (since anomalyco/opencode f2323623c4, Oct 16). dev (bc5ebf00a4) and 2.1.0 (e9ac459) only send input.started and then input.ended with the full text. On those servers the card shows the placeholder until ended, then the settled arguments.

Evidence (real v2 beta server, scenario harness, tool-input-streaming-pending / shell-command)

iOS Android
Before args (placeholder)
Growing
Settled by tool.called

iOS sequence:

Before this change the pending card had no subtitle until tool.called, because no card read input.preview. I didn't capture a before build. The Android frames are about 2-3s apart (adb screencap is slow while streaming), so they show one mid-stream state. The Android "before args" frame was taken before the card existed; the placeholder itself is covered by unit tests on both platforms.

Checks

  • Android: ./gradlew :app:testDebugUnitTest (full JVM suite) passes. :app:assembleDebug builds. ktlintCheck reports no new findings on changed lines (existing findings elsewhere remain).
  • iOS: xcodebuild test on a dedicated iPhone 17 (iOS 26.5) simulator: ToolArgumentsPreviewTests, V2LiveTurnTimelineTests, EventDomainAdapterTests, MessageDomainAdapterTests, SessionMessageEngineTests, SessionChatTimelineBlocksTests and SessionChatViewModelTests all pass: 522 tests in 7 suites. The full iOS test target was not run.
  • New tests (both platforms):
    • Partial-JSON parser.
    • Pending Shell card: placeholder after input.started, growing command over deltas, chip label, .called settles it and drops the preview, completed card unchanged.
    • Read/Edit/Write paths from partial input.
    • .ended replaces the preview with parsed arguments.
    • REST reload mid-stream keeps the preview.
    • v1 pending and completed/error cards with a stray preview keep today's chrome.
  • Harness: check.mjs --variants tool-input-streaming-pending passes all 3 plays on v2 beta.

Issue

Risks / Follow-ups

  • The subtitle is one line with an end ellipsis, so a very long command or path stops visibly growing once it fills the line. A head-truncating streaming state in the Tool Call Card would keep the newest text visible; that would be a design-system change.
  • Throttling: beta batches deltas server-side (about 100-150 ms) and the parse is cached. Tool-input deltas still go through the non-streaming display path, which restarts its prepare on each update; both apps updated mid-stream on the harness, but a much denser stream could delay frames.
  • Not checked live: v1 (no previews, so no behavior change expected) and dev/2.1 (placeholder until ended; covered by unit tests).

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need.

While a v2 server streams a tool's arguments, the pending Shell, Read,
Edit and Write cards now show the value read so far from the partial
input (command or file path), or the TUI v2 placeholder ("Writing
command…", "Preparing edit…") until one can be read.

- ToolArgumentsPreview (both platforms) reads top-level string fields
  from partial JSON without throwing and caches the last parse.
- tool.input.started opens an empty preview; tool.input.ended replaces
  it with the final text (settled arguments when it parses); a settled
  input from tool.called drops the preview in the store merge.
- v2 history keeps a streaming tool's unparsed input as its preview.
- Tool cards carry isReceivingArguments; completed, error and v1 cards
  keep today's chrome.
- Scenario harness: shell-command variant of tool-input-streaming-pending.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@linear-code

linear-code Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
OPE-185 Show growing tool arguments in Session Chat

While a tool’s arguments stream on a v2 server, Session Chat should show that growing input on the tool card — not only store it.

Live session.tool.input.delta / .ended already land on the pending tool part. The card chrome still ignores that preview, so the user cannot see arguments until later states.

Parent

OPE-184 — Show remaining TUI v2 live events in Session Chat

What to build

A pending or running tool card shows argument text as it streams, then the settled input after .ended / .called. Existing completed/error cards stay as they are. Both platforms.

Acceptance criteria

  • ☐ Streaming tool input is visible on the tool card while arguments arrive
  • ☐ .ended / .called replace the preview with the settled arguments
  • ☐ Completed and error cards still use today’s chrome
  • ☐ v1 tool cards are unchanged
  • ☐ iOS and Android stay in parity

Blocked by

None — can start immediately.

Review in Linear

@ivanfenenko
ivanfenenko marked this pull request as ready for review October 20, 2026 14:31
@ivanfenenko
ivanfenenko merged commit ca6e983 into main Oct 20, 2026
@ivanfenenko
ivanfenenko deleted the feature/ope-185-growing-tool-arguments branch October 20, 2026 16:18
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.

OPE-185: Show growing tool arguments in Session Chat

1 participant