Skip to content

fix(asap): acquire agent mutex around inbound mcp.tool_call dispatch - #60

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cacritical-bug-management-18df
Draft

fix(asap): acquire agent mutex around inbound mcp.tool_call dispatch#60
cursor[bot] wants to merge 1 commit into
mainfrom
cacritical-bug-management-18df

Conversation

@cursor

@cursor cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bug and impact

Inbound mcp.tool_call ASAP envelopes executed tools via dispatch_tool_by_name() without acquiring agent_lock(), while task.request already held the mutex. Concurrent HTTP threads could run tools (shell, file, cron) during an active agent_run, racing on shared session/memory state.

Root cause

handle_mcp_tool_call() in src/asap/server.c omitted the mutex discipline documented in README and used by handle_task_request().

Fix and validation

Wrap tool dispatch (hook and default path) with agent_lock() / agent_unlock().

Existing test_asap_server coverage exercises mcp.tool_call paths.

Open in Web View Automation 

handle_mcp_tool_call executed tools without agent_lock while task.request
already held the mutex, allowing concurrent tool/session access from HTTP
threads during an active agent_run.

Co-authored-by: esadrianno <esadrianno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant