You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Approved tools never run when excludeToolMessages is true #409
With contextOptions: { excludeToolMessages: true }, continuing a generation after agent.approveToolCall never executes the approved tool. excludeToolMessages is applied to the exchange being continued, so the context drops the tool call, the approval request and the decision (which is stored as a tool message), and the model is called with the history ending at the user's prompt.
Repro: an agent with a needsApproval tool and excludeToolMessages: true; prompt it so the model calls the tool; approveToolCall; then generateText with the returned promptMessageId. The tool's execute is never called.
This has been the case since approvals were added in #222; default options (tool messages included) are unaffected.
Local reproduction confirmed on main 2405f035: the existing native approval scenario passes with excludeToolMessages: false, but with true the resumed generateText leaves the tool execution list empty instead of executing the approved call. The regression uses the public approveToolCall method and its returned message ID.
I am preparing a focused fix that restores the persisted approval continuation while keeping ordinary historical tool messages excluded. I checked the current #416 patch: it changes approval/context-handler preparation, but leaves the exclusion query in place and still requires the filtered continuation message, so this case appears separate. I will keep the change limited to this option interaction and cover denied decisions and message/thread boundaries.
Investigation and local regression tests used AI assistance; no paid-provider calls were needed.
Activity
as992949791 commentedon Oct 22, 2026
Local reproduction confirmed on main
2405f035: the existing native approval scenario passes withexcludeToolMessages: false, but withtruethe resumedgenerateTextleaves the tool execution list empty instead of executing the approved call. The regression uses the publicapproveToolCallmethod and its returned message ID.I am preparing a focused fix that restores the persisted approval continuation while keeping ordinary historical tool messages excluded. I checked the current #416 patch: it changes approval/context-handler preparation, but leaves the exclusion query in place and still requires the filtered continuation message, so this case appears separate. I will keep the change limited to this option interaction and cover denied decisions and message/thread boundaries.
Investigation and local regression tests used AI assistance; no paid-provider calls were needed.
test: excludeToolMessages keeps the target order's tools across pages (…
test: approved tools never run with excludeToolMessages (#409)
fix(component): keep the continued order's tool messages with exclude…
fix(component): keep strict tool exclusion when cloning (#409)
test: excludeToolMessages keeps the target order's tools across pages (…
test: approved tools never run with excludeToolMessages (#409)
fix(component): keep the continued order's tool messages with exclude…
fix(component): keep strict tool exclusion when cloning (#409)
test: excludeToolMessages keeps the target order's tools across pages (…
test: approved tools never run with excludeToolMessages (#409)
fix(component): keep the continued order's tool messages with exclude…
fix(component): keep strict tool exclusion when cloning (#409)
test: excludeToolMessages keeps the target order's tools across pages (…
test: drop the component pagination test (#409)
fix(component): keep the continued order's tool messages with exclude…