Skip to content

fix(runtime): persist provider-executed streamed tool results - #873

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/provider-web-search-stream-runtime-20260406
Apr 6, 2026
Merged

fix(runtime): persist provider-executed streamed tool results#873
kojiwakayama merged 1 commit into
mainfrom
fix/provider-web-search-stream-runtime-20260406

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Summary

  • persist provider-executed streamed tool results into runtime conversation state
  • forward streamed provider tool errors through the data stream protocol
  • avoid re-entering streamed tool-call steps without matching provider tool-result messages
  • bump version to 0.1.138 to trigger deployment

Testing

  • deno test --allow-all src/agent/runtime/ai-stream-handler.test.ts
  • deno check src/agent/runtime/index.ts
  • full repo pre-push checks (format, lint, typecheck, unit tests)

Refs veryfront-studio#1239

@kojiwakayama
kojiwakayama enabled auto-merge (squash) April 6, 2026 20:23
@kojiwakayama
kojiwakayama force-pushed the fix/provider-web-search-stream-runtime-20260406 branch 2 times, most recently from fbcbd45 to aa1c2f5 Compare April 6, 2026 20:25
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

currentMessages.push(toolResultMessage);
await this.memory.add(toolResultMessage);

P2 Badge Keep final assistant text when storing streamed tool results

Appending each toolResultMessage to currentMessages before the finishReason check can make a tool message the final entry of the run, so the method returns an empty response.text (it is derived from the last message’s text parts). This occurs when a streamed step includes both assistant text and provider tool results but does not continue with "tool-calls", causing downstream onFinish consumers to lose the generated assistant text even though it was streamed.


errorText: stringifyToolError(part.error),

P2 Badge Preserve Error.message in streamed tool-error events

In the new tool-error path, errorText is built via stringifyToolError(part.error), which JSON-stringifies first; when part.error is an Error object this commonly becomes {} instead of the actual message. That means clients receive unusable tool-output-error payloads for thrown errors, defeating the purpose of forwarding provider tool errors.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kojiwakayama
kojiwakayama disabled auto-merge April 6, 2026 20:31
@kojiwakayama
kojiwakayama force-pushed the fix/provider-web-search-stream-runtime-20260406 branch from aa1c2f5 to b576680 Compare April 6, 2026 20:42
@kojiwakayama
kojiwakayama enabled auto-merge (squash) April 6, 2026 20:46
@kojiwakayama
kojiwakayama merged commit 6ce5112 into main Apr 6, 2026
18 checks passed
@kojiwakayama
kojiwakayama deleted the fix/provider-web-search-stream-runtime-20260406 branch April 6, 2026 20:48
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