Files
claw/docs/superpowers/plans/2026-04-13-expected-domain-arg-fix.md
木炎 ad3778d4c5 fix: pass expected_domain to wrapped browser scripts
The `expected_domain` was removed from args for normalization but never
re-inserted, causing JS scripts to receive empty expected_domain and
report "missing_expected_domain" errors.

🤖 Generated with [Qoder][https://qoder.com]
2026-04-13 17:20:48 +08:00

1.7 KiB

Expected Domain Arg Fix Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Fix browser_script_skill_tool to pass expected_domain to wrapped JS scripts.

Architecture: Insert the normalized expected_domain back into args HashMap after domain normalization, before script wrapping.

Tech Stack: Rust, serde_json


Files

  • Modify: src/compat/browser_script_skill_tool.rs:210 - Insert expected_domain back into args

Task 1: Insert expected_domain into args

Files:

  • Modify: src/compat/browser_script_skill_tool.rs:210

  • Step 1: Add expected_domain to args after normalization

Edit src/compat/browser_script_skill_tool.rs, insert after line 209 (eprintln!("[execute_browser_script_impl] expected_domain: {}", expected_domain);):

    args.insert("expected_domain".to_string(), Value::String(expected_domain.clone()));

The context around line 209-211 should look like this after the edit:

    eprintln!("[execute_browser_script_impl]   expected_domain: {}", expected_domain);
    args.insert("expected_domain".to_string(), Value::String(expected_domain.clone()));

    for required_arg in tool.args.keys() {
  • Step 2: Run tests to verify the fix

Run: cargo test browser_script_skill_tool --no-fail-fast -- --nocapture

Expected: All tests pass, including execute_browser_script_tool_runs_packaged_script_with_expected_domain

  • Step 3: Commit
git add src/compat/browser_script_skill_tool.rs
git commit -m "fix: pass expected_domain to wrapped browser scripts"