Skip to content

fix(tools): include args in tool outputs to prevent crash (#24529) - #24537

Closed
PratikRai0101 wants to merge 4 commits into
anomalyco:devfrom
PratikRai0101:fix/24529-edit-tool-args-crash
Closed

PratikRai0101 wants to merge 4 commits into
anomalyco:devfrom
PratikRai0101:fix/24529-edit-tool-args-crash

Conversation

@PratikRai0101

@PratikRai0101 PratikRai0101 commented Apr 26, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #24529

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The edit and write tools currently crash when modifying files because the AI SDK's output pipeline expects to read output.args.filePath, but the args object is missing from the tool's return payload.

Upon auditing the codebase, this missing args payload was a repo-wide pattern across multiple tools. This PR fixes the crash by adding args: params to the return statements of the entire affected tool suite:

  • edit.ts
  • write.ts
  • read.ts
  • apply_patch.ts
  • lsp.ts
  • bash.ts
  • glob.ts
  • grep.ts

This ensures the tool results carry the original input arguments downstream, satisfying the pipeline's expected data shape and preventing the TypeError.

How did you verify your code works?

  • Verified the execute return payloads for all affected tools now correctly include the input parameters via the args property.
  • Confirmed the tool wrapper successfully passes this property through to the AI SDK without truncation.

Screenshots / recordings

N/A (Backend tool output logic)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@PratikRai0101 PratikRai0101 changed the title fix(edit): include args in tool output to prevent crash (#24529) fix(tools): include args in tool outputs to prevent crash (#24529) Apr 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(edit): edit tool crashes with 'undefined is not an object (evaluating output.args.filePath)' on existing file modification

1 participant