Skip to content

Fix handoff usage and schema setting changes in tool loops - #395

Merged
mattt merged 1 commit into
mainfrom
mattt/profile-handoff-fixes
Nov 5, 2026
Merged

mattt merged 1 commit into
mainfrom
mattt/profile-handoff-fixes

Conversation

@mattt

@mattt mattt commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes two problems in the provider tool loops on dynamic profile sessions. When a streaming response handed off from an HTTP model to a local structured model, the handoff rebuilt the prepaid snapshot with the earlier usage added and without its prepaid token, so the session counted the local requests twice. The rebuilt snapshot now keeps the token and carries the handed-off usage separately, and the session counts only the part of that usage that it hasn't counted yet.

When a tool callback changed a profile's schema prompt setting and kept the model, the next request in that response still used the old setting, because each provider computed the schema text once before its request loop. All five providers now compute the schema text after each context resolution, through one shared helper. Ordinary sessions keep the setting from the call site.

@mattt
mattt merged commit c013f74 into main Nov 5, 2026
12 checks passed
@mattt
mattt deleted the mattt/profile-handoff-fixes branch November 5, 2026 23:20
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