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
A successful tool result without data strands the turn (TypeError in spillOrTruncate) #229
Found while reviewing #220. Present on main (e457abd).
What happens.ToolResult.data is optional, but a successful result without it throws while the result is being stored, before the tool_result is handed back to the stream:
toolResultDataToHistoryString(undefined) returns JSON.stringify(undefined), i.e. undefined, despite its string return type:
TypeError: Cannot read properties of undefined (reading 'length')
at AgentFramework.spillOrTruncate
at AgentFramework.buildStoredToolResultContent
at AgentFramework.handleProcessEvent
Repro. A module tool that returns { success: true }; one mock-membrane turn calling it. The agent stays in ready, the stream never receives tool results, the tool_use is already persisted, and framework.stop() then hung in my probe. Same on main and on #220's head.
The MCPL path can produce the same shape: a successful tools/call with content: [] (or only empty text blocks) maps to data: undefined:
Direction. Normalize absent data to a stable string (e.g. '' or '(no output)') in toolResultDataToHistoryString, and make the result-storage step fail the one call rather than the event, so a bad result still pairs its tool_use.
Activity