fix(wasm): address #1086 review followups -- description hint and coercion safety#1092
Merged
fix(wasm): address #1086 review followups -- description hint and coercion safety#1092
Conversation
…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>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
henrypark133
approved these changes
Mar 13, 2026
This was referenced Mar 13, 2026
This was referenced Mar 13, 2026
Merged
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 usingcontains/find/truncate, coupling presentation concerns to stored state. Now the raw description stays clean and thetool_infohint is composed in theTool::schema()override only when the advertised schema is permissive. The hint also now includes the tool name andinclude_schema: truefor better LLM guidance.Make
effective_for_coercionuse load-time schema instead of re-calling WASM export mid-execution. The old code calledtool_iface.call_schema()on the already-running WASM instance between store setup andcall_execute(), risking state contamination from mutable linear memory. Now falls back to thePreparedModule.schemaextracted at load time.Test plan
cargo checkcleancargo clippy --all --benches --tests --examples --all-featureszero warningscargo fmtcleantest_advertised_schema_stays_permissive_until_sidecar_overrideupdated and passingtest_coerce_noop_with_permissive_schemapassingtest_tool_info_*tests passingGenerated with Claude Code