Skip to content

Retain tool calls in conversation buffer text and token counts - #1592

Open
Twiink wants to merge 1 commit into
tmc:mainfrom
Twiink:codex/20261128-buffer-tool-calls
Open

Twiink wants to merge 1 commit into
tmc:mainfrom
Twiink:codex/20261128-buffer-tool-calls

Conversation

@Twiink

@Twiink Twiink commented Nov 28, 2026

Copy link
Copy Markdown

GetBufferString includes legacy FunctionCall data but omits modern ToolCalls. Text conversation memory loses the call IDs, function names, and arguments, and ConversationTokenBuffer can keep a tool call whose large arguments exceed its token budget. Append tool calls using their existing JSON representation and handle both value and pointer AIChatMessages, preserving the legacy function-call format.

Four regressions fail on the baseline: both message forms, ConversationBuffer.LoadMemoryVariables, and token pruning after SaveContext. The formatting test round-trips through the public ToolCall JSON marshaler; the memory test starts with a complete human/call/result exchange and uses no model calls. Related #1270 adds EnhancedTokenBuffer, #1240 concerns agent behavior, and #1479 concerns MessageContent conversion; none changes GetBufferString.

Validation: go test -race -count=1 ./llms ./memory/... ./chains ./agents and repository-wide golangci-lint v2.3.0 pass. Unrelated full-suite integration limitations (credentials, recorded HTTP fixtures, and service containers) are unchanged. Prepared and validated with Codex.

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