t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Screen capture from an MCP server spawned by T3 Code is denied while T3 Code (Nightly) has Screen Recording granted

Open albert2704 opened this issue 2 weeks ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. On macOS, grant System Settings > Privacy & Security > Screen & System Audio Recording to T3 Code (Nightly) and relaunch the app.

  2. Configure a screen-capture MCP server in the provider config T3 Code launches, e.g. ~/.config/opencode/opencode.json:

    {
      "mcp": {
        "peekaboo": {
          "type": "local",
          "command": ["npx", "-y", "@steipete/peekaboo", "mcp", "--allow-foreground"]
        }
      }
    }
    
  3. In a thread, ask the agent to screenshot the T3 Code window (peekaboo.image / peekaboo.see with app_target: "com.t3tools.t3code").

Expected behavior

The capture succeeds, because T3 Code (Nightly) is granted Screen Recording.

Actual behavior

Both calls are denied:

peekaboo.image({ app_target: "com.t3tools.t3code" })
→ Screen Recording permission is required. Grant via: System Settings > Privacy & Security > Screen & System Audio Recording

peekaboo.see({ app_target: "com.t3tools.t3code" })
→ Failed to capture UI state: Desktop observation target was not found: shareable window for T3 Code (Nightly).
  Candidates: #0 id=278589 '<untitled>' 500x500 alpha=1.00 reason=window minimized;
  #1 id=278584 '<untitled>' 2560x30 alpha=1.00 reason=window minimized;
  #2 id=278583 '<untitled>' 2560x30 alpha=1.00 reason=window minimized;
  #3 id=278582 '<untitled>' 2560x30 alpha=1.00 reason=window minimized;
  #4 id=278581 '<untitled>' 2560x30 alpha=1.00 reason=window minimized

The error points at a setting that is already on, so there is no actionable next step for the user.

Impact

Major degradation or frequent failure

Version or commit

0.1.10-nightly.20261115.4736

Environment

macOS 27.0 (26A428), MacBookPro18,1, external 2560x1440 display online and main, session unlocked, AppleClamshellState = No. T3 Code (Nightly) desktop app, provider opencode_go_secondary (the opencode CLI is spawned by the app), MCP server @steipete/peekaboo 4.9.8.

Logs or stack traces

Process chain, verified with ps, so the MCP server is a descendant of the app:

11925  /Applications/T3 Code (Nightly).app/Contents/MacOS/T3 Code (Nightly)
11946    └─ T3 Code (Nightly) .../app.asar/apps/desktop/dist-electron/...
12502       └─ ~/.local/bin/opencode serve --hostname=127.0.0.1 --port=61597
12566          └─ npm exec @steipete/peekaboo mcp --allow-foreground
12746             └─ peekaboo mcp --allow-foreground

Reproduced outside the MCP as well, from a plain shell whose ancestry is T3 Code → vibe-acp → zsh:

$ peekaboo see --app "T3 Code (Nightly)" --no-elements
Error: Desktop observation target was not found: shareable window for T3 Code (Nightly).
Candidates: #0 id=278673 '<untitled>' 500x500 alpha=1.00 reason=window minimized; ...

$ peekaboo see --no-elements          # no --app, so it picks another app
Error: Desktop observation target was not found: shareable window for Microsoft Edge.
Candidates: #0 ... reason=window marked non-shareable; #2 ... 2560x1327 ... reason=window marked non-shareable

Every window of every app is reported as minimized or non-shareable while the display is on and the session is unlocked (CGSessionCopyCurrentDictionary has no CGSSessionScreenIsLocked, kCGSSessionOnConsoleKey = 1). That is the signature of a missing Screen Recording grant: without it, ScreenCaptureKit returns windows with isOnScreen = false, which peekaboo reports as "window minimized". The reasons are a symptom, not the cause.

Signing identities:

T3 Code (Nightly).app   Identifier=com.t3tools.t3code   TeamIdentifier=not set   CodeDirectory flags=0x0(none)   signed 15 Nov 2026 22:40:50
peekaboo                Identifier=boo.peekaboo.peekaboo   TeamIdentifier=FWJYW4S8P8   hardened runtime

codesign --verify --strict passes on the app bundle and Info.plist carries the usage descriptions, so this is not the broken-signature case from #728.

Analysis

The grant is recorded for the app bundle, but the ScreenCaptureKit call is made by a separately signed child process (boo.peekaboo.peekaboo) that T3 Code spawns through the provider CLI. Two candidate causes, which I could not separate without reading the TCC database (no Full Disk Access on this machine):

  1. TCC attributes the capture to the child's own signing identity, which has no grant, so the app-level grant never applies.
  2. The nightly app is ad-hoc signed and re-signed on every update, so the stored grant no longer matches the app's cdhash while the System Settings toggle still reads enabled.

Related: #728 (closed, not planned) covers the same TCC-for-child-processes class for microphone and camera; #17225 covers re-approval after updates; #17797 proposed a macOS helper for exactly this permission problem.

Workaround

None found. Restarting the app did not change the result.

albert2704 avatar Nov 15 '26 15:11 albert2704

@albert2704 Where did your copy of T3 Code (Nightly) come from, and was it re-signed after download? The published 0.1.10-nightly.20261115.4736 build is Developer ID-signed (Team ARK85ZXQ4Z, hardened runtime, signed 12:21 PM), but yours shows TeamIdentifier=not set and flags=0x0, signed at 22:40. If you install the official download from the GitHub release, then turn Screen Recording off and on again for it in System Settings and relaunch, does peekaboo capture work?

juliusmarminge avatar Nov 23 '26 04:11 juliusmarminge

Confirming this also reproduces on an official Developer ID–signed Nightly build (so it is not limited to ad-hoc / re-signed builds).

Environment:

  • App: T3 Code (Nightly).app 0.1.13-nightly.20261126.5305 (com.t3tools.t3code)
  • Signing: Developer ID Application: T3 Tools, Inc. (ARK85ZXQ4Z), hardened runtime (flags=0x10000), notarized (Notarization Ticket=stapled), NSScreenCaptureUsageDescription present in Info.plist
  • OS: macOS 27.2 (26B5112a, arm64)

Behavior:

  • T3 Code (Nightly) already has Screen Recording permission enabled in System Settings > Privacy & Security > Screen & System Audio Recording.
  • Whenever an agent spawned by T3 Code attempts to take a screenshot, macOS still prompts for Screen Recording privacy permission attributed to T3 Code.

deepfry666 avatar Nov 27 '26 07:11 deepfry666