[Bug]: preview_resize times out and leaves viewport state internally inconsistent
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
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
-
Start T3 Code Desktop.
-
Open a Codex-backed thread with the T3 preview MCP tools available.
-
Serve any local web page and open it in the preview:
python -m http.server 8000 --directory build/site{ "show": true, "reuseExistingTab": false, "url": "http://localhost:8000/index.html" } -
Call
preview_resizein freeform mode:{ "mode": "freeform", "width": 1920, "height": 1200, "timeoutMs": 15000 } -
Check both
preview_statusand the live DOM viewport:({ innerWidth, innerHeight, devicePixelRatio }) -
Repeat with
mode: "fill"and with theiphone-12-propreset. -
Call
preview_snapshotafter the resize attempts.
Expected behavior
preview_resize should either:
- complete successfully and make
viewportSetting, measuredviewport, live DOMinnerWidth/innerHeight, and snapshot screenshot size agree, or - fail without partially changing tab state.
If exact sizing is impossible, the tool should return the effective viewport and explain the mismatch.
Actual behavior
Each resize call timed out after 15 seconds but still partially changed state.
After freeform 1920x1200, preview_status reported the requested setting while the measured viewport and live DOM viewport stayed at 1280x800:
{
"viewportSetting": { "_tag": "freeform", "width": 1920, "height": 1200 },
"viewport": { "width": 1280, "height": 800 }
}
{
"innerWidth": 1280,
"innerHeight": 800,
"devicePixelRatio": 2.190890312194824
}
Later, the same requested setting drifted to a measured viewport of 2103x1314.
After a timed-out fill resize, measured and live viewport changed to about 410x987.
After a timed-out iphone-12-pro preset resize, viewportSetting changed to 390x844, but measured and live viewport were about 427x924:
{
"viewportSetting": {
"_tag": "preset",
"width": 390,
"height": 844,
"presetId": "iphone-12-pro"
},
"viewport": { "width": 427, "height": 924 }
}
preview_snapshot also returned a PNG screenshot sized 1280x800 while preview_status reported a measured viewport of 2103x1314.
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
Representative resize failure:
PreviewAutomationTimeoutError: Preview automation resize timed out after 15000ms.
The important diagnostic is that status/live viewport values diverge after the timeout, as shown above.
Screenshots, recordings, or supporting files
No response
Workaround
After any resize timeout, treat viewport state as unknown. Measure the effective viewport with preview_evaluate using innerWidth and innerHeight, and compute interaction coordinates from live DOM geometry instead of snapshot coordinates.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the preview_resize, preview_status, and preview_snapshot entry points and reproduce the freeform, fill, and iphone-12-pro timeout cases. Trace the timeout path and compare the requested setting, measured viewport, live DOM dimensions, and screenshot size. Done means successful resizes keep these values consistent, while failures leave tab state unchanged or report the effective viewport.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100