fix(mcp): preserve actionable device screenshot errors #25216
main fromrefs/pull/25216/head·merged by maria-rcks View on GitHubProblem#
device_screenshot hides actionable typed errors from agents and omits their messages from structured results. A reachable hub's HTTP rejection is also mislabeled as a transport failure.
Change#
Preserve recognized device errors' public messages in both MCP result formats, with device-list/reopen guidance for hub rejection. Classify non-2xx screenshot responses as hub_rejected; keep unknown failures generic and nested diagnostics private.
Verification#
- Six regression cases failed on main before the fix: missing/open-device errors, transport failure, hub rejection, and HTTP 400/500 classification.
- Blacksmith: 55 focused tests pass;
vp run check:changedpasses format, lint, knip, GraphQL generation, affected typechecks, and nearby tests. - Runtime: production hub operations with the Node HTTP client against a loopback HTTP 500 returned
hub_rejectedand its public message. - GitHub CI passes; the head is mergeable. Two independent GPT-6.1-Sol reviews found no actionable issues. Macroscope approved; CodeRabbit was rate limited and did not review.
- Unverified: a live provider turn, physical device/simulator capture, and SSH transport. No UI changes.
Takeover#
Replaces #24040, with thanks to @nateEc for the original implementation.
Built with GPT-6.1-Sol in the Codex harness on T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
8260a35Macroscope's review found this PR approvable — Screenshot failures now distinguish hub rejection from communication failure and provide conditional device-list/reopen guidance. The change affects error reporting only, without automatically changing device state or exposing nested diagnostics.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 21.6 KiB 21.6 KiB 0 B (0.0%) 24.4 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅ Claude Live turn messages 1 1 0 (0.0%) 8 ✅ Baseline:
476590d· PR result:8260a35· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
verified the no-open-device error paths on linux through the actual web composer → codex
gpt-6.1-sol→ t3-code mcp → running dev server. used repo playwright and/usr/bin/google-chrome; created the projects and threads through the app and enabled device access in settings. no mocks or scenario fixtures.- before:
github/mainatf6d3700ac3, installed withvp iin../main. bothdevice_screenshot({})anddevice_screenshot({deviceId:"missing",hostId:"local"})returned onlyDevice screenshot failed.and omittederror.messagefrom structured content.device_listconfirmed no open devices. - after: exact head
c313e782817ee44b3e70668a26b5be77c9950519, installed withvp i, running in an explicit isolated.t3home after stopping main. the same calls returnedNo device is open in this thread. Call device_open first.andDevice missing on host local is not open in this thread. Call device_open first.respectively. both text andstructuredContent.error.messagecarried the exact message. - neighbors:
device_listsucceeded;device_close({})on the empty thread succeeded, and a subsequent list still returneddevices:[]andopen:[]. - existing focused tests passed on blacksmith: 57 tests across
McpHttpServer.test.ts,DeviceService.test.ts, andMcpDeviceToolkit.test.ts. existing ci reports 29 successful checks, none failing or pending. no source changes or pushes.


Not verified#
successful device image capture, actual hub http rejection / transport failure, ssh device hosts, physical devices, native ios/android clients, and macos/windows. device listing reports ios requires macos/xcode and android emulator is missing; no remote hosts are configured. the http 400/500 classification and private-diagnostic filtering passed existing tests, but those are not live-device verification. no visual or timing behavior changed, so server tool-response transcripts and screenshots are the evidence.
setup note: the first pr launch from the root checkout defaulted to
~/.t3; it was stopped and restarted with--home-dir /home/user/t3code/.t3before any pr provider turns. the reported after results use only the isolated server.- before:
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Note
Written by
gpt-6.1-solon behalf of Mariaverified head
8260a35ca348c9cc33ed1e198abddf55f326631fafter merginggithub/mainwith a merge commit. the conflict resolution preserves main's actionable host errors and this pr's hub rejection guidance. updated the existing screenshot regression mock for main'slocateSessionlookup. the diff remains four files.- blacksmith
vp run check:changedpassed: format, lint, knip, graphql, typecheck of three packages, and 70 tests. neighboringMcpDeviceToolkit.test.tspassed 14/14. - two independent read-only reviewers approved this exact head with no remaining findings.
- ran a real codex
gpt-6-lunaturn through an isolated dev server and inspected its completed thread in the web client using playwright with/usr/bin/google-chrome. device_screenshot({})returnedNo device is open in this thread. Call device_open first.in text andstructuredContent.error.message.device_screenshot({"deviceId":"missing","hostId":"local"})returnedDevice missing is not open in this thread. Call device_open first.in both fields.device_list, emptydevice_close, and the subsequentdevice_listsucceeded. the disabled-access guard also returned its actionable error in both screenshot fields.- all 32 checks are green, github reports
CLEAN/MERGEABLE, and there are no inline review comments. no merge performed.
successful image capture, live hub rejection/transport failures, remote device hosts, physical devices, and native clients remain unverified here. HTTP 400/500 classification and diagnostic filtering are covered by the passing existing tests. no UI code changed.
- blacksmith
maria-rcks merged thisc3d8c4b
maria-rcks closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review.
e00fd6b4-c07c-472e-bc08-5978ba0e0126Reviewing files that changed from the base of the PR and between 476590d0adede15a4eec0d05b8adac8c63736452 and 8260a35ca348c9cc33ed1e198abddf55f326631f.
apps/server/src/device/DeviceHubOperations.tsapps/server/src/device/DeviceService.test.tsapps/server/src/mcp/McpHttpServer.test.tsapps/server/src/mcp/McpHttpServer.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Walkthrough
Screenshot HTTP status-code errors now map to
hub_rejected. MCP screenshot errors return recognized messages, with additional guidance for hub rejections.Changes: Screenshot error handling
apps/server/src/device/DeviceHubOperations.ts,apps/server/src/device/DeviceService.test.tshub_rejected. Tests cover HTTP 400 and 500 responses.apps/server/src/mcp/McpHttpServer.ts,apps/server/src/mcp/McpHttpServer.test.tsEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
Suggested labels:
bugfixSuggested reviewers:
juliusmarminge,gabrielelpidioMerge Risk:
Minimal · up to
8260aScreenshot failures provide actionable messages while keeping hub diagnostics private. No material merge risk remains.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "fix(mcp): preserve actionable device screenshot errors" follows conventional commit format and names the main change. The raw summary shows changes to McpHttpServer's screenshot error formatter, which keeps recognized device error messages in results. It also shows hub HTTP non-2xx responses classified as hub_rejected in DeviceHubOperations, which the title does not mention. That part is a secondary aspect of the change.
Full details: Description check
Explanation
The description covers the Problem, Change, and Verification sections from the template. The Problem and Change sections are clear and specific. The Verification section lists focused tests, a check run, a runtime check against loopback HTTP 500, and unverified areas. The Scope and approval section is missing. It has no linked issue, no maintainer-approved discussion, and no explanation for an exemption. The description says it replaces
#24040but does not link a triaged issue or approval. The template requires this section, so the description is not fully complete. Most of the template is filled, so the check passes.Resolution
Add the "Scope and approval" section. Link the triaged bug issue or the maintainer-approved discussion, including the approval comment. If no prior issue exists, explain why this small, focused fix of an obvious bug qualifies for an exemption. The
#24040reference may serve as context but does not replace the approval link.Finishing Touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.