fix(mcp): accept digest settle results in the interaction output schema

Merged
TH
5d ago
+67-12

Summary

MCP clients rejected every settled press, click, fill, longpress, and hover result requested with responseLevel: "digest". Claude Code reported "Structured content does not match the tool's output schema: data/settle/diff must have required property 'lines'", so the agent lost a tap that had already landed. Observed in 12 of 179 device calls in an external agent run on 0.21.36.

Cause: the daemon settle digest drops diff.lines and keeps diff.summary plus settle.refs, but the advertised output schema still required lines. The daemon views and the MCP schemas have different owners, and nothing compared them.

  • lines is now optional in the settle observation schema, documented as absent at the digest level.
  • New guard test/output-economy/mcp-output-schema.test.ts: real daemon output (fake web provider) for snapshot, get, settled click with and without the tail, screenshot, and network, at default and digest levels, must validate against the advertised MCP outputSchema.

2 files.

Also fixes two flaky tests that fail other PRs' CI: the project-config leak check matched the CI temp path agent-device-test-run-12303 (now collision-free sentinels), and the tmpdir orphan test raced kill ESRCH when a runner exited between the liveness check and the signal.

Validation

  • Base origin/main schema: the new guard fails on settled click digest and settled click tail digest with $.settle.diff.lines: missing required property.
  • Head 1da1634376: 13/13 pass.
  • pnpm check:affected --run --head 1da1634376: all runnable checks passed (exactCommit=true).
  • Not device-facing (schema and test only).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.