fix(prompt+tools): inject A2A/HMA docs + unify LangChain tool names with MCP - #2237
Merged
HongmingWang-Rabbit merged 1 commit intoApr 28, 2026
Merged
Conversation
Workers were registering platform tools (delegate_task, delegate_task_async, list_peers, check_task_status, send_message_to_user, commit_memory, recall_memory) but the build_system_prompt assembly never included documentation for any of them. The instruction-text functions get_a2a_instructions() and get_hma_instructions() exist in executor_helpers.py and have unit tests, but were not called from any production code path — workers received system-prompt.md content only and saw the tools as bare names with no usage guidance. Symptom: agents called commit_memory and delegate_task without knowing they were platform tools. They worked when the agent guessed the API correctly and silently failed when the agent didn't. Fix: build_system_prompt() now appends both instruction sets between the Skills section and the Peers section. The placement is intentional — A2A docs explain how to call delegate_task; the peer list is the data that delegate_task operates over, so the docs precede the peer table. New parameter `a2a_mcp: bool = True` lets adapters opt into the CLI subprocess variant of the A2A instructions for runtimes without MCP support (ollama, custom CLI runtimes). Default True covers the MCP-capable majority (claude-code, hermes, langchain, crewai). Adapter callers don't need to change unless they specifically need CLI mode. Tests: 4 new regression tests in test_prompt.py pin - A2A MCP variant injection (default) - A2A CLI variant injection (a2a_mcp=False, with MCP-only fields absent) - HMA instruction injection - A2A docs precede peer list ordering Full suite green: 1223 passed, 2 xfailed.
HongmingWang-Rabbit
requested a review
from hongmingwang-moleculeai
as a code owner
April 28, 2026 23:44
HongmingWang-Rabbit
enabled auto-merge
April 28, 2026 23:44
HongmingWang-Rabbit
marked this pull request as draft
April 28, 2026 23:47
This was referenced Apr 28, 2026
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…ead moves (internal#816)' (#2237) from fix/816-sop-tier-check-stale-reviews into main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Workers were registering platform tools (`delegate_task`, `delegate_task_async`, `list_peers`, `check_task_status`, `send_message_to_user`, `commit_memory`, `recall_memory`) but the `build_system_prompt()` assembly never included documentation for any of them. The instruction-text functions `get_a2a_instructions()` and `get_hma_instructions()` exist in `executor_helpers.py` and have unit tests, but were never called from any production code path — workers received `system-prompt.md` content only and saw the tools as bare names with no usage guidance.
Symptom: agents called `commit_memory` and `delegate_task` without knowing they were platform tools. They worked when the agent guessed the API correctly and silently failed when the agent didn't.
Fix
`build_system_prompt()` now appends both instruction sets between the Skills section and the Peers section. The placement is intentional — A2A docs explain how to call `delegate_task`; the peer list is the data that `delegate_task` operates over, so the docs precede the peer table.
New parameter `a2a_mcp: bool = True` lets adapters opt into the CLI subprocess variant of the A2A instructions for runtimes without MCP support (ollama, custom CLI runtimes). Default `True` covers the MCP-capable majority (claude-code, hermes, langchain, crewai). Adapter callers don't need to change unless they specifically need CLI mode.
Tests
4 new regression tests in `test_prompt.py`:
Full workspace suite green: 1223 passed, 2 xfailed.
Test plan
🤖 Generated with Claude Code