Skip to content

fix(browser): open in-app links as a tab in the clicked pane's group - #265

Merged
nplez1 merged 2 commits into
nplez1/mainfrom
nplez1/In-app-Browser-Tabs
Nov 1, 2026
Merged

nplez1 merged 2 commits into
nplez1/mainfrom
nplez1/In-app-Browser-Tabs

Conversation

@nplez1

@nplez1 nplez1 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Why

Clicking a link that routes into the in-app browser — the Checks panel's PR id, a terminal link, a chat link — split a new pane beside the clicked one, so the agent or terminal the link came from got narrower instead of staying put. The page now opens as a sibling tab in the clicked pane's tab group.

Reported as: "I would rather it open as a new tab of the focused tab group instead of a new tab group like that."

What changed

  • selectBrowserLinkDestination (browser-link-destination.ts) — the path a Checks-panel click takes (openHttpLink → openWorkspaceBrowserTabForLink → openClientWorkspaceBrowserLink) — returned split: { sourceGroupId, splitDirection: 'right' } whenever the source group had an active tab. It now returns that group as groupId.
  • resolveHttpLinkBrowserPlacement (http-link-browser-placement.ts) — the same rule for the direct local open and the remote prepare path — same change.
  • Placement precedence is unchanged: exact-page reuse → a pane already showing a browser (focused first, then most recently focused) → the source tab's group → the focused group.
  • selectBrowserLinkDestination's split field had no other producer, so the field and its threading (browser-link-open.ts, prepareRuntimeBrowserLink, workspace-browser-tab-open.ts) are deleted rather than left unreachable, together with the now-dead OpenWorkspaceBrowserTabRequest.split. resolveWebRuntimeBrowserClientTargetGroup keeps its own split, which the tab-bar split command still uses.

Notes

  • A background link (openLinksInAppInBackground) still does not steal focus: the tab joins the clicked group without becoming its active tab. Asserted in three tests, since the split used to make that impossible to get wrong.
  • openFileInBrowserTab — the link path for a terminal click on an HTML file — now opens as a tab too, for the same reason. Only openFilePreviewToSide (file-preview.ts:276) still splits: "preview this file in a browser pane" is a different intent, and its split keeps the editor visible.
  • "Open in this group" keeps its purpose: a visible browser in another pane still attracts a plain click, so the explicit action still differs from it.
  • Paired runtime: a staged link now joins the source group on the host as well, so the host desktop gets the same sibling tab instead of a split. Covered by the staging tests; not verified against a live paired host.
  • Not done: placing the new tab directly after the clicked tab (afterTabId); it appends to the group's order. Reviewer MINOR, recorded here rather than changed.
  • The two fork rationale comments the first commit added pushed local/check-upstream-file-comments.mjs to 6060 against a 6058 baseline (a PR-gate-1 red). Both were removed; the rationale lives in this body instead.

The branch was rebased onto the current nplez1/main tip (c08b45fc6f0) after the review, to be a descendant of it. git range-diff shows both commits byte-identical, so the reviewed hunks are unchanged.

Verification

  • Targeted tests — every file that imports the changed modules — at R1: 17 files / 239 tests green. Re-run at R2 (9 files / 129 tests) and again on the rebased revision (17 files / 239 tests): green.
  • pnpm tc clean at R2 and on the rebased revision (0bf26f8); pnpm tc:web clean; pnpm run check:code-quality:changed clean.
  • PR gate 1: orca-queue node local/gate-lint.mjs → PASS @0bf26f8e77c, 44 green, 0 failing.
  • The full unit suite is the release gate, not this PR's; the diff is renderer-only plus docs, with no global input, so local/open-pr.mjs needs no cached unit-gate verdict here.
  • Opus 5.5 review at high reasoning: R1 clean — no BLOCKER or SHOULD-FIX, three MINOR and three NIT; the MINORs and NITs that were one hunk were fixed in R2 and the rest are recorded above. The delta re-check answered only "was each finding resolved" and "did the fix introduce a defect".

Reviewed by Opus 5.5, high: R1 clean (3 MINOR, 3 NIT), delta clean on R2

…plit

Clicking an http(s) link that routes into the in-app browser (the Checks
panel's PR id, a terminal link, a chat link) split a new pane beside the
clicked one, which shrank the agent or terminal the link came from.

Auto-placement now targets the clicked pane's own tab group: the page joins
it as a sibling tab, and the focused group wins when the click has no source
tab. A pane already showing a browser still attracts the page, so the
existing reuse and recency rules are unchanged, and "Open in this group"
keeps meaning something because a visible browser elsewhere still wins.

The split path was the only producer of `selectBrowserLinkDestination`'s
`split` field, so the field and its threading through the local and runtime
open helpers are gone rather than left unreachable.
Review follow-ups on the same-group placement:

- drop the two fork rationale comments the ratchet counts in upstream-owned
  files (6060 vs a 6058 baseline); the behaviour is in the PR body instead
- delete `OpenWorkspaceBrowserTabRequest.split`, which nothing set once the
  split placement went away, so the runtime path can no longer inherit a
  caller split
- assert the clicked group still shows its terminal on a background open and
  on an open that navigated away, the property the split used to guarantee
- say "the clicked pane's group, or the focused pane's for a sidebar link"
  in the docs, since a Checks-panel link has no source pane
@nplez1
nplez1 merged commit 6f5e1b8 into nplez1/main Nov 1, 2026
@nplez1
nplez1 deleted the nplez1/In-app-Browser-Tabs branch November 1, 2026 09:05
nplez1 added a commit that referenced this pull request Nov 1, 2026
…ent reds (#268)

* fix(agent-session): read lstart in UTC, and fix the stale link-placement reds

The unit gate is red on main for six cases, none of them in a file #265
touched, so its own suite never saw them.

Five are stale placement assertions. #265 moved an in-app link from a new
split pane into the clicked pane's own tab group; `file-preview-link-open`
(four cases) and `NativeChatInlineVisual.link-placement` still asserted the
split: a new group beside the source, and the source tab left showing. They
now assert what #265 made true — the page joins the clicked group and takes
it over, no group is added, and the layout is untouched — matching how #265
rewrote `browser-link-open-layout-owner` and `http-link-source-placement`.

The sixth is a real bug in the darwin start-time probe, not a stale test.
`ps -o lstart=` prints local wall clock, and the hour a DST fall-back repeats
resolves to the earlier offset: on 2026-11-01 a process started at 01:37 PST
read back an hour early, so the probe's own tolerance check failed. `lstart`
is now requested with TZ=UTC — which `runPsInProcess` also formats for — and
parsed as UTC, so a start time is one instant whatever the zone. The new test
pins the repeated-hour string, which a local read cannot satisfy.

Why this matters beyond the test: `readProcessStartTimeMs` decides whether an
agent-session owner or a spawned provider process is still the same process.
An hour of error there is an hour of misidentification, twice a year.

* fix(test): assert the placement the tests describe

Round 1 (Opus, high) raised nothing blocking and two one-hunk minors.

The folder-workspace case asserted an active group its own seed had already
set, so it could not fail and nothing proved the "activates its browser" half
of its title. Both rewritten tests also said the page "joins as a sibling tab
and takes it over" without asserting either: they now pin the group's
activeTabId to the page and the source tab's survival in tabOrder, so a
replacement would fail where only a move would not.

Two nits as well: the titles that still said "beside", and the pairing of the
UTC printer with the UTC parser, which only the live darwin test covered.

* fix(test): keep the zone test cross-platform, and pin the reported group

The delta round caught the new test failing off darwin: `psLocaleEnvironment`
pins the en_US locale only on darwin, so `LC_ALL` is unset on the Linux
nightly. The locale assertion is now darwin-only; the zone assertion, which is
the point, holds everywhere. The detected-preview case also pins the group its
outcome reports, which the rewritten store assertion had stopped covering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant