Commit Graph
9666 Commits
Author SHA1 Message Date
Neil 4a3bc23670 fix(lint): preserve TaskPage effect suppressions after split 2026-08-31 03:49:18 -07:00
Neil e65d298afb fix(status-bar): preserve Git refresh ordering after split 2026-08-31 03:49:10 -07:00
Neil 787228ee46 chore(max-lines): prune refactored file suppressions 2026-08-31 03:49:01 -07:00
Neil 1731f2a2f3 fix(renderer): preserve extracted lifecycle and retention behavior 2026-08-31 03:48:52 -07:00
Neil c778ac7a7a fix(renderer): keep split imports lint-clean 2026-08-31 03:48:45 -07:00
Neil da89be4345 refactor(renderer): split oversized UI surfaces 2026-08-31 03:48:44 -07:00
Neil 47706a5388 fix(mobile): restore session parity after extraction 2026-08-31 03:47:59 -07:00
Neil f129f2926a refactor(mobile): split session and terminal surfaces 2026-08-31 02:49:18 -07:00
Neil ae2eeff55d perf(relay): index PTY source-credit send spans (#17490)
* perf(relay): index PTY source-credit send spans

* perf(relay): maintain PTY source-credit retention totals

* test(relay): pin PTY send-cursor rebase across ACK reclaim

Cover the Math.max clamp branch in reclaimCreditedSpans where reclaim
removes spans at or past the send cursor, and widen the seeded fuzz case
to 20 spans per seed so the cursor actually traverses spans; assert the
cursor never overshoots the span containing sentEndSu.

* refactor(relay): drop dead retained-total helpers and pin retention counters

The incremental PtySourceCreditRetention counters replaced the recompute-from-records
helpers; delete the now-unreferenced exports and recompute the totals from the live
records inside the ledger tests so the counters have an independent oracle.

* test(relay): bound send-span reads instead of pinning the read pattern

Address review feedback on the send-span cursor coverage:
- replace the exact indexed-read pin and the tautological naive-visit
  assertion with a linear bound that still fails on the old Array.find path
- drop the per-run bench console.log
- assert retention totals immediately after rotate(), the only path that
  removes and re-adds a record in one call

Also count the replacement delivery in retention as it enters the delivery
map so the "in deliveries <=> counted" invariant never has a hole.
2026-08-31 02:41:15 -07:00
Neil e17c98d425 fix(daemon): bound the whole boot-recovery sequence with one budget (STA-5732) (#17427)
* fix(daemon): bound the whole boot-recovery sequence with one budget (STA-5732)

* fix(daemon): keep socket probes inside recovery budget

* fix(daemon): size the recovery budget against the real post-kill tail

The 24s budget reserved only 9s for everything after the deadline, leaving
27s of the startup PTY gate's fail-open cap unused — and every unused second
is one where a daemon that would have drained gets killed with its live PTYs
instead. Reserve each post-deadline stage's actual hard cap (kill 10.5s, fork
10s, lease 5s) and spend the rest: 24s -> 32s of adopt window.

* fix(daemon): keep the last-resort endpoint rescue outside the recovery budget

The rescue probe in the launcher's outer catch was clamped to the recovery
budget's remainder, but it runs *after* that budget by construction — past
prepareDaemonReplacement, killStaleDaemon, the fork and the adoption lease.
The remainder is therefore essentially always negative, so Math.max(1, ...)
handed a live socket a 1ms connect window. On the loaded machine this path
exists for the probe loses to its own timer, the launcher rethrows, and a
recoverable degraded adoption becomes total daemon loss for the whole run —
the outcome the comment above it exists to prevent. Restore the 1s default
and pin the window with a test that drives the launcher to that catch with
the budget already spent.

Also make the deliberate narrowing legible instead of implicit:

- daemon-recovery-budget.ts: TRANSIENT_WEDGE_DRAIN_MS documented 20s as the
  grace #8697 sized, but #8697's merged second commit (840d3277d1) widened
  it to 11 retries ~= 60s. Record that 20s is the drain estimate and that the
  budget deliberately sits under #8697's shipped grace.
- daemon-init-wedged-daemon-grace.test.ts: pin the trade directly — a wedge
  draining after the budget is replaced and loses its live sessions.
- Rewrite 'preserves a daemon that stays wedged until the LAST allowed grace
  retry' onto the simulated clock. It never mocked Date.now, so its 12 probes
  elapsed ~0ms and asserted a retry grace the wall clock can no longer
  deliver; it now pins the last drain the budget still adopts.

* fix(daemon): name the socket probe default and correct the grace-retry rationale

Answers the review round on the budget accounting: the outer-catch endpoint
rescue is deliberately outside it, and the preflight clamp no longer duplicates
probeDaemonSocket's default as a bare literal.
2026-08-31 02:41:11 -07:00
Neil 7cb1db63db test(updater): cancel the real timers an abandoned updater instance leaks (#17663)
* test(updater): cancel the real timers an abandoned updater instance leaks

#17649 stamped `loadElectronAutoUpdater()` with a generation so an abandoned `updater`
module instance could no longer drive the shared `autoUpdater` spies. That fenced one spy
graph but left the leak channel itself open: `resetUpdaterMocks()` still cannot cancel the
real timers the previous instance armed, so the stale instance keeps running and keeps
reaching every shared spy the fence does not cover.

Exposed chains, all with exact call-count assertions on them:

- 1s `updateCheckSilentSettleTimer` -> `completeSilentUpdateCheck()` ->
  `scheduleAutomaticUpdateCheck()` on the next test's fake clock -> `runBackgroundUpdateCheck()`
  -> `pinDefaultReleaseFeed()` -> `fetchNewerReleaseTagsWithReadiness` -> `fetchNewerReleaseTagsMock`
  (updater.check-preflight.test.ts:59,309,528; updater.publishing-window-feed.test.ts:382,458)
- `scheduleUpdateNudgeCheck()` -> `fetchNudgeMock` / `shouldApplyNudgeMock`
  (updater.nudge-campaign.test.ts:168,175)
- the previous test's `webContents.send` mock, which still receives a stale 'not-available'
- `completeSilentUpdateCheck()`'s 1h retry, which several files straddle with 59min + 1min

Close the channel instead of ignoring its effects. The harness now wraps the real
`setTimeout`/`setInterval`/`clearTimeout`/`clearInterval` globals while a test file is using
it, and `resetUpdaterMocks()` cancels every real handle armed since the last reset. Fake
handles are already discarded by `vi.useRealTimers()`, so real handles were the only leak
channel left.

The patch installs only after `vi.useRealTimers()` (never over a fake clock, so it cannot
capture fake handles), restores only the globals still holding its wrappers, hands back
untouched Node `Timeout` objects so `unref()` keeps working, and is removed in `afterAll` so
no unrelated file in the same worker sees it. Vitest arms its own test timeouts through
`getSafeTimers()`, snapshotted at worker setup, so nothing here can capture or cancel them.

The #17649 generation fence stays in place — this is additive defense in depth.

* fix: drop fake clocks before handing the timer globals back

The afterAll uninstall silently no-opped in 4 of the 10 harness files. Its
identity guard (globalThis.setTimeout === wrapper) fails whenever a file's
last test leaves a fake clock installed, and no updater test calls
vi.useRealTimers() — the only restore is the next beforeEach, which never
runs after the last test. Affected: check-settlement, publishing-window-feed,
quit-and-install, and this PR's own leaked-timers test.

Nothing broke because vitest defaults isolate:true, so the stranded wrapper
died with the per-file process. Under --no-isolate it would have been a real
leak: the wrapper stays installed for every later file in the worker, the
armed-handle sets retain every Timeout forever, and a later updater file's
reset would cancel live timers belonging to unrelated suites.

Also scope the module docstring — node:timers/promises and util.promisify
bypass the globals entirely, so a future `await setTimeout(...)` in
updater.ts would reopen the leak with no failing test.
2026-08-31 02:17:00 -07:00
Neil 6bbed15a11 fix(worktree): gate agent activation on the live surface census, not renderer state (STA-5701) (#17428)
* fix(worktree): gate agent activation on the live surface census, not renderer state (STA-5701)

* fix(worktree): seed a pane when the surface census cannot prove ownership (STA-5701)

Failing closed must not also fail silent. When the census is unverifiable
the sweep adopts nothing and mints nothing, yet the gate still reported
'adopted' — and both callers suppress their own seeding on any outcome but
'empty', so the workspace ended with zero surfaces. The sweep now reports
whether any live PTY holds a surface and the gate hands the caller its seed
when none does. Also folds equivalent workspace-path spellings in the census
index and in exact-surface binding, so a host row spelled differently is
neither dropped (mint a duplicate) nor unbindable (no pane).

* fix(worktree): name the live PTYs the surface census declined (STA-5701)

The adoption sweep can leave a live PTY without a surface — an unreadable
census, two host surfaces claiming one PTY, or a host-named leaf the
persisted layout does not have. The gate already stops reporting 'adopted'
in that case so the caller seeds a shell, but the decline itself was mute.

- adoptLiveWorkspacePtySurfaces now returns { surfaced, declinedPtyIds }
  and the gate warns with the workspace and the PTY ids left unsurfaced.
- Pin the host-named-leaf decline, which had no test either way.
- Pin the superseded-inventory race in terminal.list: a concurrent refresh
  makes hostScope.hostIds empty, which is what makes the renderer's
  'unverifiable' verdict reachable on a plain local machine.
2026-08-31 01:40:54 -07:00
Neil b5746724d4 perf(relay): account pending PTY output incrementally (#17639) 2026-08-31 01:28:29 -07:00
Neil 97eb762b27 refactor(packaging): prune declaration and source-map artifacts in one walk (#17659)
* refactor(packaging): prune declaration and source-map artifacts in one walk

prunePackagedRuntimeTypeDeclarations and prunePackagedRuntimeSourceMaps
were byte-identical apart from their regex, and each did its own full
recursive walk of packaged Resources/node_modules (~1.7s per walk).
Collapse them into prunePackagedRuntimeTypeAndSourceMapArtifacts, which
runs a single walk with the OR of both predicates.

The two regexes are disjoint (.d.ts.map never ends in .js.map), so one
pass deletes exactly the union the two passes deleted. Neither old
function had a production caller outside prunePackagedRuntimeNodeModules,
so both exports are replaced by the combined one rather than kept as
wrappers, which would have reintroduced the duplicate walk.

Also moves prunePackagedZodSources ahead of the filename walk: zod/src is
removed wholesale, so traversing it first was pure wasted work. The
prunes are independent, so the reorder does not change the result.

* fix: correct the one-walk rationale and close the .d.mts coverage gap

The comment credited predicate disjointness for making the merge safe. That
is not the reason and is misleading: it implies a future overlapping
predicate would break the collapse. Passes commute because
pruneMatchingFiles only deletes files and never removes directories, so the
tree it walks is identical each time — verified by running the old two-walk
code with the passes reversed and diffing survivors.

Also narrow isPrunablePackagedRuntimeArtifact to isPrunableTypeOrSourceMapArtifact
(node-pty prebuilds and duplicate sherpa dylibs are prunable runtime
artifacts too, but this predicate returns false for them), and add the
missing .d.mts fixture so every branch of the (?:c|m)? alternation is
exercised against the exact-survivor assertion.
2026-08-31 01:19:32 -07:00
Neil e22c4ee1ac ci(docs): skip releases without docs source
Skips stable tags that predate docs/site before entering the protected production environment.
2026-08-31 01:00:47 -07:00
Neil 22a9e30ba1 test(updater): detach stale updater module instances from the shared autoUpdater mock (#17649)
Root cause of the `updater.startup-scheduling` flake: `resetUpdaterMocks()` calls
`vi.resetModules()`, which abandons the previous test's `updater` module instance but
cannot cancel the real timers that instance already armed. The earlier real-timer tests
leave a 1s `updateCheckSilentSettleTimer` pending; it fires a second or so later, i.e.
during a *later* test that has since installed a fake clock. The abandoned instance then
runs `completeSilentUpdateCheck()` -> `scheduleAutomaticUpdateCheck(24h)`, arming that
timer on the running test's fake clock at its epoch. `reschedules the next automatic
check 24 hours after finding an available update` advances 1h + 23h, so the stale 24h
timer lands exactly at the end of the 23h window, and the stale instance calls the
shared `autoUpdaterMock.checkForUpdates` spy -> 2 calls instead of 1.

Whether the leaked real timer fires before or after the next test installs its fake
timers is real-clock dependent, which is why it reproduced ~1 in 12 runs and only when
the whole file runs (30/30 pass with `-t` filtering to the single test).

This is a test-isolation bug, not a product bug: production has exactly one updater
module instance and one clock, so no stale instance can exist.

Fix: the harness already detaches abandoned instances on the event side (it clears the
`app`/`autoUpdater` handler maps on reset); extend the same idea to the call side.
`loadElectronAutoUpdater()` now hands each module instance a generation-stamped view of
`autoUpdaterMock`, and `reset()` bumps the generation, so a stale instance's calls and
property writes are dropped instead of driving the spies the running test asserts on.

Verified: 40/40 clean runs of `pnpm test src/main/updater.startup-scheduling.test.ts`
(0 failures), plus all 22 `src/main/updater*` files (264 tests) green.
2026-08-31 00:55:01 -07:00
Neil 649c188cc4 docs: clarify release cutover ordering
Clarifies that marketing rewrites are prepared but remain disabled until a stable release-backed docs deployment is verified.
2026-08-31 00:48:39 -07:00
Neil c09810b641 perf(rpc): restore compiled Zod request schemas without override (#17374)
* perf(rpc): compile Zod request schemas lazily

* chore(deps): pin zod 4.5.4 and except it from the release-age gate

4.5.4 is the first release fixing isRecursiveSchema (upstream 84e416f, #6500),
which compile() calls on every schema — on 4.5.0 it fired .default() factories
at compile time. Verified: compile-time factory calls 0 on 4.5.4, 1 on 4.5.0.
2026-08-31 00:47:22 -07:00
Neil 0293ebe3eb perf(packaging): prune JS source maps from all packaged node_modules (#17638)
Generalizes the @linear/sdk-scoped prune to every packaged dependency,
matching the existing type-declaration prune's single-predicate walk over
Resources/node_modules. Recovers ~1.01 MB beyond the SDK.

Nothing in the packaged app enables Node source-map support
(no --enable-source-maps, no setSourceMapsEnabled, no source-map-support
require), and the CLI launchers strip NODE_OPTIONS, so these maps were
never read. Orca's own main-process maps live outside node_modules and
already ship as a separate release artifact.
2026-08-31 00:19:09 -07:00
Neil ca516a4306 test(git): pin FETCH_HEAD lock order in the admission lifetime test (#17641)
`serializes FETCH_HEAD callers before they enter admission` assumed that two
same-repo fetches join the FETCH_HEAD lock lane in call order. They do not.

`runWithGitFetchHeadLock` first `await`s `fetchLockPath`, which walks the
filesystem (`realpath`, `stat` per parent directory, `readFile` of `commondir`,
`realpath` again) before it calls `runWithGitOperationLock`, and the lane is
registered only after that walk resolves. For a non-existent `/repo` that is
five libuv threadpool round-trips per caller. Two callers issued back to back
run their chains concurrently, so lane order is threadpool completion order,
not call order.

When the `interactive` fetch won that race it entered the lane ahead of the
`background` fetch. On the first caller's release it reached admission
immediately and, being interactive, took the free network headroom slot instead
of queueing, while the background fetch stayed parked on the lock. `queued`
therefore settled at 0 and never reached the asserted 1. Measured inversion
rate for the bare lock-path walk was 54/500 on an idle machine; the test itself
failed 5/20 locally, always at the same assertion, matching the two CI failures
on unrelated PRs (#17530, #17630) at the same line.

Fix the premise rather than the symptom: stub only the key derivation, keeping
the real FIFO `runWithGitOperationLock` that the test actually exercises, so the
lane is registered synchronously with the call. Key derivation keeps its own
coverage in `src/shared/git-fetch-head-lock.test.ts`. This also stops the fetch
tests in this file from sharing one global `/.git/FETCH_HEAD` lane with each
other and from touching the real filesystem.

Verified deterministic: 40/40, then 30/30 clean runs, plus 25/25 with twelve CPU
hogs and a concurrent `src/main/git/command-runner/` run saturating the box.
2026-08-31 00:09:07 -07:00
Neil 6aba202d5e feat(docs): publish OSS docs with stable releases
Publish the standalone docs site under docs/site and deploy it on stable desktop releases.
2026-08-30 23:51:25 -07:00
Neil 6cc9319d87 perf(wsl): warn at project-add when the tree sits on a Windows drive (#17636)
* perf(wsl): warn at project-add when the tree sits on a Windows drive

Worktree placement now puts new workspaces inside the distro, but a project
whose own tree is on C:\ still pays the 9p/drvfs crossing on every git command
it runs — measured at ~20x for a clean `git status` against the same tree on
ext4. Nothing in the UI says so, so the project just feels slow.

Warn once, right after the add succeeds, naming the distro the project's git
actually runs in. The advisory is wrapped so it can never fail the add.

Two path shapes cross the boundary and both warn: a Windows drive path under a
WSL project runtime, and the UNC spelling of a distro's own drvfs mount
(\\wsl.localhost\Ubuntu\mnt\c\...), which crosses it however the runtime is set.
A tree already inside the distro, a drive path under Windows-host git, a plain
UNC share, and every POSIX/SSH path stay silent.

* chore(i18n): register the WSL filesystem boundary advisory keys in en.json
2026-08-30 23:48:50 -07:00
Jinwoo Hong 46fa1a98d0 fix(browser): show reload loading feedback (#17635) 2026-08-31 02:46:17 -04:00
Neil 017811f0de perf(renderer): memoize active worktree editor files (#17484)
Reuse the filtered editor-file projection while Terminal rerenders without changing its inputs.
2026-08-30 23:40:45 -07:00
2sumtech d641d87905 fix(browser): accept an empty --value in cookie set and --pass in set credentials (#17226) 2026-08-30 23:30:49 -07:00
Neil c55121231a fix(remote): re-activate the pending host surface on paired PTY attach (STA-5291) (#17429) 2026-08-30 23:21:18 -07:00
Neil fc73903beb ci(release): publish main-process source maps with each release (#17630)
* ci(release): publish main-process source maps with each release

Desktop bundles ship minified, and packaging drops out/**/*.map from
app.asar, so a stack trace from a released build cannot be mapped back to
source. main builds with sourcemap:'hidden' — the maps exist in CI but were
never published anywhere.

Zip them on the linux-x64 leg and upload to the draft release as
orca-sourcemaps-<tag>.zip (33.7MB raw, ~8MB zipped, 69 files). The main
bundle is platform-independent, so one leg covers the whole release. The
step fails loudly if no maps are found, so a regression of build.sourcemap
breaks the release instead of silently shipping undecodable builds.

* fix(release): stage source map bundle outside the checkout

Every entry in electron-builder's `files` is a negation, so app-builder hits
containsOnlyIgnore() and prepends `**/*` (fileMatcher.js:285). A zip left in
the workspace root would have been packed into the linux-x64 app.asar,
growing that platform's installers by ~8MB and diverging them from arm64 —
the same hazard the '!pr-evidence' exclusion already guards against.

Stage it in $RUNNER_TEMP, matching the release-state file at :444.
2026-08-30 23:21:00 -07:00
Neil 6a65d8406a perf(ssh): index source spans by ID (#17504) 2026-08-30 23:05:37 -07:00
Neil 337b729f82 perf(main): summarize workspace space rows in one pass (#17483) 2026-08-30 23:05:32 -07:00
Neil 900fce25cd perf(renderer): cache active terminal chrome projection (#17480) 2026-08-30 23:05:28 -07:00
Neil bc6ed60e83 perf(browser): group client-hosted row publication (#17479)
Reuse one registry snapshot when publishing rows for every workspace.
2026-08-30 23:05:24 -07:00
Neil 8c6cf4769e perf(main): index structured TUI process rows (#17478)
Build a PID index once per process snapshot so descendant ownership checks
avoid rescanning the full row list for every PID.
2026-08-30 23:05:20 -07:00
Neil 490a7de5fa perf(shared): index git history merge parents lazily (#17469) 2026-08-30 23:05:16 -07:00
Neil 435a5e2490 perf(renderer): index folder workspace host ownership (#17468) 2026-08-30 23:05:12 -07:00
Neil 4d19b3382c perf(shared): project automation list in one pass (#17466) 2026-08-30 23:05:08 -07:00
Neil 824dc89e97 perf(shared): classify folder workspace repos in one pass (#17464) 2026-08-30 23:05:03 -07:00
Neil d20679e609 perf(renderer): cache project host setup projection reads (#17463) 2026-08-30 23:04:59 -07:00
Neil e65d2dadeb perf(browser): use reverse guest tab lookup (#17462)
* perf(browser): use reverse guest tab lookup

* test(browser): keep mutable tab harness lookup
2026-08-30 23:04:55 -07:00
Neil 1e4c56baa1 perf(git): classify status line-stat inputs once (#17461) 2026-08-30 23:04:51 -07:00
Neil 55efba2ac0 perf(mobile): summarize diff review counts in one pass (#17460) 2026-08-30 23:04:47 -07:00
Neil 7e5cc79e93 perf(mobile): project home host connection maps once (#17459) 2026-08-30 23:04:42 -07:00
Neil fb271f2f3b perf(renderer): cache startup action selector (#17458) 2026-08-30 23:04:37 -07:00
Neil 8e132880be perf(renderer): stabilize window visibility action selector (#17457) 2026-08-30 23:04:25 -07:00
Neil 7a72976d51 perf(mobile): compare terminal themes without serialization (#17455) 2026-08-30 23:04:21 -07:00
Neil 225b28199a perf(renderer): avoid remote PTY selector allocations (#17454) 2026-08-30 23:04:17 -07:00
Neil 2dd67e83b2 perf(worktree): overlap configured path filesystem probes (#17453) 2026-08-30 23:04:13 -07:00
Neil c9ef3aab5a perf(filesystem): avoid per-entry directory promises (#17452) 2026-08-30 23:04:08 -07:00
Neil 3cb44480c1 perf(renderer): narrow app root settings subscriptions (#17451) 2026-08-30 23:04:03 -07:00
Neil 1075dce185 perf(memory): prune claimed PTY subtrees (#17450) 2026-08-30 23:03:59 -07:00
Neil 30ca6bc953 perf(worktree): parallelize head identity metadata reads (#17449) 2026-08-30 23:03:55 -07:00