Skip to content

feat(js): mark interrupt tools as non-restartable and preserve tool metadata#5414

Open
pavelgj wants to merge 2 commits into
mainfrom
pj/tool-restartable-metadata
Open

feat(js): mark interrupt tools as non-restartable and preserve tool metadata#5414
pavelgj wants to merge 2 commits into
mainfrom
pj/tool-restartable-metadata

Conversation

@pavelgj
Copy link
Copy Markdown
Member

@pavelgj pavelgj commented May 27, 2026

  • Set restartable: false in interrupt tool metadata so consumers can distinguish interrupts from regular tools
  • Spread existing config.metadata.tool in multipart tools to avoid overwriting prior tool metadata properties (e.g. restartable)
  • Add tests covering metadata preservation for interrupts, multipart, and non-multipart tools

- Set `restartable: false` in interrupt tool metadata so consumers can
  distinguish interrupts from regular tools
- Spread existing `config.metadata.tool` in multipart tools to avoid
  overwriting prior tool metadata properties (e.g. `restartable`)
- Add tests covering metadata preservation for interrupts, multipart,
  and non-multipart tools
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to preserve existing metadata properties on tools, specifically ensuring that metadata.tool properties are not overwritten for multipart and non-multipart tools, and marks interrupts as non-restartable. The review feedback highlights an issue where custom metadata on interrupts could still be discarded because metadata is overwritten directly rather than merged. A code suggestion is provided to correctly spread and preserve existing metadata, along with a recommendation to update the test suite to verify this behavior.

Comment thread js/ai/src/tool.ts Outdated
Comment thread js/ai/tests/tool_test.ts Outdated
@pavelgj pavelgj changed the title feat: mark interrupt tools as non-restartable and preserve tool metadata feat(js): mark interrupt tools as non-restartable and preserve tool metadata May 27, 2026
Previously, the interrupt function was overwriting all existing metadata
with only `{ tool: { restartable: false } }`. This change spreads the
existing metadata and tool properties before setting restartable, ensuring
custom metadata and other tool properties are preserved.
@pavelgj pavelgj removed the request for review from mbleigh May 27, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant