Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: preview_click returns success in hidden tabs but does not dispatch the click #3717

Closedgregbartell(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

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

Area

apps/desktop

Steps to reproduce

  1. Start T3 Code Desktop.

  2. Open a Codex-backed thread with the T3 preview MCP tools available.

  3. Save this minimal page as background-click-repro.html:

    <!doctype html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <title>T3 Preview Background Click Repro</title>
      </head>
      <body>
        <h1>T3 Preview Background Click Repro</h1>
        <p>Selected: <strong id="selected">Alpha</strong></p>
        <p>Click count: <strong id="count">0</strong></p>
        <button id="alpha" type="button" aria-pressed="true">Alpha</button>
        <button id="beta" type="button" aria-pressed="false">Beta</button>
        <script>
          let count = 0;
          const selected = document.querySelector("#selected");
          const countNode = document.querySelector("#count");
          const buttons = Array.from(document.querySelectorAll("button"));
          for (const button of buttons) {
            button.addEventListener("click", () => {
              count += 1;
              selected.textContent = button.textContent;
              countNode.textContent = String(count);
              for (const candidate of buttons) {
                candidate.setAttribute(
                  "aria-pressed",
                  candidate === button ? "true" : "false",
                );
              }
            });
          }
        </script>
      </body>
    </html>
  4. Serve the directory containing that file:

    python -m http.server 8000
  5. Open the page in a new hidden/background tab:

    {
      "show": false,
      "reuseExistingTab": false,
      "url": "http://localhost:8000/background-click-repro.html"
    }
  6. Verify evaluation works and capture the initial page state:

    ({
      selected: document.querySelector("#selected").textContent,
      count: document.querySelector("#count").textContent,
      betaMatches: document.querySelectorAll("#beta").length
    })

    Expected initial result:

    {
      "selected": "Alpha",
      "count": "0",
      "betaMatches": 1
    }
  7. Click the Beta button with a text locator:

    {
      "locator": "text=Beta",
      "timeoutMs": 15000
    }
  8. Check the page state again with the expression from step 6.

  9. Repeat with the preflighted CSS selector:

    {
      "selector": "#beta",
      "timeoutMs": 15000
    }
  10. Check the page state again.

Expected behavior

If a hidden/background tab supports navigation and evaluation, preview_click should dispatch clicks to matching elements in that tab or return a clear unsupported-state error.

After either preview_click call above, the page state should be:

{
  "selected": "Beta",
  "count": "1",
  "betaMatches": 1
}

It should not return a success-shaped result when the page did not receive the click.

Actual behavior

The hidden tab loaded normally and preview_evaluate worked.

The text-locator click returned null, but the page state stayed unchanged:

{
  "selected": "Alpha",
  "count": "0",
  "betaMatches": 1
}

The CSS selector was preflighted to match exactly one element. The CSS click also returned null without changing the page state:

{
  "selected": "Alpha",
  "count": "0",
  "betaMatches": 1
}

In an earlier run against a more complex page, a later retry timed out and evaluation on that background tab also began timing out. The minimal repro above focuses on the deterministic part: hidden-tab clicks can return null without dispatching.

Impact

Major degradation or frequent failure

Version or commit

T3 Code desktop 0.0.28-1 via t3code-bin AUR package.

Environment

Arch Linux x86_64, kernel 7.0.13-arch1-1, T3 Code desktop AppImage package via t3code-bin, Codex provider.

Logs or stack traces

No stack trace. The failing calls return null while the page state remains unchanged.

Screenshots, recordings, or supporting files

Minimal repro page attached above. A screenshot is not needed; the selected and count fields show whether the click dispatched.

Workaround

Use hidden/background tabs for navigation, waits, and evaluation only. Use a shown tab for click-heavy flows, and verify every click effect with preview_evaluate or preview_status.

  1. Confirming this still reproduces on 0.0.32-nightly.20260807.1022 (today's nightly, macOS desktop).

    Minimal repro, no local file needed:

    1. preview_open → {"url": "https://example.com", "open": false} → returns "visible": false, tab live.
    2. preview_click → {"locator": "role=link[name='Learn more']"}
    3. preview_evaluate → location.href → "https://example.com/". No navigation.

    The same click in a tab opened with open: true navigates correctly to https://www.iana.org/help/example-domains, so visibility is the deciding variable.

    Practical impact for us: any headless/background agent thread has visible: false by definition — nobody is rendering the thread-bound inline preview — so browser interaction is unavailable to automated agents entirely. Agents work around it with preview_navigate, which only covers link-following and not buttons, menus, or forms.

    Compounding factor: in the same call the response also fails MCP schema validation (structuredContent: null), so the agent gets an error that looks like the click failed for a different reason. Filed separately as #5583.

    — Jorge Mena

  2. FWIW my agents can't reproduce this any more on Linux as of 9/5/26 on commit 761d4bac1. They also retested v0.0.28 and the nightly mentioned above and those didn't reproduce either, so I don't know if there was a change to my local setup or Astra is too smart to do whatever dumb thing my agents were doing in July.

    I'm closing this ticket as can't repro - feel free to reopen if anybody else is still having this problem.

Sign in to join this conversation.