Skip to content

Show tool calls in the chat history after a reload - #117

Merged
arefbehboudi merged 2 commits into
mainfrom
fix/history-tool-calls
Nov 26, 2026
Merged

arefbehboudi merged 2 commits into
mainfrom
fix/history-tool-calls

Conversation

@arefbehboudi

Copy link
Copy Markdown
Collaborator

The history now groups a conversation by turn: the user message, then one agent message with one tool group holding every tool call of the turn, in order, and all of the turn's text. Each call's result is matched by tool call id; a call without a stored result shows "no result", as a live call that never finished.

The server sends the tool calls as JSON in the agent message's data-tools attribute, and chat.js builds the cards from it with the same functions it uses for live tool calls, so a card looks the same live and after a reload.

The history now groups a conversation by turn: the user message, then one
agent message with one tool group holding every tool call of the turn, in
order, and all of the turn's text. Each call's result is matched by tool call
id; a call without a stored result shows "no result", as a live call that never
finished.

The server sends the tool calls as JSON in the agent message's data-tools
attribute, and chat.js builds the cards from it with the same functions it uses
for live tool calls, so a card looks the same live and after a reload.
In the history's data-tools, an output longer than 20,000 characters is cut
to that length and marked "truncated": true; chat.js shows "(output truncated)"
under it. Live tool results are unchanged.

A tool call with a blank or repeated id no longer replaces another call: it is
kept under its position in the turn, so every call is shown. Results still
match by id when the id is set.
@arefbehboudi
arefbehboudi merged commit 72cd922 into main Nov 26, 2026
1 check passed
@arefbehboudi
arefbehboudi deleted the fix/history-tool-calls branch November 26, 2026 17:16
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