Skip to content

perf(bots): keep settled linked workers' reads between item views - #47911

Merged
brennanb2025 merged 21 commits into
mainfrom
brennanb2025/linked-workers-settled-cache
Nov 24, 2026
Merged

brennanb2025 merged 21 commits into
mainfrom
brennanb2025/linked-workers-settled-cache

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Every time Orca showed a bot's items, or checked whether an item's workers had hit a usage limit, it looked up every linked worker in the database from scratch. Most of those workers finished long ago, and their answers never change. Now Orca remembers each finished worker's answer. On each read it checks, in one small query, that the worker's rows haven't changed. When nothing has been written since the last check, it skips even that query.

What Changed

Before: BotItemLinkJoin.readLinkedWorkers re-read every linked Dispatch on every call. It walked the Dispatch's follow-up lineage, read its worker, Task, federated and dock rows, and projected its fleet state. That is about 10 synchronous SQLite get/all calls per linked Dispatch, all on the main thread. The recurring callers:

  • Each open Items list: re-reads on every items/workers notice for its bot, at most every 500 ms, and walks all the Dispatch links of the items it loaded.
  • The usage-limit pass (moveItemsOnUsageLimits): while any session is stopped on a usage limit, reads every linked Dispatch's state. It runs on each Dispatch row write, on each change to the stops, and on the scheduler's minute tick.
  • Item worker links: re-view an item on each write to a Dispatch it links.

After: a fully finished local worker is kept between reads, together with a fingerprint of its rows. "Fully finished" means:

  • its newest Dispatch is settled;
  • its read is completed, failed or stopped;
  • it runs on this host;
  • its terminal resource is released or absent;
  • its lineage is a plain follow-up chain: from the linked Dispatch to the newest by follow-ups alone (at most 32), and its terminal never belonged to a Dispatch outside that chain. A Dispatch has at most one follow-up (a unique index), so only the newest can gain one, and the fingerprint checks for that. A lineage that took any other path, such as a terminal handed to another Dispatch, reads live as before.

Each read checks every kept worker against one batched query. The query hashes the worker's newest Dispatch, worker, resource and Task rows, any resource that Dispatch owns, whether a follow-up or a paired-server record exists, and returns its current stop reason.

A kept worker is dropped when any of these happens:

  • Its fingerprint changes.
  • A row notice names one of its Dispatches (any Dispatch in its chain, or the one shown). The notice is the database's existing per-row TEMP trigger.
  • A paired server's verdict on it changes.
  • A Dispatch is deleted. A deletion drops every kept worker, because the deleted row may sit anywhere in a lineage chain.
  • The database changes (profile switch).

A commit by another connection to the database fires no notice here, so it drops every kept worker. Such commits are rare.

The query is skipped entirely while nothing has moved since the last check: this connection's write notices, PRAGMA data_version and the dock's revision counter.

Finished workers a read found are kept after it replies, 256 per event-loop turn, so a cold read costs what it did before. They wait in one shared queue that holds only ids and the projected worker, so overlapping reads never repeat the work. Each slice is kept only if nothing has been written since that read began, checked again after the slice's fingerprints are read.

If a write lands while a read waits, the read checks its kept workers again. If any changed, it reads the whole batch fresh, so links on one lineage never disagree. If a kept worker the read used is dropped before the reply, the read runs again.

Bounds:

  • 8,192 kept workers.
  • A worker whose own read is over 2,048 characters isn't kept.
  • Kept reports share a 1M-character budget. Reports past it are never copied and are read from their Task on use, once per Task per read.

Running, unreleased and remote workers are read fresh, as before. So are workspace and PR state.

readWorkers gained an optional map that returns each lineage it resolved. The item-link read moved to bot-items-linked-worker-states.ts. Which workers may be kept lives in bot-items-linked-worker-admission.ts, and the fingerprint SQL in bot-items-linked-worker-prints.ts.

Why

After the statement-cache fix, the remaining main-thread cost was the get/all calls themselves, repeated for workers whose rows never change.

  • Moving the reads to a worker thread wouldn't remove that cost. They mix SQLite rows with this process's live agent statuses and fleet projection, so they would still run in full on every refresh, only elsewhere.
  • Narrowing which items one pass reads helps only that caller. It still re-walks every eligible worker each time.
  • Validating kept reads covers every caller at once. This connection's row notices drop a worker at once. The fingerprint catches the writes no notice names, such as a new follow-up.

The hot lookups were already indexed: EXPLAIN QUERY PLAN shows an index SEARCH for each of them, so no index was added.

Linked Issue

Fixes #

Visual Proof

No UI change. Items show the same worker states, reports and stop reasons; only how often they're read changes. The screenshots are from the built app on the seeded profile, with kept reads in use:

Items list: Items list

An item with four linked workers: Item with linked workers

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

bot-items-link-join.test.ts runs against a real orchestration database with its triggers. It checks five things:

  • A finished worker's second read makes no lineage reads.
  • Starting a follow-up of that worker makes the next read show the follow-up.
  • A kept read shows a 5,000-character report correctly.
  • A kept worker shows its Task's new report.
  • A kept worker shows a report that was rewritten to the same length.

Built app on Linux, with a seeded profile: 18 bots, 612 items and 3,708 linked Dispatches with follow-up chains. Each bot's Items list was read once a second, round-robin. The main thread was CPU-profiled for 120 s idle, then for 120 s under 12 busy cores plus 2 fsync file churners. Two more checks ran on that build:

  • An item link read twice (fresh, then kept) showed its Task's new report right after the Task row was written on the app's own orchestration connection.
  • The Items list and an item with four linked workers rendered as before.

Memory: 8,192 kept workers (the cap) with realistic specs and reports came to about 1.8 MB.

Performance

Measured on Linux (28 cores), main thread, per minute, main → this PR:

  • Idle: time under readLinkedWorkers 549 ms → 17 ms; main-thread SQLite get/all ~129,000 → ~600; stalls 0 → 0.
  • Under CPU and fs load: time under readLinkedWorkers 1,059 ms → 20 ms; get/all ~126,000 → ~600; stalls 0 → 0.

The cost now scales with running workers and recent writes, not with item history.

While writes land between reads (busy workers), each read also runs one batched fingerprint query over the kept workers it reads, which is still far less than a full re-walk. A write during a read means that read's finished workers aren't kept, so on a busy profile the cache fills more slowly.

First read with nothing kept yet (after a restart), 3,000 finished linked workers, main and this PR alternating in one process, 11 runs each:

  • The read itself: median 262 ms on main and 263 ms on this PR, within run-to-run noise.
  • Keeping what it found takes about 45 ms once, after the reply, in slices of 256.
  • The next read: about 260 ms on main, 5–7 ms on this PR.

The kept workers' memory is bounded at 8,192 entries and a 1M-character report budget, about 1.8 MB in all.

Risk

The riskiest part is a kept read that should have been dropped: an item would show a worker's old state. Every path that can change a finished read is covered:

  • Row writes: a fingerprint change, plus a notice for this connection's writes.
  • Follow-ups: an existence check on the newest Dispatch.
  • Resource transfers: owned-resource ids.
  • Paired-server records: an existence check, plus verdict notices.
  • Stop reasons: read fresh with the fingerprint.
  • Deletions, and commits by another connection: drop every kept worker.
  • Profile switches: start empty.

A worker still on a pane, or running anywhere, is never kept.

Level: Medium

Back out with a plain revert; nothing is persisted.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change 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-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

The change is platform-neutral main-process code. Paired-server and SSH workers are never kept, so they read as before.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The change adds shared caching and invalidation for settled Dispatch worker reads. Worker lineage reads can record the Dispatches and session-worker results used to resolve each worker. Linked-worker reads now use LinkedWorkerStates for worker state, reports, and stop reasons. The chat-tree worker cache also uses the shared cache. Runtime notifications forward Dispatch row and federated-worker changes to the affected caches.

Merge Risk: Low · up to ea270

This change caches settled linked-worker reads to cut repeated database walks. In a narrow timing window, a live status change during a read could leave a settled worker cached under newer status evidence. Item views or usage-limit checks could then show stale worker state until the next status or Dispatch change. The impact is small and self-correcting, so this is mergeable with that follow-up in mind.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "perf(bots): keep settled linked workers' reads between item views" matches the main change. The PR adds a cache (SettledDispatchReadCache, LinkedWorkerStates) that keeps settled linked-work…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section that compares alternatives, a Risk section w…
Full details: Title check

Explanation

The title "perf(bots): keep settled linked workers' reads between item views" matches the main change. The PR adds a cache (SettledDispatchReadCache, LinkedWorkerStates) that keeps settled linked-worker reads between item views and usage-limit checks. It is a concise, conventional-commit style title that a teammate can scan in history. It does not name the invalidation mechanism, but that detail is not needed for a title.

Full details: Description check

Explanation

The description follows the repository template closely. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section that compares alternatives, a Risk section with level and rollback, and a Performance section with measurements. The Testing section lists a real-database test file and a manual Linux test on a seeded profile. Gaps: the Linked Issue section reads 'Fixes #' with no issue number. The AI Disclosure section is empty. The Review section is empty. The Performance section's 'None, because' sentence was replaced with measured data, which is acceptable. The Visual Proof section includes screenshots, which meets the UI requirement. The checklist items are all checked, including local lint/typecheck/test/build, which the author should confirm.

Resolution

Fill in the Linked Issue number (the template says outside contributors must link an actual issue). Complete the AI Disclosure section if an AI model was used. Remove or fill the empty Review section. Confirm that the checked lint, typecheck, test, and build items were actually run.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2fd7277c-9ec0-40f9-86dd-551c00de5892
Commits

Reviewing files that changed from the base of the PR and between 15b0e99 and f5290bb.

Files selected for processing: 9

  • src/main/bots/bot-chat-tree-host.ts
  • src/main/bots/bot-chat-tree-worker-cache.ts
  • src/main/bots/bot-items-link-join.test.ts
  • src/main/bots/bot-items-link-join.ts
  • src/main/bots/bot-items-linked-worker-states.ts
  • src/main/bots/bot-items-runtime.ts
  • src/main/bots/bot-work-workers-read.ts
  • src/main/bots/settled-dispatch-read-cache.ts
  • src/main/runtime/orca-runtime-bots.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Item views and the usage-limit pass re-walked every linked Dispatch's
lineage on the main thread each read. Settled workers' reads are now kept
and dropped by the orchestration database's own row notices for any
Dispatch the walk read, so a refresh reads only running workers and
lineages written since.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/linked-workers-settled-cache branch from f5290bb to ff5de0b Compare November 23, 2026 23:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b274a6ba-1b1b-4d64-b9e7-821900b213c4
Commits

Reviewing files that changed from the base of the PR and between f5290bb and ff5de0b.

Files selected for processing: 4

  • src/main/bots/bot-chat-tree-worker-cache.ts
  • src/main/bots/bot-items-linked-worker-states.ts
  • src/main/bots/bot-work-workers-read.ts
  • src/main/bots/settled-dispatch-read-cache.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Perf scan at ff5de0b: clean, a clear reduction.

  • Hot path: item views (each open Items list re-reads on every items/workers notice, at most every 500 ms), the usage-limit pass (every Dispatch row write while a session is stopped on a usage limit, plus the minute tick) and item worker links all go through readLinkedWorkers on Electron main. Before this change, each call made about 10 synchronous SQLite get/all calls per linked Dispatch.
  • After: settled reads are kept, so a call reads only running workers and lineages written since.
    • Measured on Linux, 3,708 linked Dispatches, 18 bots, one Items list read per second.
    • Main-thread SQLite get/all: ~129,000/min → ~67/min.
    • Time under readLinkedWorkers: 549 → 17 ms/min idle and 1,059 → 25 ms/min under CPU+fs load.
  • Growth:
    • Kept entries are capped at 16,384. Each lineage's Dispatches are indexed once per lineage, not per linked ref: a 1,000-step chain with every step linked keeps 1 group, 1,000 members and 1,000 index edges. Before that fix it was quadratic.
    • Drop guards (droppedAt, inserts) reset past the cap.
    • Entries for unlinked refs age out by LRU within the cap.
  • Per-write cost: each Dispatch row notice does one map lookup and drops only the groups that walked that Dispatch. It is constant per write and never flushes the whole cache.
  • Residual, pre-existing and not amplified: when the dock revision moves, a read re-reads stop reasons for its kept workers in one json_each query. main ran that query on every read.
  • Idle: no new timers, polls or subscriptions; 0 new idle wakeups.
  • Thread: still main, but the per-Dispatch SQLite work on hits is gone; misses cost what they did.
  • Hosts: paired-server and SSH workers are never kept, so they read as before.
  • Classes screened:
    • Sync SQLite on main: reduced, measured above.
    • Re-reading unchanged input: this is the fix.
    • Per-entity state outlives the entity: bounded by the cap, LRU.
    • Hot-path rescans: the chain case was fixed and measured.
    • Idle wakeups: none.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick comments: 1

src/main/bots/bot-items-link-join.test.ts: 1

88-89: Trivial · Maintainability & Code Quality · Quick win

Verify that the second read reloads the report.

These assertions also pass if the cache retains the full 5,000-character report. They do not protect the memory behavior introduced by this change.

After the warm-up, spy on the Task-result query. Assert that the second read executes that query. Keep the report-equality and no-lineage assertions.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84648ea3-8c77-4216-971f-3a6f701634af
Commits

Reviewing files that changed from the base of the PR and between c738b82 and d15e5fa.

Files selected for processing: 2

  • src/main/bots/bot-items-link-join.test.ts
  • src/main/bots/bot-items-linked-worker-states.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 123a28d4-f39e-4423-a921-be073ee1d80e
Commits

Reviewing files that changed from the base of the PR and between d15e5fa and ea27083.

Files selected for processing: 2

  • src/main/bots/bot-items-linked-worker-states.ts
  • src/main/bots/settled-dispatch-read-cache.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

…d check for writes after the fingerprint read
…within the budget, and show reports written during a read
…nished workers after the reply, and allow long worktree paths
…nd never restore one a failed re-read dropped
…y after the reply, and bound pending reports
@brennanb2025

brennanb2025 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Perf scan at 793ffa3: clean. The PR is a clear reduction.

Hot path. Three callers go through readLinkedWorkers on Electron main:

  • Item views: each open Items list re-reads on every items/workers notice, at most every 500 ms.
  • The usage-limit pass: it runs on every Dispatch row write while a session is stopped on a usage limit, and on the minute tick.
  • Item worker links.

Before this change, each call made about 10 synchronous SQLite get/all calls per linked Dispatch.

After. A finished local worker whose lineage is a plain follow-up chain is kept between reads. A kept worker is checked with one batched, indexed fingerprint query, and only when something moved since its last check: this connection's write notices, PRAGMA data_version or the dock revision. Measured on Linux with 3,708 linked Dispatches, 18 bots and one Items list read per second:

  • Idle: time under readLinkedWorkers 549 → 17 ms/min; main-thread SQLite get/all ~129,000 → ~600 per minute; 0 stalls.
  • Under CPU and fs load: time under readLinkedWorkers 1,059 → 20 ms/min; get/all ~126,000 → ~600 per minute; 0 stalls.

In both windows the hot reads made no lineage-walk queries.

Cold start. With 3,000 finished linked workers and the two versions alternating in one process, the first read has a median of 262 ms on main and 263 ms on this PR. Keeping what it found costs about 45 ms once, after the reply, in 256-entry slices. The next read takes 5–7 ms.

Growth.

  • Kept entries are capped at 8,192, with LRU eviction.
  • A worker's own read is capped at 2,048 characters, and kept reports share a 1M-character budget.
  • Memory at the cap is 1.8 MB with realistic specs.
  • Chains are capped at 32 steps.
  • Admission rejects a longer terminal history by scanning at most 33 entries, never parsing the whole list.
  • The keep queue is shared by all reads, holds ids and projected workers only, and is consumed 256 entries per turn straight off its iterator. Total queue work is linear.
  • The Dispatch-to-refs drop index shrinks together with the kept entries.

Per-write cost. A row notice does one map lookup and drops only the workers indexed under that Dispatch. A deletion, or a commit by another connection (both rare), drops all kept workers, after which reads cost what they did on main.

Writes during a read. Finished workers that a read found are kept only if nothing moved between the start of the read and the moment their slice's fingerprints are read. On a busy profile the cache therefore fills more slowly. Read cost is never above main's plus one fingerprint query.

Idle.

  • No new timers, polls or subscriptions.
  • Each read schedules one setImmediate for keeping, which does nothing when there is nothing to keep. Keeping runs only after reads, which are triggered by notices.
  • New idle wakeups: 0.

Thread. Still Electron main, but the per-Dispatch SQLite work on hits is gone, and misses cost what they did.

Hosts. Paired-server and SSH workers are never kept, so they read as before.

Classes screened:

  • Sync SQLite on main: reduced, measured above.
  • Re-reading unchanged input: this is the fix.
  • Per-entity state outliving the entity: bounded by caps and LRU.
  • Hot-path rescans: queue and history scans are bounded, as above.
  • Unbounded queues: shared and bounded by the reads' refs.
  • Idle wakeups: none.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: ready for review on 793ffa3.

Problem. Bot item views and the usage-limit pass re-walked every linked Dispatch's lineage on the main thread on every refresh. That cost about 10 synchronous SQLite reads per link, and about 549 ms/min of main-thread time on a profile with ~3,700 linked Dispatches.

Change. A finished local worker whose lineage is a plain follow-up chain is kept between reads. It is re-checked with one batched fingerprint query, and only when the database moved. Every other lineage reads live, as before. There is no visible UI change.

Fixed during review:

  • Kept workers are dropped by row notices for any Dispatch in their chain.
  • A deletion, or a commit by another connection, drops every kept worker.
  • A write during a read re-checks that read's kept workers, and re-reads the whole batch if any changed.
  • A reply is re-run if a kept worker it used changed before it went out.
  • Keeping happens after the reply, from one shared, bounded queue.
  • Lineages with a terminal handed to another Dispatch are no longer kept.

Deferred (non-blocking): on a profile with constant writes, the cache fills more slowly, because a read keeps nothing new if a write lands during it. Cost is then still no more than before, plus one fingerprint query.

Verified on this head:

  • check:changed passes 27/27, and CI is green.
  • Linux, built app, 3,708 linked Dispatches. Time under readLinkedWorkers went from 549 to 17 ms/min idle and from 1,059 to 20 ms/min under CPU and fs load. SQLite get/all per minute went from ~129k to ~600, with 0 stalls.
  • First read after a restart: median 262 ms on main against 263 ms here.
  • Memory at the 8,192-entry cap: 1.8 MB.
  • Two independent reviews came back clean, and a blinded regression audit returned SAFE.

QA screenshots (built app, seeded profile):

The Items list:
Items list

An item with four linked workers:
Item with linked workers

@brennanb2025
brennanb2025 merged commit e07572e into main Nov 24, 2026
56 checks passed
AmethystLiang added a commit that referenced this pull request Nov 24, 2026
…ation going after the picker closes (#46245)

* feat(bots): inset the avatar description field and keep picture generation going after the picker closes

* fix(bots): an outfit pick is a newer choice than a picture still being generated

Rebased onto main's avatar outfits. An outfit-only pick now notes a choice in the
picture ledger and holds it open until its save is acknowledged, and the host bumps
avatarRevision on an outfit write, so a running Generate can no longer overwrite a
picked outfit. The color and outfit saves share main's useBotLookSave queue.

Also: the Generating tooltip stays controlled, "Close anytime" wraps inside the
tile, a failed Create no longer reopens New bot's picture popover, and Create's
picture handoff is one helper shared by New bot and Import.

* fix(bots): a look picked during a generated upload keeps its mascot, and a lost profile save no longer strands fresh uploads

A color or outfit pick made while a generated picture is uploading now sends the
mascot shown again, so the look wins whichever write the host takes first.

Before its bots are first listed, the host raises any record whose avatar revision is
behind its home's bot.json (a profile that lost its last save). A fresh read then
anchors a new Generate at the real revision, while a request made before the crash
is still refused.

* fix(bots): keep newer picture choices across import and settings

* Remove chat filter from group items (#47851)

* Remove group item chat filter

* Remove retired runtime catalog entries

* Fix phone group item refresh and paging

* Fix phone test array style

* Keep group asks fresh during phone refresh

* Clear departed group member reads

* feat(app-rail): space rail buttons out to a 40px rhythm (#48049)

Rail buttons sat on a tight 32px pitch. A 12px gap puts each 28px button in a
40x40 cell, matching the right activity bar, and the overflow slot follows.

Co-authored-by: m4air <[email protected]>

* fix(agent-permissions): show permission descriptions as tooltips (#42557)

* fix(agent-permissions): show permission descriptions as tooltips

Permission menus rendered a description line under every choice, which made
them tall. Rows are now one line; the description is a hoverable side tooltip
and always the row's accessible description. It renders inline on touch-only
screens, in narrow or zoomed windows, and on rows tapped in a mouse-opened
menu (first tap reveals, second selects). Disabled choices stay focusable so
their description can be read, and one Escape closes the tooltip and menu.

* fix(agent-permissions): comply with primitive style and test gates

* fix(agent-permissions): fit composer picker within zoomed viewport

* fix(agent-permissions): retain inherited permission row primitive

* fix(agent-permissions): constrain settings choices to viewport

* fix(items): read answers and drafts written with the pre-#47963 question line (#48041)

* fix(items): read answers and drafts written with the pre-#47963 question line

* fix(items): prefer this build's question heads before older ones across all questions

* fix(items): a longer old question head keeps its line over a shorter current one

* perf(items): work out each ask's question heads once, and skip head matching for a reply whose label does not end the line

* fix(i18n): translate English terms left in 64 Simplified Chinese strings (#48040)

Replace English terms that were left inside Simplified Chinese values
(Chat UI, API key, API token, issue, merge request, Linear ticket, Agent,
SSH config and 17 one-off terms) with the Chinese term zh.json already
uses for the same thing elsewhere, so one feature no longer has two names
in the Chinese UI. Only catalog values in zh.json change.

Fixes #48042

Co-authored-by: Neil <[email protected]>

* fix(dock): re-check Stop and Retry against the live dock, cancel held presses across a feed drop (#47951)

Follow-up to #47774. Before Stop is sent, including from Retry, it is checked against the live dock: same party, same dispatch, not settled, and stoppable by the same rule the row renders with. Settled retries read "Already stopped". Held mouse, touch and key presses on Stop are cancelled by a feed loss during the press, and each click activates as the press that produced it. Stop and Clear draw an inset focus ring that stays visible at 360px. Focus on the failure line passes to the next line or the dock toggle.

* test: clarify the agent-home guard error and run the reclaim test on Node on macOS (#47538)

Co-authored-by: jiang3ye <[email protected]>

* perf(browser): stream Save to this computer as binary frames so memory stays flat (#48059)

* perf(browser): stream a server download's copy as binary frames with acks

Save to this computer read the file as base64 JSON replies, so desktop
main's heap swung by hundreds of MB of short-lived strings on a big copy.
The host now sends the file as binary frames on the stream's own socket,
from a fixed set of buffers, at most a 2 MiB window ahead of the desktop's
acks; the desktop writes each frame and acks it. Memory no longer depends
on file size, and the copy is about five times faster.

* fix(browser): mark copy frames, refuse odd-sized ones, stop with the server's transport

* fix(browser): give up on a copy whose file stops arriving for a minute

* fix(browser): stop a copy whose file changes in place; finish short reads

* fix(mobile): make item thread comments, description and questions selectable on iOS (#48068)

Item thread comment bodies, the item description and ask question text
rendered MobileMarkdown without rangeSelectable. Inside the OTA shell
(react-native-web), a paragraph Text with selectable=false gets
user-select:none, so a long press did nothing. These call sites now pass
rangeSelectable={INLINE_TEXT_SELECTION}, matching the native-chat
transcript. A native (non-shell) Android render gets false and keeps
main's block selection.

Fixes #48039

* fix(bots): to stay silent a bot writes only NO_REPLY; any other words are its reply (#47962)

* fix(bots): to stay silent a bot writes only NO_REPLY; any other words are its reply

* fix(bots): only a tool that answered whoever waits stands in for the reply; every quiet note names the marker

* fix(bots): a thread request already answered with bot reply needs only the marker; leave the signed-off wait prompt as it was

* fix(bots): item-only silence only when no thread waits, and silence drops a memory's status line

* fix(bots): an item comment's silence also waits for any chat or thread still owed an answer

* fix(bots): a silent turn whose answer stays in Orca may keep one owner note before NO_REPLY

Turns answering a Slack, GitHub, Linear or Discord thread stay exactly NO_REPLY.

* fix(bots): the Home Chat owner note holds only when the turn answers no outside message; mail silence also waits for chat

* feat(shell): app rail destinations fill the whole page (#48045)

* feat(app-rail): rail destinations fill the whole page

With the experimental app rail on, Tasks, Automations, Artifacts, Skills
and Orca Mobile now fill the page beside the rail. The workspace list
collapses to zero width (its rows unmount; the saved open state and
width are never written), while the sidebar root stays in one keyed slot
so its dialogs, an unsaved Workspace details draft and the Workspace
Board keep their state across view switches.

On a rail page the sidebar toggle, Cmd+B, Open Workspace Board and the
Agent Dashboard shortcut return to Workspaces with the list showing,
then act. Settings keeps its current behavior.

Keyboard focus never drops to the page body: a page opened while a list
row had focus, or an overlay that closes back to a removed element,
hands focus to the page once it has loaded, unless something newer took
it. The titlebar controls keep focus when they move between the column
header and the page titlebar.

With the rail off, nothing changes.

* fix(app-rail): keep the hidden workspace list mounted on rail pages

A rail page used to unmount the workspace list rows. That dropped
unsaved edits in the list (the detected setup command, the Rename
group dialog), closed a row's open context menu under keyboard focus,
and made returning to Workspaces revalidate the Smart Sort order and
write it again.

The rows now stay mounted while a rail page hides the list: the list
keeps zero width and is inert and hidden from assistive technology.
Only collapsing the list yourself unmounts the rows, as before. Focus
inside the list when it hides moves into the page once it loads.

* fix(app-rail): keep the hidden workspace list out of keyboard handling

On a rail page the workspace list stays mounted but hidden, and two
keyboard paths still reached it:

- Its global shortcuts (focus worktree list, next/previous workspace,
  collapse all projects) acted on the hidden rows, for example unfolding
  Projects while Tasks stayed on screen. They now do nothing while a
  rail page hides the list, and still work on Workspaces.
- Escape from a nested context-menu item (Copy > Path) left focus on the
  page body, because the submenu is portaled apart from its menu. A
  close now also counts when the last focused element left the DOM, so
  focus moves into the page as it does for top-level items.

* fix(app-rail): recover focus only from a menu or dialog that owned it

Focus recovery on a rail page treated any focused element that had left
the page as stranded by the next overlay close. Clicking a control
outside an open, nonmodal menu could focus that control and remove it
before the menu reported its close, and focus then jumped into the
page.

Recovery now records which menus and dialogs own focus whenever focus
moves, including the parent menu of a portaled submenu, and acts on a
close only when the closing one owned it.

* fix(connectors): a bot's words before a trailing NO_REPLY post in every Slack conversation (#47896)

* perf(ipc): build the desktop runtime RPC registry once instead of per call (#47917)

* Check agent CLI updates after launch settles, a few at a time (#47923)

* perf(agent-cli-update): defer the startup CLI check and run at most three --version probes at once

* fix(agent-cli-update): give the update check a budget that covers queued version probes

* fix(agent-cli-update): cover the worst-case probe queue and let a failed check retry

* fix(i18n): translate 48 missing Korean strings for team-managed updates, plugins, and settings (#48053)

Korean users saw English in the team-required update card and restart
dialog, the install-on-quit prompt, required-plugin warnings, the plugin
catalog's team labels, the Orca account console row, and the settings
that a team turns off (Relay, Computer Use, artifacts, development
folders, bots). These keys existed in en.json but not in ko.json.

Each value is inserted after its preceding en.json sibling so the diff
is additions only, and every value keeps the English placeholder set.
A theme port uses 포팅 버전 so it does not read as a network port (포트),
and botsOffByTeam uses 이 실행 to match its botsOff and botPaused siblings.

Fixes #48054

Co-authored-by: Neil <[email protected]>

* Move the Linux port scan's per-file process lookup off Orca's main process (#47943)

* perf(ports): skip the Linux /proc fd walk when listening sockets are unchanged

The 30 s workspace port scan read every fd link of every process on the
machine to map listening sockets to pids. Reuse the last map while the set
of listening inodes and each owner's start time are unchanged; ownership
checks that authorize a kill still walk fresh.

* fix(ports): bound the Linux socket-owner cache to 10 scans and require our own sockets mapped

A socket handed to a child while its parent lives, or a root socket later
inherited by a user process, kept its inode and the cached owner. Walk again at
least every 10th scan and whenever one of our own sockets has no owner.

* fix(ports): revalidate cached Linux socket owners instead of trusting a live pid

A supervisor that handed its socket to a child and closed its copy stayed the
cached owner, so the port showed as external and its advertised URL was
dropped. On reuse, check that each cached owner still holds its socket and walk
processes started since the last walk, keeping the full walk's last-holder rule;
walk everything again after 10 scans or 5 minutes.

* perf(ports): list Linux socket owners with one ls in the port-scan worker

Replace the reuse cache with exact full-walk semantics: one ls -ln /proc/*/fd
in the port-scan worker lists every socket holder, and the owner is the last
holder in /proc's listing order, as the node walk picked. Falls back to the node
walk if the command fails.

* fix(ports): fall back to the node walk when the socket listing has no holders

* fix(ports): print only wanted socket holders from the Linux listing

Printing every socket fd could pass the worker's 2 MiB output limit on a large
machine, failing every scan into the main-thread walk. awk now prints only the
listener inodes plus a count of well-formed socket lines, which tells an
unreadable ls layout apart from listeners Orca can't see; holder lines must end
in ' -> socket:[N]'.

* fix(ports): retry a failed Linux socket listing every 10th scan instead of every scan

* fix(ports): keep the exact readlink walk for Linux kill and allow-list ownership checks

* fix(ports): stream one ls process through a worker-side filter for Linux socket owners

The sh | ls | awk pipeline left ls and awk running when a timeout or quit killed
sh, and awk's list search grew with sockets x listeners. The worker now execs a
single ls (LC_ALL=C), tracks it with the other scan children, and filters rows
line by line with a Set: only exact 11-field 'fd -> socket:[N]' rows count.

* fix(ports): run the Linux socket listing with only PATH and drop just an over-long line

TIME_STYLE or QUOTING_STYLE in Orca's environment changed ls's layout and
disabled the listing; an over-long path line split across chunks cleared the
current pid and lost that process's later sockets.

* fix(ports): list Linux fds with ls -q so a path with newlines can't forge a holder row

* fix(ports): ignore Linux socket holders that the /proc listing never saw

* fix(i18n): translate 64 missing Korean strings for skills, settings, the status bar, and the activity bar (#48057)

Add Korean translations for keys that were missing from ko.json, covering
skill replace/backup notices, shared Codex servers settings, usage status
bar rows, the activity bar reorder controls, and other recently added UI
strings, so Korean users no longer see English fallbacks there. Also add
the missing _one plural forms for counts.

Co-authored-by: Neil <[email protected]>

* Keep workspace deletion review at a stable size (#48065)

* Keep workspace deletion review at a stable size

* Animate workspace deletion file details

* Preserve disclosure panel links while collapsed

* fix(i18n): translate 36 missing Korean strings for browser cookies, server downloads, and port forwarding (#48055)

Korean users saw English in Settings > Browser's "Clear cookies" row and
its confirmation dialog, the download and print notices of pages
streamed from a paired server, browser-tab open failures, the paired
server port-forward toasts, the SSH session-host detail, and the
terminal link popover's refusal message. These keys existed in en.json
but not in ko.json, so i18next fell back to English.

Each value is inserted after its preceding en.json sibling and keeps the
English placeholder set. The SSH port-forward toast names the Ports
panel ("포트 패널") so it points to where forwarding is done.

Fixes #48056

Co-authored-by: Neil <[email protected]>

* fix(codex): never write a WSL distro's Codex config; regenerate the managed copy from it (#45247)

* fix(codex): never write a WSL distro's Codex config; regenerate the managed copy from it

* fix(codex): treat mapped-drive and drvfs distro configs as the distro's, write the baseline atomically, and recover a held config before the history pass

* fix(codex): recognize the extended spelling of a mapped distro drive, and leave the baseline and history writers as on main

* chore: drop an unrelated lockfile change

* test(codex): an unchanged WSL regeneration leaves the managed config untouched

* fix(codex): drop a held-back conflict for a ~/.codex linked or mapped into a distro

* fix(codex): skip the promotion write when a linked ~/.codex folder can't be resolved

* fix(cli): save downloads beside an older file of the same name instead of refusing (#48067)

* fix(cli): save downloads without --out next to, not instead of, an older file of the same name

* fix(cli): name a nameless or path-like download by its id, without Windows-dropped trailing dots

* fix(codex): summarize every file of one multi-file apply_patch in native chat (#48038)

A completed Codex fileChange that touched several files was saved as one
headerless join under a "N files" path, and the client refused to name any
file from a count, so the turn showed no changed-files summary.

Each file of a multi-file change now gets its own diff --git section
(whole-file hunks for add/delete, rename destinations kept). The Diff call
carries body.paths, and a "N files" patch is summarized only when it arrives
whole with exactly N git-headed sections whose paths match. Larger patches,
header-unsafe names and older journals keep the raw "Edited N files" row.

Refs #48025

Co-authored-by: Neil <[email protected]>
Co-authored-by: bbingz <[email protected]>

* feat(checks): show skeletons while checks and comments load (#47812)

Show layout-matched placeholders on the first checks and comments reads. Keep loaded results visible during refresh, distinguish unread from empty, and respect reduced motion.

* feat(app-rail): tighten rail button gap to 10px (#48084)

Keep the overflow slot height in step (28px button + 10px gap).

Co-authored-by: m4air <[email protected]>

* perf(bots): keep settled linked workers' reads between item views (#47911)

* perf(bots): keep settled linked workers' reads between item views

Item views and the usage-limit pass re-walked every linked Dispatch's
lineage on the main thread each read. Settled workers' reads are now kept
and dropped by the orchestration database's own row notices for any
Dispatch the walk read, so a refresh reads only running workers and
lineages written since.

* perf(bots): index a lineage's kept reads once, not per linked ref

* fix(bots): never keep a linked worker read whose Task or follow-ups couldn't be read

* perf(bots): keep only short reports with kept linked-worker reads

* fix(bots): batch insert lookups, copy kept values, and re-read hits a write dropped mid-read

* fix(bots): one status snapshot per linked-worker read, a report budget, and drops on another connection's writes

* fix(bots): keep only linked workers off a live pane, cap kept reports, and catch mid-read follow-ups

* perf(bots): validate kept linked workers with one fingerprint read per pass instead of tracking row events

* perf(bots): budget kept linked-worker reports, not entries, and skip long worker reads

* perf(bots): skip the fingerprint read when no write has landed since the last check

* fix(bots): drop a kept linked worker on its own Dispatch's notice, and check for writes after the fingerprint read

* fix(bots): drop kept linked workers on a deletion, copy reports only within the budget, and show reports written during a read

* fix(bots): re-read kept linked workers dropped during a read, keep finished workers after the reply, and allow long worktree paths

* fix(bots): drop kept linked workers on another connection's commit, and never restore one a failed re-read dropped

* fix(bots): re-check kept linked workers after each recovery read, not once

* fix(bots): re-check kept linked workers after a read awaits, keep only after the reply, and bound pending reports

* fix(bots): keep only plain follow-up chains, re-read a whole batch a write changed, and queue kept workers once

* fix(bots): re-check kept linked workers by fingerprint before a read replies, and never throw while keeping

* perf(bots): skip long terminal histories unparsed, and take keep slices off the queue's iterator

* fix(bots): read the database version once per linked-worker check

* fix(bots): check a linked-worker reply against the stamp its kept workers were checked at

* Preserve avatar choices across generation and repair revisions per bot

* Restored browser tabs load after a restart when an extension is installed (#47262)

* fix(browser): restored tabs wait for the profile's extensions before their first load

* fix(browser): a navigation during the held first load keeps the restored back list

* fix(browser): hold navigations made during the first-load wait and replay the newest

* fix(browser): keep the held page loading after its stop; restore only onto an empty page

* fix(browser): queue loads asked for during the first-load wait instead of stopping them

* fix(browser): keep a queued load's request options; reject it when the page closes

* fix(browser): replay any queued load with options directly

* fix(browser): a held page always waits until its profile's extensions are in the session

* fix(browser): closing a held page ends its hold and settles queued loads

* fix(browser): a navigation started outside loadURL during the hold still supersedes it

* test(browser): a held first load starts nothing until ready; move it to its own module

* test(browser): settle before the negative check; cover the load-ended fallback

* fix(browser): record startup extension ids at attach, so page-start needs no session registry import

* test(browser): note why the fake page and session casts are sound

* fix(browser): bound the in-session wait; a held load's deadline counts from its release

* fix(browser): one presence listener per profile, ended by the give-up; Stop cancels a held load

* fix(browser): the desktop attach passes the extension wait in, so the orcad bundle doesn't pull in extension code

* fix(browser): Stop ends the hold and stops real loads; failed extension loads end the wait; keep only a wait that gave up

* fix(browser): Stop with nothing loading settles the page load; later waits skip failed extensions; a wait is shared per profile attach

* perf(browser): every startup load's end, skipped or cancelled too, ends the page wait; keyed startup set

* fix(browser): Stop on a held restore keeps its history; a cancelled route initialization stops waiting for extensions

* perf(browser): a page's extension wait ends when the page closes; goto reports the closed tab

* fix(browser): don't hold a route page's blank bootstrap, which must finish within its mount deadline

* fix(browser): route navigations wait for extensions too; the attach's load deadline counts from attach again

* fix(browser): a route navigation rechecks live authority after waiting for extensions

* perf(browser): a cancelled route navigation stops waiting for extensions and doesn't load

* fix(browser): loads after Stop still wait for extensions; an overtaken route navigation doesn't load

* fix(browser): after Stop the saved history goes back only once ready; a waiting route navigation yields to a newer one

* refactor(browser): defer a page's guest until its profile's extensions are ready, instead of holding its first load

As a browser restores tabs only after the profile's extensions load: desktop tabs get their attach
marker, and This-device pages mount, only once the page's session has started its extensions. The
first-load hold on an attached guest (loadURL/stop overrides, queued loads, Stop and history
handling, route navigation waits) is removed.

* fix(browser): a waiting tab attaches after a remount, shows loading, keeps an address entered meanwhile; registration waits extend only on timeout; a failed This-device creation releases its extensions

* fix(browser): registration waits cover a wait that ended in their window and keep listening; closing a waking page cancels its wake; the newest address wins; Stop is a no-op while waiting

* fix(browser): cap the extension wait at 5 s, inside the deadlines around page creation; a page opened at the cap loads again once if its first load stalled; a closed waiting tab doesn't re-prepare

* fix(browser): the late-start retry keeps only live pages, yields to Stop and newer navigations, and is desktop-only; Stop during the wait keeps the page closed until Reload

* fix(browser): the late retry ends once the extensions are in the session and reloads a restored entry; Stop's marker yields to Reload or a new address

* perf(browser): no partition lookup with extensions off or for attached profiles; a refused This-device mount releases its extensions; any Reload undoes a waiting Stop; Stop-then-type reuses the deferred attach

* fix(browser): trim to the desktop defer: no Stop state while waiting, This-device keeps main's 3 s wait at navigation, and only restoring tabs load again

* fix(browser): a restoring tab loads again only if an extension loaded while its first request was in flight; no validation or Stop while a tab waits

* fix(browser): This-device blank first pages wait for extensions again (at most 3 s, as on main); no extra loading update before a tab's page exists

* fix(browser): retry only after the load that resets a session's loaders; an address typed during the wait opens without a second wait; partition lookup by index

* perf(browser): the late-retry extension listener is on only while a page still waits on it

* perf(browser): a routed page's session finds its source profile by its route, without scanning saved profiles

* refactor(browser): drop the one-time retry past the extension wait's bound; a stalled page keeps the existing notice and manual reload

* perf(browser): the extension presence observer ends with the startup load or the wait's bound

* Regenerate the avatar RPC parameter catalog

* Give New bot picture arrows room and keep the Generate draft (#47173)

Static analysis fails only on browser-session-registry.ts (301 lines), which already fails on main since #47262 and isn't touched by this PR. CI otherwise green; code review and UX-I passed on this head.

* Recover damaged avatar histories without blocking other bots

* Use the reviewed bot picture recovery messages

* Keep pristine bot manifests compatible with earlier homes

* Reject repaired picture histories missing their revision

---------

Co-authored-by: orca-remote-automation[bot] <359726236+orca-remote-automation[bot]@users.noreply.github.com>
Co-authored-by: m4air <[email protected]>
Co-authored-by: Jinwoo Hong <[email protected]>
Co-authored-by: Yohan <[email protected]>
Co-authored-by: Neil <[email protected]>
Co-authored-by: jiang3ye <[email protected]>
Co-authored-by: Kelvin Amoaba <[email protected]>
Co-authored-by: Neil <[email protected]>
Co-authored-by: Brennan Benson <[email protected]>
Co-authored-by: 2SinceJuly <[email protected]>
Co-authored-by: bbingz <[email protected]>
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