Fix MCP prompts for resumed runs#5851
Conversation
|
🧪 Queued for QA validation — this PR has changes that need a manual QA pass before it's merged. Nothing needed from you; we'll update here once it's validated. Thanks for the contribution! 🙏 |
PerishCode
left a comment
There was a problem hiding this comment.
@mturac Thanks for the tight, well-scoped fix. I traced the resume path to confirm it: startRun in apps/daemon/src/mcp.ts now sets currentPrompt alongside message, which matches how the web chat surface always populates both fields (packages/contracts/src/api/chat.ts, examples.ts). This closes the real gap — when a resumed adapter skips the transcript, composeChatUserRequestForAgent (apps/daemon/src/server.ts:1420) reads bodySource from currentPrompt, so the previous MCP omission left the follow-up turn empty and let the run finish with no new artifacts. Setting currentPrompt on first runs is harmless: the form-answer transition only fires when the prompt matches the form-answers header, not a normal prompt. The mcp-runs.test.ts assertions were updated for both the plugin and active-context cases, and the red/green proof in the PR body is convincing. Nice, focused bugfix.
Fixes #5810
Why
While following the confirmed daemon-side trace in #5810, I reproduced the request-body gap in the MCP
start_runpath. The MCP prompt was persisted asmessage, but resumed sessions consumecurrentPromptwhen the transcript is skipped. That left a follow-up run without its latest user turn and allowed it to finish successfully without producing new artifacts.What users will see
Repeated MCP
start_runcalls on the same conversation now deliver the latest prompt to the resumed session. Follow-up requests can produce the requested artifacts instead of silently completing with no new output.Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-pack/tools-prflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
Not applicable; this change has no UI surface.
Bug fix verification
apps/daemon/tests/mcp-runs.test.tscurrentPromptfield before the source change (2 failed, 30 passed), then passed after the fix (32 passed).Validation
corepack pnpm --filter @open-design/daemon exec vitest run -c vitest.config.ts tests/mcp-runs.test.tscorepack pnpm --filter @open-design/daemon typecheckcorepack pnpm guardgit diff --check