[PR #1410] [MERGED] Restore custom_tool_script_unsupported error parity #5077

Closed
opened 2026-10-22 04:13:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1410
Author: @Romuromylus
Created: 5/27/2026
Status: ✅ Merged
Merged: 5/27/2026
Merged by: @Romuromylus

Base: refactor ← Head: fix/refactor-custom-tools-script-error-parity


📝 Commits (2)

  • 4b857d9 Restore custom_tool_script_unsupported error parity
  • 3c18afc Map custom_tool_script_unsupported to HTTP 422 in dispatch

📊 Changes

2 files changed (+7 additions, -2 deletions)

View changed files

📝 src-tauri/src/commands/storage/custom_tools.rs (+6 -2)
📝 src-tauri/src/http_server.rs (+1 -0)

📄 Description

Why this change

The script_execution_type_returns_actionable_error test at src-tauri/src/commands/storage/custom_tools.rs:150 is currently red on every open PR against refactor. The test asserts a specific error contract for legacy script-type custom tools:

  • error.code == "custom_tool_script_unsupported"
  • message names the offending tool
  • message identifies the legacy script issue ("legacy script" or "script executionType")
  • message points at the Webhook migration path ("Webhook" or "webhook")

The recent "Restore refactor parity features" commit (d1df27c2) replaced the "script" arm of execute_custom_tool with:

"script" => Err(AppError::invalid_input(
    "Script custom tools are executed by the Tauri TypeScript runtime.",
)),

That breaks all four assertions (wrong code, no tool name, no legacy-script wording, no Webhook hint). It is also internally misleading: the Rust path still returns Err for script tools rather than handing off to any TypeScript runtime, so a UI that surfaces this error verbatim tells the user "scripts are executed by TS" right before refusing to run them.

What changed

Restored the actionable error contract the test pins:

"script" => Err(AppError::with_details(
    "custom_tool_script_unsupported",
    format!(
        "Custom tool '{tool_name}' uses the legacy script executionType, which the refactor desktop runtime does not execute. Open the tool in the editor and convert it to a Webhook (recommended) or a Static result."
    ),
    json!({ "executionType": "script", "migration": "convert-to-webhook-or-static" }),
)),

One file, 6 insertions / 2 deletions.

Verification

  • cargo test --manifest-path src-tauri/Cargo.toml --lib storage_commands::custom_tools::tests::script_execution_type_returns_actionable_error passes locally.
  • Open PRs #1406 and #1407 against refactor were blocked by the Rust Capability Layer check failing on this exact test. After this lands they unblock.

Open question

I left scriptExecutionEnabled: true in custom_tool_capabilities (custom_tools.rs:9) untouched. The "parity features" commit flipped it from false to true, but the Rust path still returns the error above. If the intent of the flip was "TS will execute scripts and the Rust path will only fire as a fallback for some narrow case", the capabilities flag is correct as-is. If the intent was simply that scripts now work and the flag should follow, the flag should revert to false (and the test then captures the contract that legacy script tools are still rejected by the Rust path for any UI that bypasses the TS executor). Happy to push a follow-up commit either way once you tell me which.

Linked

Unblocks #1406 and #1407.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error messages for custom tools using legacy script execution types. You'll now receive clear, actionable guidance on how to migrate your tool configurations to supported execution methods.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1410 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `refactor` ← **Head:** `fix/refactor-custom-tools-script-error-parity` --- ### 📝 Commits (2) - [`4b857d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4b857d917b506fdacdda0ed3771ed1c2d5e36424) Restore custom_tool_script_unsupported error parity - [`3c18afc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3c18afc2019d276246a77c93c1a1ed910c3627fd) Map custom_tool_script_unsupported to HTTP 422 in dispatch ### 📊 Changes **2 files changed** (+7 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/custom_tools.rs` (+6 -2) 📝 `src-tauri/src/http_server.rs` (+1 -0) </details> ### 📄 Description ## Why this change The `script_execution_type_returns_actionable_error` test at `src-tauri/src/commands/storage/custom_tools.rs:150` is currently red on every open PR against `refactor`. The test asserts a specific error contract for legacy script-type custom tools: - `error.code == "custom_tool_script_unsupported"` - message names the offending tool - message identifies the legacy script issue (`"legacy script"` or `"script executionType"`) - message points at the Webhook migration path (`"Webhook"` or `"webhook"`) The recent "Restore refactor parity features" commit (`d1df27c2`) replaced the `"script"` arm of `execute_custom_tool` with: ```rust "script" => Err(AppError::invalid_input( "Script custom tools are executed by the Tauri TypeScript runtime.", )), ``` That breaks all four assertions (wrong code, no tool name, no legacy-script wording, no Webhook hint). It is also internally misleading: the Rust path still returns `Err` for script tools rather than handing off to any TypeScript runtime, so a UI that surfaces this error verbatim tells the user "scripts are executed by TS" right before refusing to run them. ## What changed Restored the actionable error contract the test pins: ```rust "script" => Err(AppError::with_details( "custom_tool_script_unsupported", format!( "Custom tool '{tool_name}' uses the legacy script executionType, which the refactor desktop runtime does not execute. Open the tool in the editor and convert it to a Webhook (recommended) or a Static result." ), json!({ "executionType": "script", "migration": "convert-to-webhook-or-static" }), )), ``` One file, 6 insertions / 2 deletions. ## Verification - `cargo test --manifest-path src-tauri/Cargo.toml --lib storage_commands::custom_tools::tests::script_execution_type_returns_actionable_error` passes locally. - Open PRs #1406 and #1407 against `refactor` were blocked by the Rust Capability Layer check failing on this exact test. After this lands they unblock. ## Open question I left `scriptExecutionEnabled: true` in `custom_tool_capabilities` (`custom_tools.rs:9`) untouched. The "parity features" commit flipped it from `false` to `true`, but the Rust path still returns the error above. If the intent of the flip was "TS will execute scripts and the Rust path will only fire as a fallback for some narrow case", the capabilities flag is correct as-is. If the intent was simply that scripts now work and the flag should follow, the flag should revert to `false` (and the test then captures the contract that legacy script tools are still rejected by the Rust path for any UI that bypasses the TS executor). Happy to push a follow-up commit either way once you tell me which. ## Linked Unblocks #1406 and #1407. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved error messages for custom tools using legacy script execution types. You'll now receive clear, actionable guidance on how to migrate your tool configurations to supported execution methods. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1410?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:13:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5077
No description provided.