Commit Graph
19 Commits
Author SHA1 Message Date
Kelvin Amoaba abff3a41f5 fix(mobile): serve the phone page after a Linux package update replaces a running Orca (#40863)
* fix(mobile): serve the phone page from a Linux install updated in place

Package managers (pacman, apt, dnf) replace Orca's files while the old
process keeps running. The host cached the manifest for the life of the
process and read assets through Electron's launch-time asar header, so
every read of the replaced files failed with asset_changed until Orca
restarted. Read from app.asar.unpacked and re-read the manifest when
manifest.json changes on disk.

Fixes STA-14385

* fix(mobile): check the page manifest off the main thread, and retry a mismatch

Read and stat the manifest with fs/promises and keep the probed root, so
bundle RPCs add no sync file calls. Keep only passing hash verdicts: a
package install writes files one at a time, so a mismatch may clear.

* fix(mobile): key the page manifest cache on its bytes

Inode, size and mtime can all repeat when ext4 rewrites a same-length
manifest within one clock tick.

* fix(mobile): read a newer in-place install's page manifest

A release written in place may add schema-v1 manifest fields the running
host predates. Read it with a stripping schema so the host serves the
fields it supports instead of reporting no bundle until restart.

* refactor(mobile): derive the installed-manifest reader from the writer's shapes
2026-11-10 21:18:51 +00:00
Brennan Benson fb5a8a0860 Run setup and archive scripts for folder projects (#40034)
* feat(workspaces): run setup and archive scripts for folder projects

Folder projects get the setup and archive scripts git projects have:
creating a workspace runs setup in a Setup tab, and removing one runs
archive first. The script sees the workspace's name and id, so
`orca worktree create` inside it attaches each new worktree to that
workspace, however the workspace was created.

- Folder creates (desktop IPC and runtime) prepare setup through the
  shared setup prep; runtime creates start it with the worktree terminal
  startup, so Setup-before-agent ordering matches.
- Runner files live in <folder>/.orca, one fresh file per launch, removed
  with the workspace.
- Only the host whose catalog holds the folder reads its orca.yaml or runs
  its scripts; a setup problem becomes a warning, never a failed create.
- Shared orca.yaml setup with no approval from an older client is skipped;
  ask/inherit never refuses a folder create.
- No orca.yaml default tabs for folders, since every workspace shares the
  directory.
- New capability worktree.folder-setup.v1 gates the Settings section on
  runtime hosts; the composer, Settings and trust prompt reuse the
  existing setup surfaces.

* i18n: add folder workspace hooks strings

* chore: drop the runner's sync-fs baseline and an array cast

* fix(workspaces): close review gaps in folder project setup

- Whole-project trust sends an explicit run for folder creates the
  policy would run, since it carries no content hash.
- Folder setup skips file access for a skipped setup and never starts a
  stopped WSL distro for a create nobody started; removal does the same.
- Runtime folder creates return the trust mismatch, so the window re-asks.
- The composer hides folder setup controls on hosts without
  worktree.folder-setup.v1 and keeps their old explicit skip.
- Hook checks read a folder only on the host that owns it.
- Git archive hooks get the removed workspace's id; WSL hooks blank
  inherited pane identity too.
- Runner files are written through the drive path WSL needs for its
  drive mounts, and kept out of git status with .orca/.gitignore.
- The CLI's older-host warning covers --agent creates and --json output.

* fix(workspaces): wait for the folder setup capability and read orca.yaml once

Create now waits for a runtime host's folder-setup answer instead of
sending Skip while the probe is pending, and runtime setup reuses the
parsed orca.yaml when merging effective hooks.

* fix(workspaces): keep a failed folder setup probe unknown and retry it on create

* fix(workspaces): share folder setup capability answers with the composer

* fix(workspaces): re-ask the host for folder setup support on every create

* fix(settings): read orca.yaml for folder projects and use workspace copy in hook rows

QA found Settings reporting no orca.yaml for folder projects while the
composer ran that script, and the inner hook rows still said worktree.

* fix(folder-workspaces): open one Setup tab for an instant folder create

* fix(workspaces): run setup when a created workspace has only editor tabs

* perf(folder-workspaces): per-workspace runner dir, bounded setup answers, one archive config read

* fix(folder-workspaces): retain setup capability for active consumers

* fix(folder-workspaces): match hook search to workspace descriptions

* fix(i18n): drop obsolete hook search descriptions

* test(folder-workspaces): follow relocated setup trust modules
2026-11-10 10:12:12 -08:00
Neil f8ffde3837 chore(ratchet): baseline the cached home realpathSync from #39817 (#40544)
#39817 added one realpathSync.native in floating-workspace-directory.ts
without a baseline entry, so main-sync-fs ratchet fails on main and every
open PR. The call resolves home once and caches it per home path (one-shot,
not per-RPC), which the ratchet allows with reviewer sign-off.
2026-11-10 00:15:21 +00:00
Kelvin Amoaba f5da9a9ff5 feat(speech): commit dictation text at each pause with Silero VAD (#39378)
Offline models write out the speech before each pause while recording goes on.
Short noises and slow window-padded decodes are held off the pause cuts, a VAD
error falls back to bounded chunks, and slow phrase decodes are judged per
dictation against the time spoken. The VAD download carries legacy files and
fetches after any GGUF model.
2026-11-09 19:55:11 +00:00
Kelvin Amoaba d291670a01 refactor(speech): remove sherpa-onnx (#39473)
transcribe-cpp is now the only on-device engine on every platform, so
the sherpa-onnx packages, their packaging (extraResources, the darwin
libonnxruntime prune, the native-variant assert and the Linux libstdc++
exemption), the sherpa recognizer in the speech process and the
per-model engine choice all go. Hotwords are written as plain terms.
2026-11-09 18:59:10 +00:00
Kelvin Amoaba fd46321d85 feat(speech): move the speech models to transcribe-cpp and offer an update for old downloads (#39468)
* feat(speech): move the speech catalog to transcribe-cpp models

Parakeet v2/v3, Whisper tiny and SenseVoice now download their GGUF
builds, which run on transcribe-cpp everywhere, Intel Macs included (on
the CPU). A model still holding its old sherpa-onnx download shows
"Update to the faster version (<size>)"; updating replaces the old
files, and dictating before then says the model needs that update.

The five models with no GGUF build are retired and their users moved
over: the Japanese Parakeet, the Chinese-English Zipformer and the
Paraformer to SenseVoice, and the Korean and Chinese streaming
Zipformers to the new Nemotron 3.5 (28 languages). Nemotron's locale
codes (ko-KR) are matched from the ISO language setting.

* feat(speech): offer the speech model update once after the engine change

A card in the notification corner tells people whose selected on-device
model needs the new download, or whose retired model was replaced, and
starts the same download as Settings > Voice. After a replacement it
offers to delete the retired model's files.

* feat(speech): move retired Korean and Chinese models to SenseVoice and offer Whisper Large v3 Turbo

On transcribe-cpp 0.4.1 with Metal, SenseVoice beat Nemotron 3.5 on Korean
and Chinese FLEURS clips, so the retired Korean and Chinese streaming
Zipformers now move to SenseVoice. Whisper Large v3 Turbo (Q8_0, 886 MB)
joins the catalog as the most accurate choice for Japanese, Korean and
Chinese. Nemotron 3.5 stays, described by the languages it does best.
2026-11-09 18:00:13 +00:00
Kelvin Amoaba 0b8e94aa5c feat(speech): run GGUF models on transcribe-cpp with a CPU fallback (#39326)
* feat(speech): run GGUF models on transcribe-cpp, falling back to the CPU

The speech host child can now load a second engine. A model whose files
are GGUF runs on transcribe-cpp (Metal on Apple silicon, Vulkan on
Windows and Linux, CPU otherwise); everything else stays on sherpa-onnx,
which remains the only engine on Intel Macs.

A GPU that fails to load, errors, stalls for 25 s or crashes the process
moves the dictation to a CPU-only process (TRANSCRIBE_BACKENDS=cpu) that
replays the audio the GPU had not decoded yet, so no words are lost or
repeated. A GPU that crashed or would not load is remembered per
transcribe-cpp version and OS release, and voice.speechGpu = 'off' keeps
it on the CPU.

Packaging copies transcribe-cpp, koffi and the target's native package
into resources/node_modules outside asar, fails when a target's package
is missing, and ships the MSVC runtime beside transcribe.dll on Windows.

No catalog model is GGUF yet, so nothing runs on transcribe-cpp until
the catalog change that follows.

* fix(speech): keep the speech queue running after a failed task, and drop audio frames after a discard

* fix(speech): keep the engine's file reads off the main thread's hot paths

The engine lookup and the GPU failure marker are read once per process
instead of on every dictation start and mobile catalog request, the marker
is written asynchronously, and the child reads the hotwords file with
fs/promises. The baseline moves the existing engine presence checks from
stt-worker-paths to the shared package table and adds the once-per-process
marker reads.
2026-11-09 16:37:03 +00:00
Neil 920a83889c refactor: move browser contracts and publication to defining owners (#40209)
* refactor: move atomic publication to its filesystem owner

* refactor: group shared browser definitions by feature

* refactor: bind proxy process and session contracts to defining owners

* refactor: consolidate direct session contract type imports

* refactor: retain atomic publication test timing under moved owner

* fix(benchmark): resolve historical tunnel framing source before loading
2026-11-09 00:45:45 -08:00
Neil e9f4df2c0f refactor: organize rate-limit providers and remove forwarding modules (#40116)
* refactor: group rate-limit providers under concrete owners

* test: preserve mixed Claude account-switch regression

* refactor: consolidate Antigravity service contract import
2026-11-08 20:29:13 -08:00
Brennan Benson bf7dfff664 Keep Session History responsive on large histories: move session search SQLite to worker threads (#38945)
* Move session search SQLite into dedicated workers

* test: spawn the session search test worker with the shared worker helper

* fix: pass only drain promises to the channel's drain wait

* Repair session search failure and lifecycle boundaries

* Stop indexing tool output and reclaim existing rows

* test: say why the session search worker tests need a longer timeout

* Bound search cleanup and preserve failure and digest semantics

* Use the database row type for tool purge batches

* test: drop the same-connection mid-page write case now that each page reads one snapshot

* test: prove a mid-page delete from the writer can't change that page's hits

* Repair transcript cancellation cleanup and search test runtime admission

* fix: cancel active transcript finalization and enrichment waits

* fix: close transcript handles when cancellation wins delivery

* fix: preserve scan cancellation errors across parser waits

* test: prove cold session search bypasses an active writer batch

* fix: preserve search continuation through background tool cleanup

* fix: preserve search pages during orphan reclamation

* fix: bound typo repair posting visibility probes

* fix: preserve exact search terms when visibility is inconclusive

* test: drop orphan-reclaim cursor staleness case superseded by frozen continuation

* Bound session search work before ranking candidates

* Preserve the limit notice for empty search windows

* Bound session eligibility lookups and reuse FTS scoring statistics

* Index session scopes for population and candidate searches

* Derive search status from the live index after clear

* Preserve disabled search status during settings transitions

* Share planned expressions between spelling probes and search

* Keep identifier fragments out of spelling presence checks

* Report search initialization through its pending transition

* Bound spelling vocabulary work with the search posting budget

* Preserve search fallback while bounding distinct vocabulary seeks

* fix(session-search): drain removals before the worker queue fills; keep aborted close waits from failing teardown

* fix(session-search): hold writer commands when the worker queue is full instead of stopping the writer

* chore(ratchets): baseline the session search worker's one-shot entry check
2026-11-08 17:08:24 -08:00
Neil d101312bee refactor(sqlite): share one row cache across the SQLite-backed caches (#40028)
The last-status, GitHub cache, notification dismissal and model catalog stores each grew their
own legacy-file import, read-only startup read, changed-row writer and retry backoff. They now
share src/main/sqlite/row-cache/ (KeyedJsonRowCache with load/write, the legacy JSON source,
one failure classifier and backoff); each store keeps only its cadence and fencing policy.

Edge cases now behave the same in every store:
- a corrupt or rejected older-build file keeps the stored rows (it no longer wipes them);
- an older-build file that exists but cannot be read is never treated as absent;
- the import receipt is the file's content hash, without its mtime, so a copied leftover is
  still recognised as imported;
- while the rows or that file cannot be read, the store saves nothing that session and never
  deletes a file it did not load (dismissals keep retrying, as before);
- files are user-only and hardened everywhere.

The last-status and GitHub caches move to the shared row layout, so each rebuilds empty once.
2026-11-08 16:37:17 -08:00
Neil e1381cfa3e Rotate the server pairing identity when ORCA_INSTANCE_ID changes (#39217)
* Rotate the server pairing identity when ORCA_INSTANCE_ID changes

* Back up replaced identity files, keep the recorded id on reset, keep staged files once the rotating marker is published

* Add identity-reset files to the sync fs baseline and document the backup folder

* Report a reset honestly after finishing an interrupted rotation; keep first backups and the newest one
2026-11-08 16:35:43 -08:00
Neil 51fcb15154 refactor(browser): organize automation, cookies and session policy owners (#40002)
* refactor(browser): give agent-browser implementations concrete owners

* refactor: give cookie import and storage policies concrete owners

* test: target the concrete Chromium registry edge in cookie fixtures

* refactor: organize browser profile identity and permission owners

* refactor(browser): import input and cookie types from defining owners
2026-11-08 16:04:41 -08:00
Neil dc05c088aa perf(persistence): store notification dismissals and the model catalog as SQLite rows (#39997)
* perf(notifications): save mobile dismissal history as per-delivery SQLite rows

Each alert or dismissal rewrote the whole pretty-printed history file (hundreds of KB).
Rows now save individually through a shared row cache that fails fast on a locked file,
rebuilds once on corruption, and re-reads its baseline after outside commits. Unread
history is never replaced: events queue and merge once a retry reads it. An older build's
file is imported with a receipt committed alongside its rows, then removed only while it
is still that file.

The mobile-restore test now drains the original host's recovery-capsule work before
starting the recovered host, instead of relying on the old asynchronous file write.

* perf(model-catalog): save the agent model catalog as per-entry SQLite rows

Every listing change rewrote the whole multi-megabyte file. Entries now save only when
they change and failed saves retry with backoff. An older build's file is imported with a
receipt; an unreadable file is kept. If stored state cannot be read (a lock elsewhere),
the session starts cold and saves nothing, deciding nothing between the file and the rows.
2026-11-08 15:46:56 -08:00
Neil c50d4cd3e4 refactor: organize browser guest lifecycle owners (#39996)
* refactor: organize browser guest lifecycle owners

* test: resolve cross-version client owners and pre-ticket baseline

* test: record the released terminal registry path
2026-11-08 15:23:09 -08:00
Neil 176e6a4e98 perf(persistence): save the GitHub cache as per-entry SQLite rows every few minutes (#39993)
The PR/issue cache only seeds next launch's sidebar, but every flush rewrote the whole
~200 KB orca-github-cache.json. Store one row per entry in orca-github-cache.db, write only
changed rows, and save at most every three minutes plus at quit and explicit flush barriers.
An existing sidecar is imported and removed; older builds read a missing sidecar as empty.
2026-11-08 14:28:15 -08:00
Neil 06a528f774 perf(agent-hooks): save agent status as per-pane SQLite rows, every few minutes (#39995)
last-status.json was rewritten whole (~190 KB) up to every 5 s while agents ran. Status now
lives in agent-hooks/last-status.db with one row per pane and per authority commitment, and a
save writes only rows whose serialized content changed. Routine saves wait 3 minutes; authority
changes still save at once, and stop, quit and hook-disable flush. Rows past the 7-day TTL are
no longer saved. An existing last-status.json (written by this or an older build) is imported
on start and then removed.
2026-11-08 14:24:39 -08:00
Neil 65412f3f6d refactor: organize browser extension requests and rule owners (#39975)
* refactor: organize browser extension request and rule owners

* refactor: retain browser extension type-reference directives

* chore: follow concrete owners in sync filesystem baseline
2026-11-08 13:54:02 -08:00
Brennan Benson 1d28b8882c chore(ratchets): fail PRs that add sync fs calls on Electron main or new setInterval polls (#39930)
* chore(ratchets): count sync fs calls on Electron main and setInterval calls

Sync fs on main and fixed-cadence intervals that never settle were two of the
most common perf fix classes since September, and no gate counted them. Both
ratchets grandfather today's uses per file and fail when a file's count grows.

* chore(ratchets): count every sync fs export, src/shared and node:timers intervals

Review: the allow-list missed descriptor/copy APIs, src/shared helpers run on
main too, and setInterval imported from node:timers escaped the timer count.

* chore(ratchets): keep hosted setInterval calls beside a named timer import

Review: a named node:timers import zeroed window/globalThis calls too, a
destructured require was counted twice, and collector edits didn't select
the timer ratchet in check:changed.

* chore(ratchets): charge calls through an alias, not the alias binding

Decider ruling B on review finding C6: binding a plain alias of a gated call
counted as a use, so an alias refactor failed every collector-based ratchet.
Conditional/fallback aliases and exported bindings stay charged.

* chore(ratchets): count bare setInterval only when nothing local shadows it

Review: the timer ratchet kept its own narrower binding resolver, so alias
and namespace-destructure forms of an imported setInterval counted twice.
Module bindings are the shared collector's; a bare call is the global only
when the file declares no setInterval binding.

* chore(ratchets): resolve bare setInterval calls per scope

Decider ruling A: the file-wide shadow rule let an unrelated parameter or type
declaration named setInterval hide every global poll in the file. Each bare
call now resolves through a single-file TypeScript checker (noLib, noResolve)
and counts when it binds to nothing declared in the file.

* chore(ratchets): write the timer baseline exactly as --prune does

* chore(ratchets): charge global timer aliases and bracket access

CodeRabbit: `const schedule = setInterval; schedule(poll)` and
`window['setInterval'](poll)` counted zero. Count value references to the
global timer (per scope) instead of only direct calls.

* chore(ratchets): charge shorthand timer escapes; skip writes, typeof and JSX tags

Review: `{ setInterval }` of the global counted 0, while assignments to it,
parenthesized typeof probes and a <setInterval/> tag counted 1.

* chore(ratchets): charge compound assignments to the global timer

Review: `||=` and `??=` read setInterval before writing it, so only a
plain `=` target is write-only.

* chore(ratchets): regenerate baselines for files main moved

main's SSH reorganisation moved counted files under src/main/ssh and
src/main/managed-server; counts are unchanged except one sync fs call main
removed.
2026-11-08 13:34:07 -08:00