Skip to content

[Bug]: Sugar issues with browser automation #33

@cdnsteve

Description

@cdnsteve

Bug Description

Why Sugar wasn't executing:

  • Sugar's Claude subprocess doesn't have Playwright MCP access
  • Tasks were being marked complete after creating files, not after running tests
  • Sugar is optimized for code generation, not browser automation

Solution implemented:

  • Created bin/stripe_e2e_test.rb - executable test script
  • Runs via rails runner (no browser needed)
  • Creates real Stripe customer, subscription, payment
  • Outputs promise tag when successful

Steps to Reproduce

  1. Add a task requiring browser automation: sugar add "E2E test: use Playwright to navigate to localhost, fill form, click submit" --type test --priority 1
  2. Run sugar run
  3. Task gets marked as "completed" almost immediately
  4. Check Stripe dashboard / database - no actual test execution occurred
  5. Check .sugar/sugar.log - shows "No work items ready for execution" after task completes

Expected Behavior

Sugar should execute the task using Claude Agent SDK, actually run the browser automation (via MCP servers if configured), and only mark complete when real artifacts are created (e.g., Stripe customers, screenshots, database records).

Actual Behavior

Sugar's Claude agent creates test FILES but doesn't EXECUTE them. Tasks are marked complete without actual execution:

  • No new Stripe customers created despite "E2E Stripe test" tasks
  • No screenshots captured despite "use Playwright" instructions
  • Logs show task "completed" in ~1 second (impossible for real E2E test)
  • MCP servers configured in config.yaml but not passed to Claude subprocess

Sugar Version

3.3.0

Python Version

3.14

Operating System

macOS

Using Claude Code Plugin?

Yes

Relevant Logs

2026-01-04 19:54:52 - sugar.core.loop - INFO - ⏭️ Skipped 18 duplicate work items
  2026-01-04 19:54:52 - sugar.core.loop - INFO - No work items ready for execution
  2026-01-04 19:54:52 - sugar.core.loop - INFO - 📊 Queue stats: 0 pending, 45 completed, 0 failed

Additional Context

Config includes MCP servers but they don't appear to be used:

mcp_servers:
  playwright:
    command: "npx"
    args: ["-y", "@anthropic/mcp-playwright"]

Workaround: Create executable scripts (e.g., bin/stripe_e2e_test.rb) that Sugar can run via bash, rather than relying on Claude agent to use Playwright MCP tools directly.

The Claude Agent SDK subprocess may not be receiving the MCP server configuration, or the spawned Claude instance doesn't have access to the same MCP tools as the parent Claude Code session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions