Skip to content

[mason] Chat app: keep tool-call messages on re-hydrate - #524

Open
akansal2 wants to merge 1 commit into
mainfrom
fix/mason-chat-capabilities-refresh
Open

akansal2 wants to merge 1 commit into
mainfrom
fix/mason-chat-capabilities-refresh

Conversation

@akansal2

@akansal2 akansal2 commented Sep 3, 2026 •

Copy link
Copy Markdown

What

The chat-app transcript is rebuilt from the persisted Session-Store transcript on every re-hydrate — page reload, opening a saved session, and the Capabilities ↻ refresh. renderSessionTranscript dropped any session item without text content, so assistant tool-call turns (which carry tool_calls but no text) silently disappeared. The most visible symptom was the one this PR originally targeted: clicking Capabilities ↻ mid-conversation made tool-call bubbles vanish.

The original version of this PR avoided that one symptom by not re-hydrating on the Capabilities refresh. Since then the chat UI was refactored on main (the hydrateChat split, model picker, decluttering), and the better fix is to make re-hydrate itself lossless — so reload and open-session keep tool calls too.

Fix

  • runtime/ui.py (_chat_session_items): keep session items that carry tool_calls even when they have no content.
  • ui/app.js (renderSessionTranscript): render an assistant tool-call as a "Tool request" bubble (mirroring the streaming path), and skip only genuinely empty items.

Applied to both chat-app templates (agent-langgraph, agent-openai), with a unit test for the kept-tool-call case.

Testing

  • node --check on both app.js.
  • Exercised _chat_session_items for both templates: a tool-call-without-content item is kept, a genuinely empty item is dropped, and the existing exclusion test still holds.

This pull request and its description were written by Isaac.

The chat-app transcript dropped every session item without text content, so
re-hydrating the log (page reload, opening a session, or the Capabilities
refresh) silently lost assistant tool-call turns. Clicking Capabilities ↻
mid-conversation made messages disappear.

Make re-hydrate lossless rather than avoiding one trigger:
- runtime/ui.py: keep session items carrying tool_calls even without content.
- ui/app.js renderSessionTranscript: render an assistant tool-call as a
  "Tool request" bubble (mirrors the streaming path) and skip only genuinely
  empty items.

Applied to both chat-app templates (agent-langgraph, agent-openai) with a unit
test for the kept-tool-call case.

Co-authored-by: Isaac <no-reply@databricks.com>
@akansal2
akansal2 force-pushed the fix/mason-chat-capabilities-refresh branch from 9d07bb5 to 9cafe34 Compare September 11, 2026 17:50
@akansal2 akansal2 changed the title [mason] Chat app: Capabilities refresh no longer wipes the conversation [mason] Chat app: keep tool-call messages on re-hydrate Sep 11, 2026

This branch has not been deployed

No deployments
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