feat(server): pages a terminal command opens show up in the thread's browser #44437
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.46) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 463 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #44437"
general
weight: 0.35
mvanhorn
Problem
When a command in an integrated terminal opens a browser, such as
gh auth login --web, an OAuth device flow, or a dev server's--open, the page goes to the host machine's default browser. That's no use when T3 Code runs on a remote host or you're on web or mobile, and on a headless host there's no browser at all.Demo
!Terminal links open in the thread's browser
An explainer of the flow; the UI is drawn, not a screen capture.
Change
Integrated terminals now set
BROWSERto a small generated script that runst3 browser open <url>. The command asks the running server (newPOST /api/preview/open,preview:operatescope) to open the page as a new tab in the thread's browser panel. It uses the samePreviewManager.openpath as a user opening a tab, so the tab works on every surface and belongs to the user, not an agent.BROWSERthe user or provider already set, even an empty one, is kept.launchBrowser, withBROWSERcleared soxdg-opencan't loop. If that fails too, it prints the URL. It always exits 0, so tools likeghdon't treat the fallback as an error..cmdwrapper re-parses the&in the sign-in URLs this is for. The docs say so.BROWSERis set if the script path contains whitespace, quotes, a backslash,$or a backtick, because tools shell-split the variable.Scope
A small feature from a vouched contributor. No existing issue; searched issues and PRs for
BROWSERand terminal browser opening.Verification
Live, against
vp run devfrom this branch in the web client:envshowsBROWSER=<worktree>/.t3/userdata/bin/t3-browser.https://example.comopened the page in that thread's floating browser preview, and the command printedexit=0.PreviewManager.open, a re-run showed "You have control". The tab now uses the user's default cookie profile and is not closed as an idle agent tab.PATH, the script prints the URL and exits 0. Run with no URL, it prints usage and exits 1.Tests:
preview/ThreadBrowser.test.ts(new): an unknown thread fails and creates no tab; a known thread gets one server tab withreveal: trueand noautomationOwner. The automation-owner case fails on the first version.preview/http.test.ts(new): auth scope, non-http(s) URL rejected, unknown thread returns 404.terminal/browserCommand.test.ts(new): the script reaches this server's own state; no script on win32.terminal/Manager.test.ts: aBROWSERfrom the server env or runtime env (even empty) is kept, on linux and on win32 with mixed-case keys.cli/browser.test.ts: opens in the terminal's thread; falls back to this host when T3 can't open it or outside a thread's terminal; leaves non-web URLs to this host; prints the URL when nothing can open it.vp run check:changedpasses (format, lint, knip, graphql, typecheck, tests). Not checked: the desktop app's native tabs (the request always used the server browser, and the new path doesn't change that), mobile, and a realgh auth login --webround trip.Written with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code