Skip to content

sta 4150 hardening review fixes - #15401

Closed
Jinwoo-H wants to merge 26 commits into
sta-4150-hardening-docs-adjudicationfrom
sta-4150-hardening-review-fixes
Closed

Jinwoo-H wants to merge 26 commits into
sta-4150-hardening-docs-adjudicationfrom
sta-4150-hardening-review-fixes

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3075 $\color{#cf222e}{\Huge{\mathbf{−}}}$​434 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2641
Prod 55 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1193 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3295 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2102

ELI5

What Changed

Why

Linked Issue

Fixes #

Visual Proof

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author

  • X / Twitter: @your_handle

@Jinwoo-H
Jinwoo-H marked this pull request as ready for review August 19, 2026 01:07
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-hardening-docs-adjudication branch from 66f91d9 to 0ecd1f8 Compare August 19, 2026 01:27
@Jinwoo-H
Jinwoo-H requested a review from brennanb2025 as a code owner August 19, 2026 01:27
…ote workspace

Route-guest popups are hosted in an Orca-built BaseWindow, so Electron never
fires did-create-window for them and main had no way to tell whose page a popup
belonged to. Download routing therefore missed them and reserved a desktop
Downloads path, writing remote-controlled bytes to the client filesystem.

Popups now register their opener with a route popup ownership registry for the
whole popup lifetime (creation through destroy, opener fence, and controller
dispose), and browser-manager resolves a popup's owning page through it — so a
popup download stages and streams exactly like an opener download, and its
terminal event reaches the owning page's renderer.
… remote destination

The download router was a process-global singleton that each environment
composition overwrote, so a page from one environment could be looked up in
another environment's executor -- and every miss, error, or unavailable channel
returned null, which browser-manager read as permission to reserve a desktop
Downloads path. Cross-environment lookups and channel outages therefore failed
open into the client filesystem.

Replaces the singleton with a per-composition registry resolved by actual page
ownership (registered on composition, released as it starts closing), and makes
the relay report ownership separately from channel state. For a WebContents in
a client route partition: owner plus negotiated channel routes remotely; an
owner whose lease never negotiated the channel keeps the deliberate old-host
desktop fallback; an unresolvable owner or a negotiated-but-unusable channel
cancels the download through the existing remote-failure path. Ordinary
server-hosted guests keep their desktop behavior unchanged.
A grace-period reconnect whose ready event renegotiates
fileChannelProtocolVersion no longer counts as an authority change, so a
capability downgrade leaves hosted pages alive with upload/download refused
per operation. The runtime restore path carries the reconnecting
connection's negotiation onto the lease so both sides agree.
Per-transfer operation chaining makes abort wait for an in-flight write or
commit instead of racing it, and a canceled transfer stops at its next await
resumption so it can neither recreate the partial file nor commit. A settled
transfer id is remembered briefly, so a late chunk is refused rather than
starting the transfer over.
Page retirement and lease fencing now drop the transfers a client page owns,
so a fenced page or a lost client transport no longer strands .incoming-*
files and sessions in the runtime store. Lease fence dispatch moves into its
own module to keep the registry within the file-size budget.
…teardown

Removal now sequences the route-partition clear behind the environment's
client-host close and retries once for partitions that refused as live, so
storage is destroyed in the same run instead of degrading to the next-startup
orphan sweep. The live-page guard is unchanged: a partition with prepared
pages is still never cleared.
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-hardening-review-fixes branch from 9c854a3 to 21ca1ca Compare August 19, 2026 01:27
The stack's merge refs went stale after the 01:23Z restack and no pull_request workflow has dispatched since.
@Jinwoo-H Jinwoo-H closed this Aug 19, 2026
@Jinwoo-H Jinwoo-H reopened this Aug 19, 2026
DOM.setFileInputFiles only records the path on the input; Chromium opens the
file lazily at submit/FileReader time, so releasing the staging directory when
browser.upload resolves broke the normal upload-then-submit flow. Staged copies
now live as long as the page (cleanupPage/closePages already release them), with
a per-page command+byte budget evicting oldest-first so a long-lived page cannot
accrue unbounded staged bytes. Only a failed upload still releases eagerly.
…rror

retireFailedEnvironmentHost closed the registry entry directly, leaving
clientHostRouteIdentities populated for a composition that no longer hosts
pages. A settings-level cookie import then took the client-host branch and wrote
into a dead partition instead of falling through to the server-side import RPC.
…titions

The cold-start replay only honors the default partition and persisted session
profiles, so a client-hosted route partition's staged Cookies DB was silently
dropped at startup and never unlinked — leaving a plaintext copy of the user's
cookie jar in userData indefinitely while the import reported clean success.
Route-partition imports now skip staging entirely and surface the existing
restart-fallback-unavailable warning, the startup drop-on-unknown-partition
branch unlinks the staged DB and its sidecars, and discardStagingFile clears
-wal/-shm too.
…the import

The import was retargeted to this desktop for client-hosted environments, but
detection still ran the remote browser.profileDetectBrowsers RPC — so a headless
remote left the picker empty (making the feature unreachable) and a GUI remote
offered profile directory names that only exist there. Detection now takes the
same client-host-first branch as the import via a new
browser:session:detectBrowsersForClientHost IPC, which returns null when the
desktop hosts no pages so the server RPC still serves server-placed imports.
…age's own

Nothing compared the two derivations: the import takes
browserNativeExecutionHostStorageIdentity(authorityRuntimeId) while a page takes
browserNetworkExecutionHostStorageIdentity(executionHost) through the route
registry. The new test derives both through the shipping paths and asserts
equality for the server's own machine, and records the deliberate divergence for
pages whose workspace lives on a nested SSH target or WSL distro.
…time

A transport blip rejects the client's fileChannel.abort silently, so an
interrupted download kept its runtime session -- and one of the eight shared
slots -- until the page was retired or the lease fenced. Arm an idle deadline
while a transfer waits for its next chunk so it releases its partial file and
its slot on its own.
…ts file

Each client-hosted download minted <stagingRoot>/<transferId>/ and only ever
removed the file inside it, so the shared OS temp root grew one empty directory
per download and an abnormal exit left the staged bytes there with no GC path.
Settle the whole per-transfer directory and sweep the staging root when the
composition builds its relay.
…eams

settleClientHostedDownload cleared the route before awaiting complete(), so the
abort guard in finishDownloadInternal was already dead by the time a cancel
arrived: the relay streamed to the end and the runtime committed the file into
the remote workspace while the UI reported Canceled. Keep the route on the
record for the whole commit and re-read the cancel at every chunk boundary.
…mpletes

closeEnvironment resolves as soon as the host detaches, and when unsettled
handlers make the composition defer executor teardown the partitions are still
retained -- so removal-time clearing saw every partition live, retried once, and
gave up. Retire through a close that also awaits the deferred cleanup.
The stub was never returned, so deleting the sweep or hoisting it above the
binding runtime (where it collects nothing) both kept CI green.
Both bounds were unasserted: widening the 1s window or dropping the ceiling
clause kept the suite green. Offsets and counts are literals so a mutated
constant cannot move the assertion with it.
…server

Reopen-on-server runs a multi-RPC remote round-trip; only `disabled` moved, so
over a relay the click read as ignored. Deferred 200ms spinner and label swap,
both labels sharing one grid cell so the button cannot resize mid-action.
The browser manager learned a client page's guest only when an agent automation
command arrived, so for a user-driven page popup downloads resolved no owning
page and failed closed, and no download event reached the renderer at all.
Page creation now binds the guest and retirement releases it.

The download suite registered the guest itself, which hid all of that; it now
drives the same binding production uses. Executor tests split by topic to stay
under the line ceiling.
…pages

The completion toast, the fail-closed error and any in-flight signal were all
emitted only from BrowserPagePane, which never mounts for a client-placed page
— so the one surface that produces a remote destination could not show it.
The client-hosted pane now subscribes to the download lifecycle itself, and the
remote-destination message no longer names the file twice.
Route guests replace the manager's popup handler, so all five denial paths —
gesture window, popup ceiling, fence, bad destination, disposed — returned
'deny' with no signal at all: window.open returned null and the button just
looked broken. Denials now ride the existing browser:popup blocked event and
land as one toast per page and origin.
@Jinwoo-H
Jinwoo-H marked this pull request as draft August 19, 2026 04:17
@Jinwoo-H
Jinwoo-H marked this pull request as ready for review August 19, 2026 04:17
Removes five unreferenced exports the diff audit found: an unused page-retire
wrapper, the superseded lease-event union and its test assertions, an orphaned
page-authority type, an unused abort-result schema, and a leftover WSL relay
env-var name. The declared file-channel download cap was audited too and is
enforced, so it stays.
The progress ledger and vendored design doc are working notes; docs/** is
deliberately gitignored and they should not merge. Files stay on disk for the
team; the ledger's history remains in earlier stack commits.
@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Superseded by the consolidated PR #15448 (the full STA-4150 feature merged with latest main). This PR's diff remains as the per-layer review view; its CI was fully green at close.

@Jinwoo-H Jinwoo-H closed this Aug 19, 2026
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