Skip to content

fix(wasm): address #1086 review followups -- description hint and coercion safety#1092

Merged
zmanian merged 1 commit intostagingfrom
fix/1086-review-followups
Mar 13, 2026
Merged

fix(wasm): address #1086 review followups -- description hint and coercion safety#1092
zmanian merged 1 commit intostagingfrom
fix/1086-review-followups

Conversation

@zmanian
Copy link
Copy Markdown
Collaborator

@zmanian zmanian commented Mar 13, 2026

Summary

Followup fixes from the review of #1086 (tool_info schema discovery), which was merged before review comments were addressed.

  • Replace fragile description string mutation with composition at display time. The old append_schema_hint_if_permissive() / strip_schema_hint() mutated the stored description string using contains / find / truncate, coupling presentation concerns to stored state. Now the raw description stays clean and the tool_info hint is composed in the Tool::schema() override only when the advertised schema is permissive. The hint also now includes the tool name and include_schema: true for better LLM guidance.

  • Make effective_for_coercion use load-time schema instead of re-calling WASM export mid-execution. The old code called tool_iface.call_schema() on the already-running WASM instance between store setup and call_execute(), risking state contamination from mutable linear memory. Now falls back to the PreparedModule.schema extracted at load time.

Test plan

  • cargo check clean
  • cargo clippy --all --benches --tests --examples --all-features zero warnings
  • cargo fmt clean
  • test_advertised_schema_stays_permissive_until_sidecar_override updated and passing
  • test_coerce_noop_with_permissive_schema passing
  • test_tool_info_* tests passing

Generated with Claude Code

…rcion safety

Two fixes from the review of #1086 (tool_info schema discovery):

1. Replace fragile description string mutation (append_schema_hint_if_permissive /
   strip_schema_hint) with composition at display time. The raw description stays
   clean; the tool_info hint is composed in the Tool::schema() override only when
   the advertised schema is permissive. This also includes the tool name and
   `include_schema: true` in the hint for better LLM guidance.

2. Make effective_for_coercion use the load-time extracted schema from
   PreparedModule instead of re-calling the WASM schema() export on the
   already-running instance mid-execution. This avoids potential state
   contamination from calling schema() after linear memory is initialized
   for execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions bot added scope: tool/wasm WASM tool sandbox size: M 50-199 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Mar 13, 2026
@zmanian zmanian merged commit 15c5d3e into staging Mar 13, 2026
10 checks passed
@zmanian zmanian deleted the fix/1086-review-followups branch March 13, 2026 00:48
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
…nd coercion safety (nearai#1092)

Two fixes from the review of nearai#1086 (tool_info schema discovery):

1. Replace fragile description string mutation (append_schema_hint_if_permissive /
   strip_schema_hint) with composition at display time. The raw description stays
   clean; the tool_info hint is composed in the Tool::schema() override only when
   the advertised schema is permissive. This also includes the tool name and
   `include_schema: true` in the hint for better LLM guidance.

2. Make effective_for_coercion use the load-time extracted schema from
   PreparedModule instead of re-calling the WASM schema() export on the
   already-running instance mid-execution. This avoids potential state
   contamination from calling schema() after linear memory is initialized
   for execution.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
…nd coercion safety (nearai#1092)

Two fixes from the review of nearai#1086 (tool_info schema discovery):

1. Replace fragile description string mutation (append_schema_hint_if_permissive /
   strip_schema_hint) with composition at display time. The raw description stays
   clean; the tool_info hint is composed in the Tool::schema() override only when
   the advertised schema is permissive. This also includes the tool name and
   `include_schema: true` in the hint for better LLM guidance.

2. Make effective_for_coercion use the load-time extracted schema from
   PreparedModule instead of re-calling the WASM schema() export on the
   already-running instance mid-execution. This avoids potential state
   contamination from calling schema() after linear memory is initialized
   for execution.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: tool/wasm WASM tool sandbox size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants