Files
cleveragents-core/.opencode/async-agent-manager-migration.md
clever-agent 0eca98103e
CI / lint (push) Successful in 20s
CI / quality (push) Successful in 32s
CI / push-validation (push) Successful in 21s
CI / helm (push) Successful in 24s
CI / typecheck (push) Successful in 54s
CI / security (push) Successful in 59s
CI / benchmark-regression (push) Has been skipped
CI / build (push) Successful in 47s
CI / e2e_tests (push) Successful in 3m8s
CI / integration_tests (push) Successful in 4m1s
CI / unit_tests (push) Successful in 4m58s
CI / docker (push) Successful in 10s
CI / coverage (push) Successful in 10m16s
CI / status-check (push) Successful in 2s
CI / benchmark-publish (push) Has been cancelled
fix: replace async-agent-starter with comprehensive async-agent-manager
- Created new async-agent-manager to handle all async operations centrally
- Fixed permission issues where agents couldn't execute curl commands
- Updated all agents to use async-agent-manager instead of direct curl
- Only async-agent-manager has curl permissions to localhost:4096
- All other agents use it via Task tool with proper permissions
- Tested and verified all curl commands work correctly
- Added comprehensive operations: start, status, messages, search, cleanup, health monitoring
- Improved error handling with structured JSON responses
- Enhanced security with proper input escaping

This fixes the blocking issue where supervisors couldn't launch workers due to
environment restrictions on curl commands. Now all async operations go through
a single, well-tested agent with proper permissions.
2026-04-09 18:45:56 +00:00

3.7 KiB

Async Agent Manager Migration Summary

Problem Identified

The async-agent-starter subagent was failing because it tried to use bash with curl commands, but the environment was restricting these operations. The error message showed:

"I don't currently have the ability to run the required shell or HTTP commands from this environment"

Solution Implemented

1. Created New async-agent-manager.md

  • Renamed from async-agent-starter to better reflect its expanded responsibilities
  • Enhanced to handle all async agent operations:
    • Starting async agents
    • Getting session status
    • Retrieving session messages
    • Searching sessions by tag
    • Closing/cleanup sessions
    • Monitoring session health
  • Properly configured with explicit curl permissions to localhost:4096
  • Includes detailed curl command examples that have been tested and verified to work

2. Updated All Agents Using Async Operations

Primary Agent Updated:

  • product-builder.md:
    • Removed direct curl permissions to localhost:4096
    • Added permission to use async-agent-manager subagent
    • Updated launch_supervisor function to use async-agent-manager instead of direct curl
    • Updated all session status queries to use async-agent-manager
    • Updated session conversation retrieval to use async-agent-manager

Pool Supervisors Updated:

  • implementation-orchestrator.md: Updated all references from async-agent-starter to async-agent-manager
  • uat-tester.md: Added async-agent-manager permission and updated worker launch code
  • test-infra-improver.md: Added async-agent-manager permission and updated worker launch code
  • continuous-pr-reviewer.md: Added async-agent-manager permission and updated reviewer dispatch code
  • bug-hunter.md: Added async-agent-manager permission (already structured for worker dispatch)

Other Agents Updated:

  • subtask-loop.md: Updated all references from async-agent-starter to async-agent-manager
  • async-agent-monitor.md: Updated to use async-agent-manager for restart operations
  • system-watchdog.md: Added async-agent-manager permission and updated dispatch_one_off function
  • async-agent-cleanup.md: Removed direct curl permissions, added async-agent-manager permission
  • async-agent-cleanup-all.md: Removed direct curl permissions, added async-agent-manager permission

3. Key Design Principles

  1. Single Point of Control: Only async-agent-manager has permission to curl to localhost:4096
  2. Consistent Interface: All agents use the same Task tool interface to interact with async operations
  3. Proper Error Handling: The manager returns structured JSON responses for all operations
  4. Security: Properly escapes all inputs to prevent injection attacks
  5. Comprehensive Operations: Handles the full lifecycle of async sessions

4. Testing

Created and ran a test script that verified:

  • Session listing works correctly
  • Session status retrieval works correctly
  • Session creation returns proper session IDs
  • Async agent launch returns HTTP 204 (success)
  • Session deletion works correctly

Benefits

  1. Centralized Management: All async operations go through a single, well-tested agent
  2. Better Error Handling: Structured responses make it easier to handle failures
  3. Improved Security: Only one agent needs curl permissions to the API
  4. Easier Maintenance: Changes to the API only need to be updated in one place
  5. Consistent Patterns: All agents use the same interface for async operations

Migration Complete

All agents that previously used direct curl commands or async-agent-starter have been updated to use the new async-agent-manager. The old async-agent-starter.md file has been removed.