Skip to content

fix: subscription events inherit pretty tool call display_as#40

Draft
shadaj wants to merge 1 commit into
mainfrom
sandbox-23067c05-3f9d-43fb-a5a5-f3b8eaf7aa4e
Draft

fix: subscription events inherit pretty tool call display_as#40
shadaj wants to merge 1 commit into
mainfrom
sandbox-23067c05-3f9d-43fb-a5a5-f3b8eaf7aa4e

Conversation

@shadaj

@shadaj shadaj commented Jun 18, 2026

Copy link
Copy Markdown
Member

In both the live processing path (batch_processor.rs) and the history
replay path (display.rs), subscription events now use the display_as
string from the originating InfinityMessage::ToolCall when available,
falling back to name(args) only when no pretty display was computed.

The history lookup iterates in reverse since the subscription tool call
is typically near the end of the conversation.

Added a unit test (subscription_event_uses_display_as) that seeds
history with a tool call + result (subscription started), then sends a
synthetic subscription event and asserts the display uses the pretty
display_as string rather than raw name(args).

Co-authored-by: Infinity 🤖 infinity@hydro.run

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

Latest commit: 86a56d5
Status: ✅  Deploy successful!
Preview URL: https://2fa1ccf2.infinity-dc7.pages.dev
Branch Preview URL: https://sandbox-23067c05-3f9d-43fb-a.infinity-dc7.pages.dev

View logs

In both the live processing path (batch_processor.rs) and the history
replay path (display.rs), subscription events now use the `display_as`
string from the originating `InfinityMessage::ToolCall` when available,
falling back to `name(args)` only when no pretty display was computed.

The history lookup iterates in reverse since the subscription tool call
is typically near the end of the conversation.

Added a unit test (`subscription_event_uses_display_as`) that seeds
history with a tool call + result (subscription started), then sends a
synthetic subscription event and asserts the display uses the pretty
`display_as` string rather than raw `name(args)`.


Co-authored-by: Infinity 🤖 <infinity@hydro.run>
PR: #40
@shadaj shadaj force-pushed the sandbox-23067c05-3f9d-43fb-a5a5-f3b8eaf7aa4e branch from 2b0cc07 to 86a56d5 Compare June 26, 2026 16:17
let orig_call = current_history.get_history().into_iter().find(|h| {
if let Message::Assistant { content, .. } = h
&& let AssistantContent::ToolCall(c) = content.first()
let orig_call = current_history.history.borrow().iter().rev().find_map(|m| {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This might not be correct if the tool call is from before a compaction point?

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