fix(mcp): compact server instructions to stay under 2,048 character limit - #7100
Conversation
…imit [PARS-IDEMPOTENCY:branch:bcefc8153deb885db48d58aa07230a33d0fb31d58939f643b812075b3d5d52e7]
|
Hey @rookepoole — thanks for tightening this up. Keeping the fix focused in I’m routing this through pool review now, and because this changes a live |
PerishCode
left a comment
There was a problem hiding this comment.
The compacted instructions fit the intended scope, but the polling guidance now removes an explicit user-control exception. Please restore that behavior before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.| '- Cloud mode: check login status first; if signed out, call sign-in tool and show activation URL/code.', | ||
| '- create_project(name) first if needed; start_run requires an existing project.', | ||
| '- start_run(prompt, requestId, [skill], [plugin], [inputs]) starts generation. Generate UUID requestId once per action; reuse verbatim on retries.', | ||
| '- Poll get_run(runId) every 30–60s until terminal. Runs take 5–30m; unchanged files = inner agent thinking, NOT a hang. Do NOT cancel or use write_file.', |
There was a problem hiding this comment.
Preserve explicit user cancellation in this rule. The new unconditional Do NOT cancel conflicts with the exposed cancel_run capability when the user asks to abort; the replaced instructions explicitly said cancellation was allowed in that case. Because these server instructions guide MCP hosts' tool choice, a host following this line can refuse a valid user request and leave a long-running 5–30 minute job consuming resources. Reword this compactly to say not to cancel or substitute write_file unless the user explicitly asks to abort.
|
Hey @rookepoole — PerishCode’s blocking note is the one to address on this head: please restore the explicit user-cancellation exception so the guidance stays compatible with Once that wording is back in and the checks finish cleanly, this should be in much better shape. 💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …): |
|
Heads-up: PR #7101 is also open against this same area — both PRs update |
PerishCode
left a comment
There was a problem hiding this comment.
The compact payload is under the host limit on this head, and the earlier cancellation exception is partly restored. Two workflow semantics remain ambiguous or incomplete, and the cap itself is not regression-tested; these need correction before this instruction rewrite is safe to merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.| 'GENERATING / REFINING DESIGNS (OD spawns its own inner agent):', | ||
| '- collect_brief first for new artifacts unless user asks to skip. Confirm brief card; never show draft IDs/nonces.', | ||
| '- list_skills / list_plugins to discover capabilities. list_agents before start_run.agent (do not guess IDs).', | ||
| '- Cloud mode: check login status first; if signed out, call sign-in tool and show activation URL/code.', |
There was a problem hiding this comment.
Restore polling until Cloud sign-in is complete. This line now stops after initiating the browser/device flow and showing its activation data, but the changed instructions previously required polling the login-status tool until loggedIn:true. The sign-in tool can return while loginInFlight is still true (as covered by apps/daemon/tests/mcp-vela-login.test.ts), so a host following this shortened sequence can call start_run before authentication completes. Keep the compact wording, for example: ‘If signed out, call sign-in, show activation URL/code, then poll login status until loggedIn:true.’
| '- Cloud mode: check login status first; if signed out, call sign-in tool and show activation URL/code.', | ||
| '- create_project(name) first if needed; start_run requires an existing project.', | ||
| '- start_run(prompt, requestId, [skill], [plugin], [inputs]) starts generation. Generate UUID requestId once per action; reuse verbatim on retries.', | ||
| '- Poll get_run(runId) every 30–60s until terminal. Runs take 5–30m; unchanged files = inner agent thinking, NOT a hang. Do NOT cancel or use write_file unless user explicitly asks to abort.', |
There was a problem hiding this comment.
Separate the cancellation exception from the write_file prohibition. Grammatically, ‘Do NOT cancel or use write_file unless user explicitly asks to abort’ permits both actions after an abort request, even though write_file is never an abort mechanism and the replaced guidance forbade substituting it for the generation pipeline. That can make a host mutate project files while attempting to stop a run. Use unambiguous compact wording such as: ‘Never substitute write_file. Cancel only if the user explicitly asks to abort.’
| '- "PPT"/"deck"/"doc"/"PDF" can mean native HTML or binary export (.pptx/.pdf). Ask user which before starting.', | ||
| '- Project args accept UUID or name substring (check resolvedProject in response).', | ||
| ].join('\n'), | ||
| }, |
There was a problem hiding this comment.
Add a regression test for the fully assembled server instructions, including MCP_SERVER_INSTRUCTIONS. The PR’s stated bug is exceeding a 2,048-character host cap, but these changed lines have no executable guard; on this head the complete payload is already 2,026 UTF-8 bytes, leaving only 22 bytes of margin, and the follow-up cancellation edit increased it after the author’s documented 1,974-character check. A small future wording fix can therefore silently recreate the truncation. Extract/export the assembled instruction string (or a focused builder), then assert in apps/daemon/tests/ that Buffer.byteLength(instructions, 'utf8') <= 2048 and that the critical run/login/cancellation phrases remain present.
|
Hey @rookepoole — thanks for the update. On this head, the remaining blockers are the ones @PerishCode called out in the latest review/comments: keep polling Cloud login status until Once those are addressed and the checks finish cleanly, this should be ready for another pass. |
Why
Claude Code and other MCP hosts truncate server instructions at 2,048 characters (2 KB). The existing instructions block was ~5,859 characters, causing 65% of the text to be truncated mid-sentence before the run-commissioning guidance (
start_run,get_run,list_skills,collect_brief, etc.).What users will see
Calling agents connected via
od mcpreceive complete, non-truncated server instructions. Run-commissioning guidelines (collect_brief,start_run,get_run,list_skills,list_plugins,list_agents, idempotency contracts, polling rules) are now front-loaded and condensed so that all instructions comfortably fit within the 2,048-character limit (~1,974 characters total).Surface area checklist
skills/,design-systems/,design-templates/,craft/)Validation
Addresses #7098
Generated from a bounded immutable repository snapshot by PARS-Agent using Gemini 3.6 Flash. Tests listed above are recommendations unless GitHub checks report otherwise.