Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesCarries bounded MCP server instructions into embedded prompts, Tool Search results, and Code Mode metadata. Example: The research server exposes search and instructs clients to confirm before paid calls.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a verified embedded MCP guidance gap; the previous integration blocker is resolved, and no actionable introduced defect remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherMCP initialization supplies raw server guidance to the catalog; tool materialization prepares embedded metadata consumed by prompts and discovery, while the native CLI bridge retains complete guidance. flowchart TD
A[MCP initialization] --> B[Raw server catalog]
B --> C[Embedded metadata materialization]
C --> D[Direct system prompt]
C --> E[Tool Search and Code Mode]
B --> F[Native CLI loopback]
Technical reviewBest possible solution: Land the shared embedded metadata projection while keeping raw catalog guidance complete for native consumers. Do we have a high-confidence way to reproduce the issue? Current main reads raw server instructions but omits them from embedded tool metadata and prompts; the linked report and recorded baseline provider requests demonstrate the resulting missing guidance. Is this the best way to solve the issue? The smallest complete fix attaches prepared guidance at the existing materialization owner and carries it through existing prompt and discovery owners, preserving native consumers and execution policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a69d352fdc59. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +167, Tests +483, Docs +10. Total +660 across 24 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (13 earlier review cycles; latest 8 shown)
Reviewed October 20, 2026, 9:44 AM ET / 13:44 UTC (Revision 14). |
c61e357 to
0105157
Compare
0105157 to
d33ac22
Compare
d33ac22 to
a4ada1d
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Addressed the three new P2 findings on
Validation: Live provider behavior proof remains unavailable in this environment; I did not fabricate it. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Pushed |
…-instructions-174272
|
The branch now includes the latest |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer override: The identical two cases and 30-second disabled-button timeout occur on unrelated PR #177875, head This diff changes MCP instruction delivery in the embedded agent, not Control UI module loading, connection recovery, or the mocked sidebar fixture. The agent/MCP focused lanes, typechecks, prompt snapshots, security checks, and build proof pass. The CI gate failure is the aggregate consequence of this UI failure. Cancelled jobs: 0. No jobs were rerun and no extra push was made to obtain green. |
|
Merged current main into the branch as Fresh CI on the new head now passes both |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # src/agents/tool-search.metadata.test.ts # src/agents/tool-search.ts # test/fixtures/agents/prompt-snapshots/local-ollama/default-tool-surface.json
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in f874f24. Thanks @xiaopan-xydt. Embedded agents now get MCP server instructions (capped at 2,000 characters per server). |
Fixes #174336
What Problem This Solves
Fixes: embedded agents receive an MCP server's tools without its initialization guidance about sequencing, confirmations, quotas, or retries.
User Impact
Embedded agents receive guidance for available MCP tools in their direct prompt or deferred Tool Search / Code Mode metadata. Each server contributes at most a 2,000-character prefix plus a truncation marker. Servers without instructions keep their existing surface. Claude CLI loopback guidance remains whole and unchanged.
Why This Change Was Made
Reuse the initialization read and raw catalog fields landed in #172026 rather than maintaining a second reader or duplicate fields. The cap belongs only to embedded tool-metadata materialization, leaving #172026's native Claude contract intact. Prepare each server's bounded metadata once, cut without splitting a Unicode surrogate pair, append
…[truncated: server instructions exceed 2000 characters]when needed, then neutralize prompt delimiters and model control tokens. All three embedded delivery paths consume that same text; omitted trailing guidance cannot be recovered through discovery.This bounds prompt cost for model-facing descriptive metadata, consistent with Codex surfacing server instructions as a namespace description; it does not claim Codex uses this cap.
The original contributor's commits and credit are preserved. The overlapping contributor PRs #174425, #174508, and #174396 can be closed as superseded once this lands.
Evidence
Built head
0ec710a2ec4cdcaaeb97f1cd99150e9339659987, local stdio MCP server, recording OpenAI-compatible provider, and a shippedopenclaw agentturn through an isolated Gateway:The long server sends more than 3,500 characters. The recorded provider request contains exactly the retained 2,000-character prefix, with prompt delimiters neutralized afterward, plus one truncation marker; the trailing rule is absent. The regression covers a surrogate-pair boundary and verifies that the raw catalog still preserves the complete text. The existing short-instruction regression is unchanged.
Native preservation: #172026's configured-MCP loopback tests now use guidance longer than 2,500 characters and require the complete text and trailing rule across ordinary/completion turns. Its allowed, denied, and requester-capped cases pass, as do existing-session, completion-tool, and configured-MCP HTTP authority tests.
100 tests pass across nine focused files in 112.32 seconds, covering embedded delivery/revocation, materialization, Code Mode, Tool Search metadata, prefix stability, and the native boundaries above. Targeted formatting/lint pass. Prompt fixtures were regenerated with the canonical generator. A fresh
openai/gpt-5.4-miniturn completes successfully and returns the requested marker.Original missing-instructions proof is retained: main
7a628b0adaaomits the guidance in two recorded provider requests; candidate4d46784da23includes it in both. A server without instructions has identical tool definitions and an identical system prompt after normalizing only the separate proof workspace/repository paths.Merge danger: two-way door; reverting removes embedded prompt/metadata additions and writes no new persistent state or config. Blast radius: embedded agents using MCP tools, including Tool Search and Code Mode. Native Claude CLI's complete-guidance contract is preserved.