Skip to content

Bound per-write chat selector work and guard ownership scans - #32109

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/perf-guards-selector-fanout
Oct 23, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/perf-guards-selector-fanout

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​315 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​299
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​132 $\color{#cf222e}{\Huge{\mathbf{−}}}$​91 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41

With many chats mounted, repeated app-store writes made each subscriber scan workspace tabs to find chat owners. A captured image-check path accounted for about 16% of renderer work, and sender labels and file links repeated the same ownership search. #32098 limited image checks to relevant restored local attachments; this change shares the remaining ownership lookup work across subscribers.

Users get less repeated renderer work with the same sender labels, file-link destinations, attachment checks, collision ordering and host routing. Saved data and mixed-version behavior are unchanged. Every mounted subscriber still receives store writes; this does not remove the global notification fan-out.

Changes

  • Derive a shared index once per immutable tab-map identity, with separate session, structured-tab and terminal-tab lookup keys. Preserve first-workspace ordering and terminal-map precedence. Sender host qualification still reads current state.
  • Pass the supplied store snapshot into image authority. Asynchronous callers read a fresh snapshot. Preserve Gate draft image ownership checks by local attachments #32098's image eligibility gate, authority comparison and late-result/retry behavior.
  • Keep the four established whole-store/fresh-result selector rules, and resolve imported hooks, shallow wrappers, module selectors and module helpers by lexical binding. Locally shadowed functions no longer resolve to an unrelated import or module declaration. Unknown wrappers and imported helpers remain outside inspection.
  • Exercise three real hook families against paired populations of 10 chats / 6 workspaces / 96 terminal rows and 100 chats / 60 workspaces / 960 terminal rows. Each case performs 50 unrelated store writes with zero counted tab-map enumerations, subscriber rerenders or registered owner-resolver calls. Replaced maps allow at most one enumeration each and must update the moved chat's owner, label and file-link context correctly. One eligible local attachment check stays pending during measurement.

Coverage and scope

There are no new state-use or whole-map-scan lint rules, including in the performance audit or inherited mobile configuration. The proposed diagnostics were removed because their source inference could reject valid cached or snapshot-based functions. This deliberately narrows source enforcement: scalar scans or state-independent work in unexercised consumers can pass. Behavioral contracts protect the paths they actually exercise; they mount three hooks rather than entire composer/message trees.

The count measures map enumeration, not arbitrary selector CPU, row visits, selector executions or notification count. A new source identity still requires visiting its rows once to rebuild the index. Zero rerenders does not mean selectors never run. One pending restore does not represent 100 concurrent restores.

The common pattern is shared derived lookup with observable work bounds. Intended compatibility adapter: ownership remains derived from tabs so existing terminal IDs, structured tab IDs, host-unqualified draft scopes and sender host precedence retain their established results. A full migration of ownership facts to chat entities is not scheduled by this PR. No saved field, wire operation, dependency or new user-action refusal is added. Native production changes remain +83/-44; this revision adds no native production code.

Validation

The runtime/tooling head ea7f2f2869fee2dcd812a9581ec6df22d7879e68 passed 113 tests in 10 explicitly named Vitest files through the automatic tc-gate queue: plugin fixtures, six scale-contract cases, composer attachments, owner selectors, shared tab indexes, sender identity and host routing, runtime-owner selector, file links and workspace draft removal. Normal pre-commit passed. Main was merged once from 55b255e164fcf465e6afb05e222f320f13c0767f; the merge-side lint-staged check passed and no conflicts needed resolution. Final head 1d8e6e8b51026a34f4880fc83d7c02b0a00581e9 changes only the scale fixture key to its stable saved scope; all 16 plugin/performance tests pass on that head. Two review rounds, a design-panel ruling, fresh final reference comparison and readiness/performance review are complete with no unresolved proven findings. Full exact-head PR Checks passed static analysis/typecheck, all five unit shards, relay integration, both package jobs and the aggregate gate. Performance contracts passed on Linux, macOS and Windows.

Fresh negative controls used pre-PR source 44ab20296522f06b5cea40f58e3872f77ba89243 against only the changed 100-chat cases. Every control reached an actual bound assertion and failed as expected; no import/compile failure counted:

Restored or disabled change Actual failure
Sender lookup 5,000 unified-map enumerations on unrelated writes; budget 0
File-link lookup 100 terminal-map enumerations after replacement; budget at most 1
Draft-owner lookup 50 unified-map enumerations; budget 0
Image authority snapshot input 50 registered owner-resolver calls; budget 0
Shared index reuse disabled All three corresponding consumer bounds failed

The implementation was committed before controls, and each mutation restored exact saved source bytes in a finally block. The final merged harness and mutation baselines are unchanged from those control runs. No app run is claimed; this behavior-preserving performance change uses test evidence. Existing asynchronous attachment tests retain pending, late-result and retry coverage.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 22, 2026 22:05
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent 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: 69da6236-cd43-4fe0-b2a4-bd761dbfdac3
📥 Commits

Reviewing files that changed from the base of the PR and between 0344a4d and ea7f2f2.

📒 Files selected for processing: 2
  • config/oxlint-plugins/app-store-performance.mjs
  • config/scripts/app-store-performance-plugin.test.mjs
🚧 Files skipped from review as they are similar to previous changes: 1
  • config/scripts/app-store-performance-plugin.test.mjs

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

📝 Walkthrough

The app-store performance lint rules now resolve selectors, helpers, and imported hooks by lexical binding. Native-chat code adds cached workspace lookups and uses them for tab ownership and draft-scope resolution. Composer image checks derive local-store authority from current app state. Tests cover lexical shadows, index behavior, ownership updates, and subscriber activity during store changes.

Priority: ⚪ Pending latest changes

Merge Risk: ⚪ Minimal · up to ea7f2

The previously reported null-guard lint issue does not apply to the current code. No issue identified here prevents merging after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 24.32% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is thorough and follows the template closely. It has an ELI5-style opening, a detailed What Changed/Why section (shared per-tab-map index, image authority snapshot input, lexical-bindi… 1. Add a Linked Issue: replace the 'Fixes #' placeholder with an actual issue number that this PR closes. Outside contributors need a real linked issue; 'Refs' is not sufficient.
2. Add a Visual Proof section. This PR changes performance in…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "Bound per-write chat selector work and guard ownership scans" matches the main change. The PR adds a shared ownership index for tab maps, which bounds per-write selector work and guards rep…
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.
Full details: Title check

Explanation

The title "Bound per-write chat selector work and guard ownership scans" matches the main change. The PR adds a shared ownership index for tab maps, which bounds per-write selector work and guards repeated tab scans for sender labels, file links, draft owners, and image authority. The title is specific and concise, and it is 9 words and 60 characters.

Full details: Description check

Explanation

The description is thorough and follows the template closely. It has an ELI5-style opening, a detailed What Changed/Why section (shared per-tab-map index, image authority snapshot input, lexical-binding lint rule fixes), extensive testing evidence, and a LoC summary. It does not use the template's ELI5, Linked Issue, Visual Proof, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, or Checklist headings. The Linked Issue section is missing: the template says 'Fixes #' and an actual issue must be linked. The description references #32098 as prior work but does not link an issue this PR fixes. Visual Proof is absent, though the PR is a performance change with no visual change and should state N/A with reason. The Testing section is replaced by a Validation section and the manual-testing checkbox is absent. The Notes/Checklist items are not addressed explicitly, though cross-platform performance evidence is given (Linux, macOS, Windows performance contracts). The description also has a stated head-SHA mismatch versus the objectives (ea7f2f2 / 1d8e6e8 in the description vs 0344a4d in the objectives), which should be reconciled.

Resolution

  1. Add a Linked Issue: replace the 'Fixes #' placeholder with an actual issue number that this PR closes. Outside contributors need a real linked issue; 'Refs' is not sufficient.
  2. Add a Visual Proof section. This PR changes performance internals with no visible UI change, so write N/A and state the reason (behavior-preserving, verified by tests and performance contracts).
  3. Add or align the Testing section with the template: list the steps a reviewer can follow and the platforms actually tested locally (macOS, Linux, Windows, SSH). Tick the manual-testing checkbox only if manual testing was performed; the description states 'No app run is claimed', so the box should remain unchecked and the automated-test box should be checked with a link to the tests.
  4. Add an AI Disclosure section with the model and tool details, or leave it out only if the author is a stablyai team member.
  5. Add a Review section and the Agent skill upstream boundary check. State whether any upstream skill-installer source was copied.
  6. Add the ELI5 section in plain language before What Changed.
  7. Address the Notes items explicitly: security, cross-platform (Linux, Windows, macOS), Remote SSH, mobile, backwards compatibility, and performance. The description covers performance and compatibility, but security, SSH, and mobile are not stated.
  8. Reconcile the head commit references. The description cites head ea7f2f2 and final head 1d8e6e8, while the PR objectives cite 0344a4d. Confirm the correct current head and make the references consistent.
  9. Trim the Validation section into a concise test-evidence list and tick the Checklist items that apply, or note which are pending (for example, the final CI status).
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@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: 3


ℹ️ 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: bfb5c21b-3d54-4b5d-b61a-0ab0c8956116
📥 Commits

Reviewing files that changed from the base of the PR and between 0a8c768 and b71f20e.

📒 Files selected for processing: 12
  • .oxlintrc.json
  • config/oxlint-performance-audit.json
  • config/oxlint-plugins/app-store-performance.mjs
  • config/scripts/app-store-performance-plugin.test.mjs
  • src/renderer/src/components/native-chat/native-chat-agent-message-sender-label.ts
  • src/renderer/src/components/native-chat/native-chat-composer-draft-image-check.ts
  • src/renderer/src/components/native-chat/native-chat-file-link.ts
  • src/renderer/src/components/native-chat/native-chat-store-fanout.perf.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-attachments.test.tsx
  • src/renderer/src/lib/native-chat-draft-owner.ts
  • src/renderer/src/lib/structured-chat-tab-index.test.ts
  • src/renderer/src/lib/structured-chat-tab-index.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.

@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: a93c55e8-1729-446e-816a-b61944c63dec
📥 Commits

Reviewing files that changed from the base of the PR and between 6f5cdfc and e4056a4.

📒 Files selected for processing: 2
  • config/oxlint-plugins/app-store-performance.mjs
  • config/scripts/app-store-performance-plugin.test.mjs

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

With many chats mounted, each store write repeated ownership searches across workspace tabs. These queries now share a source-derived index, while sender names, file-link destinations and restored-image checks keep their existing results. Global store notifications still reach mounted subscribers.

The full review completed two rounds and a design-panel ruling. It removed both proposed semantic lint rules after valid cached selectors triggered blocking diagnostics. The four existing selector rules retain corrections that distinguish actual imported hooks and module functions from local shadows and parameter bindings. There is deliberately no new source-wide state-use or whole-map-scan diagnostic.

Verified:

  • Paired 10-chat/6-workspace/96-terminal and 100-chat/60-workspace/960-terminal corpora exercise three real hook families. Fifty unrelated writes require zero measured map enumerations, rerenders and indirect owner-resolver calls; replacing maps permits one shared enumeration per map and must update the moved chat correctly.
  • Five fresh regression controls fail their intended assertions: restoring sender, file-link, draft-owner or image-authority queries, and disabling shared index reuse. These are behavioral-bound failures, not import failures.
  • The broader ownership, host, restored-image, file-link and workspace-removal checks passed: 113 tests across ten named files. The final fixture-key change passed all 16 plugin/performance tests; its production and control sources are unchanged. Normal pre-commit and the merge-side check passed.
  • Final architecture comparison and readiness/performance review completed on the current head. Full exact-head PR Checks passed static analysis/typecheck, all five unit shards, relay integration, both package jobs and the aggregate gate. Performance contracts passed on Linux, macOS and Windows.

No unresolved proven findings remain. Limits retained: the contract mounts three hooks and one pending eligible image restore; enumeration counts do not measure arbitrary CPU, row visits or global notifications. New expensive work in an unexercised consumer can pass. Compatibility intentionally preserves terminal-before-structured ownership and existing duplicate-session ordering; this PR does not migrate ownership to chat entities.

For Brennan's review: Performance-only, with no visual change; the review skill uses the real-hook scale contract instead of an app run or screenshots. The useful judgment points are shared source-identity index, current-snapshot image authority, and the measured contract and real update.

@brennanb2025
brennanb2025 merged commit 6d473f4 into main Oct 23, 2026
36 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
nwparker added a commit that referenced this pull request Oct 24, 2026
* fix(git): preserve unmerged branches with no net file changes

* fix(workspace): show launch actions in empty tab groups (#32182)

* fix(workspace): show launch actions in empty tab groups

* fix(workspace): resolve empty-pane browser policy by owner

* Scope daemon inventories for safe worktree teardown (#32171)

* Fix scoped daemon inventories without changing terminal input routes

* Serialize daemon owner inventory refreshes safely

* Serialize daemon owner inventory refreshes safely

* test(daemon): protect baseline inventory budgets and recovery

* fix(daemon): clear route proof during synthetic exits (#32196)

* docs: condense test anti-pattern guidance (#32201)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* refactor: colocate repository draft input and tests (#32155)

* test: consolidate discovery coverage and replace copied oracles (#32211)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: retire copied oracles and implementation inventories (#32206)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: remove classification inventories and verify settled boundaries (#32216)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: keep explicit regressions without legacy algorithm copies (#32218)

* test: keep explicit regressions without legacy algorithm copies

* test: use Number.NaN in latency fixtures

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* ci: avoid slow Ubuntu mirrors during WebKit setup (#32205)

* ci: reuse bounded Ubuntu mirror setup for WebKit

* ci: preserve Ubuntu setup for dispatched older refs

* perf(renderer): scope runtime connection and parking subscriptions (#32199)

* fix(chat): allow visuals to declare open without breaking scripts (#32226)

* fix(native-chat): keep queued messages in the chat's own record, so a refused one can't be skipped (#30418)

* fix(native-chat): a refused queued message still blocks the queue when its card write fails

Every reader of a queued card goes through one derived view of the journal's dispatch facts,
so a card whose message was refused reads as returned even when its card-table update and heal
both failed. One decision and one writer store the derived state for every action.

* refactor(native-chat): keep each queued message in the chat's journal, not a second table

A queued message lived in its own SQL table, and a hook that may be skipped copied
each refusal from the journal into it. When that write failed, a refused card
vanished: the cards behind it sent, and its Send and Delete did nothing.

Each queued message is now a `queue` row in the chat's journal beside the
submission that hands it off and the dispatch row that answers it. The reducer
folds the card from those rows, so a refusal returns the card and holds the
cards behind it with nothing written, and replay reads the same. Every action
writes its own rows in one transaction. Cards an earlier build stored are read
through the same classification until they move: each action moves its own
card, and a bulk import runs once per open. A new epoch restates every card
still owed an answer in the transaction that deletes the old rows.

The settlement hook and its savepoint, the open-time heal, the drain's heal and
the derived-card view are gone. The published card list is unchanged.

* test(native-chat): adapt the queue tests to cards kept in the journal

Cards are written through the journal, so tests queue them with their body
alone and hand them off under their real fingerprint. Tests of the removed
settlement hook, heal and SQL store are deleted; the text-update spec now
covers the edit decision alone, and a test of an earlier build's stored holds
seeds the legacy table and reads the imported cards. Rolling over an epoch now
keeps a card whose hand-off was never handed over, so that test checks the
retried id never sends rather than that nothing sends.

* test(native-chat): a refused card holds the queue through rewind, a new epoch and a restart

One whole-flow test through the host: the refusal writes no card row, a rewind
that retires the refused hand-off and a rolled-over epoch keep the card
returned, a restart and Resume send nothing behind it, its own Send refused
again still holds the queue, and its Delete releases the next card in order.

* test(native-chat): an earlier build's queued cards move into the journal once, each read the same

One mixed-import test through the host. The first open's import fails and
moves nothing, yet every card reads as it will; Delete and Send each move only
their own card. The next open moves the rest in one transaction, writing a
refusal only where its hand-off is gone, nothing for answered cards, and leaving
an unreadable row on disk. A later command turn spends a moved command card, a
third open writes nothing, an old Delete replays from its receipt, and a chat
with only answered legacy rows clears them in a delete-only transaction.

* test(native-chat): adapt typechecked tests to cards kept in the journal

The row-kind table lists a queue row, the clear and legacy-import tests
match the current signatures, and the downgrade test keeps only the
leftover-send case: a queued card is now a newer-version journal row an
older build keeps read-only, and users don't downgrade.

* refactor(native-chat): drop the journal row writer's unused transaction hook

No caller passes one since the queue's savepoint bookkeeping left.

* test(native-chat): downgrade probes write rows at the version older builds read

The highest version this build reads is now 4, the queue row's. A newer
build's row in these probes is written at version 3 so the older build
meets its kind, not a newer version, and the Stop-event probe hands the
older build the rows as stored, since a read raises each row's version.

* test(native-chat): unit tests follow the queue row's version 4

The legacy-import test opens real SQLite, so it runs in the Node runtime
project. The newest version this build reads is now 4, and a read raises a
row's version to it, so the turn-lifecycle test no longer pins the
in-memory version (the written one stays pinned by journalRowSchemaVersion).

* fix(native-chat): one batch echoing two refused queued messages spends both

The per-row delivery check returned only the first waiting card an echo
proved delivered, so when one settlement carried echoes for two cards the
second stayed waiting and was sent again. It now returns every card the
row proves delivered, and the fold withdraws each; replay folds the same.

* fix(native-chat): a rewind moves an earlier build's cards into the journal first

While the open's import had failed, an earlier build's card that read as
refused through its hand-off lost that reading when an in-place rewind
retired the hand-off: it disappeared and the card behind it sent. The
rewind now adopts every legacy card ahead of its tombstones and deletes
their rows in its own transaction, as an epoch replacement already does,
so the fold latches each card's reading before its hand-off is gone.

* fix(native-chat): keep an earlier build's card whose hand-off is still unconfirmed

The import dropped a legacy card handed off as a send whose delivery was
unknown, though the fold keeps such a card linked and a later refusal
returns it. The import now keeps every card whose hand-off a later row can
still answer, through the same check the reducer folds dispatch rows by.

* fix(native-chat): one delivery echo withdraws at most one queued card

One provider echo proves one delivery, yet it withdrew every waiting card
with the same text whose hand-off was refused, so a second identical card
was lost. The fold now pairs each echo with one card: on its own row the
earliest-positioned match no other echo of that row took, and for a card
that waits again the earliest applied echo no card has taken. Paired echoes
live in the fold's state, so live and replay pair the same; readers of
cards not yet imported work on a copy.

* fix(native-chat): a queued message handed to the agent is sent again only on proof it never got it

Pressing Stop after Orca handed a queued or steered message to the agent,
before the agent confirmed it, put the card back in the queue, and Resume
or the next send sent it again. A check matching the agent's echo of the
text was the only guard against a double send, and it kept trading a
resend for a lost card. Whether the card waited again was decided by the
rejection's category, not by proof the agent never got the message.

A refused hand-off now waits again only where Orca proves the agent never
received it: the host still held it, or whoever settled it recorded that.
A failure still returns the card and holds the cards behind it. Anything
else may have reached the agent, so the card is spent and its message
reads as sent, derived on every fold from the stored rejection: with the
turn it was answered into, as that turn's unconfirmed message where it was
handed over; withdrawn before any turn opened, as a person's own send a
Stop took back. The reopen mark ignores a recovered doubt, and the restart
reconciler no longer judges a queued hand-off unsent from what history
lacks. The echo text matching and its pairing are deleted.

A close or quit while the agent starts settles sends with the unrun hold.
The host hands nothing to a child before its start answers
(structured-agent-session-delivery-loop.ts: a handover needs phase
ready), so such a send went to an earlier child and may have run: it now
reads as sent instead of waiting again.

* fix(native-chat): Claude's report that it removed a queued message unrun lets the card wait again

Claude says when it removed a send without running it: the interrupt
receipt's cancelled list, or a command_lifecycle cancelled, discarded or
refused frame for a command that never started. Every one settles through
rejectClaudeDispatchWaiters, which now marks the settlement unrun. For a
queued card's hand-off the host records that as proof the agent never got
it, so the card waits again under the queue's pause. A direct send keeps
the plain refusal: there the proof would owe it as stopped history.

* fix(native-chat): an earlier build's card stopped after hand-over follows the same rule on upgrade

Earlier builds put a card back to waiting after any refusal without a
verdict and cleared its link, so a card the agent may already have would
be sent again after the upgrade. The card's own hand-offs in the journal
decide now: unchanged and last sent as one that may have reached the
agent, it is spent on that hand-off and its message reads as sent; edited
or sent again since, it is held for its own Send under a host-only marker
that publishes as a plain hold; with no hand-off in doubt, including one
that never left Orca, it waits as before. The import writes a card spent
on a hand-off in doubt, so its message shows.

* fix(native-chat): read a queued row's hand-off before the lookup that uses it

The lookup's callback lost the narrowing of the row's change, which the
mobile test typecheck rejects.

* test(native-chat): a card steered into a turn a Stop ends stays sent in the Stop tests

Three tests pinned the old rule, that a card handed into a running turn
comes back to waiting when a Stop ends it. Under the new rule nothing
proves the agent never got it, so the card is spent: with the turn named,
its message reads as that turn's unconfirmed one; without, as a send the
Stop took back. Neither is ever sent again.

* fix(native-chat): a queued message stopped before Orca handed it to the agent waits again

A Stop that aborts a hand-off after its row is written but before the agent call now records
the withdrawal as never reaching the agent, for queued hand-offs only, so plan D's rule returns
the card to waiting under the Stop's pause instead of spending it. Direct sends keep the plain
withdrawal (the flag would owe them as stopped history). The agent's own refusal while aborted
is kept rather than overwritten, and an abort thrown during the call stays in doubt.

* fix(native-chat): a queued message stopped while the agent prepares it waits again

The abort signal reaches only an adapter's preparation (its options, the previous turn opening),
never its write, so the signal's own reason thrown back is the adapter saying nothing was
written. The handover now reads that, for queued hand-offs only, as never reaching the agent,
so the card waits again under the Stop's pause. Claude no longer wraps that abort as an option
refusal, which had returned a stopped card as a refused one blocking the queue. A real refusal
keeps its cause and its barrier; any other throw stays in doubt and is never resent.

* test(native-chat): the usage-limit Continue backlog case writes its card through the journal queue

Main's #30396 wrote its backlog card with the stored fingerprint and host-instance stamp the
journal queue derives instead; the card the Continue must yield to is the same waiting card.

* test(claude): the real-CLI queued Stop expects the unrun mark Claude's cancelled-unrun receipt carries

* fix(native-chat): retain spent legacy messages when import fails

* Bound per-write chat selector work and guard ownership scans (#32109)

* Guard per-write chat selector work with shared ownership indexes

* Use checked sender session identities in the scale fixture

* Read each indexed tab row once during snapshot rebuilds

* Fix lexical binding and cache matching in selector lint rules

* Keep behavioral selector guards and resolve imported bindings

* Require selector binding definitions to declare functions

* Key performance subscribers by saved chat scope

* Show activity status with worktree-style counts (#26443)

* Show prioritized agent counts on the activity bell

* Move activity badge into the corner and shrink its count

* Use a fixed side column for activity status and counts

* Fix activity count spacing and status alignment

* Use worktree-style superscript counts for activity

* Keep activity count positions and update only number styling

* Keep idle layout fixtures out of active agent status updates

* Show child workspace statuses in the children toggle (#32224)

* Show child workspace status counts in lineage toggle

* Give child status summaries room and wrap narrow layouts

* Use solid working dots and keep child summaries on one line

* Restore children icon and clarify worktree tooltip

* Keep child totals clear of status counts in narrow layouts

* fix: preserve workspace review references when clearing active reviews (#32263)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* Saving a file, then closing that tab mid-save, no longer leaves its other tabs looking clean (STA-11786) (#32259)

* fix(editor): settle a save's shared record when the saving tab closed mid-write

With one file open in two workspaces, closing the saving tab while its write was in
flight left the other tab's disk baseline, dirty flag, draft and loaded text on the
pre-save version: every completion step looked the closed tab up by id and found
nothing, and the saved event listed only the closed tab as the record's views. An undo
back to the old text then read as clean and closed without asking.

The write now captures its record id with no await before the write, and completion
(rebaseline, dirty/draft settle, conflict clear or refusal banner, saved event's view
list) goes through a live view of that record, preferring a writable one. The save
runner and the write-lock wait do the same, so a save queued by a tab that closes
still writes through the record's remaining view. The chat visual's saved-event
listener also falls back to the record's views.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): follow a closed saver's record through re-keys, kept records and listeners

Review follow-ups to the closed-saving-tab fix:

- Completion now finds the record through the view ids captured before the write,
  not the record id: a re-key mid-write (an unpinned runtime tab resolving its
  pairing) keeps views but changes the id, which brought the original bug back.
- A fallback writer (asking view closed while queued or waiting on the file lock) is
  chosen like autosave/restart's writer: writable and on a current connection, so a
  stale-connection sibling no longer throws when a current view exists.
- With no view of the record left, a kept record (no-prompt removal) is dropped when
  the write saved its text, else rebaselined; other open views of the file (a
  detached peer) take the written baseline, keeping their edits.
- A save may mark a record clean through a read-only or CSV-preview view (markFileDirty
  `written`); such views still never become dirty.
- Markdown preview refresh and the CSV pending-cell listener match the saved event's
  record views, not only the saving view's id.

Co-Authored-By: Claude <noreply@anthropic.com>

* test(editor): name the closed-view save harness as a test fixture

The focus-read ratchet scans non-test sources; the `.test-fixture.ts` suffix marks this
harness as test-only like the repo's other fixtures.

Co-Authored-By: Claude <noreply@anthropic.com>

* test(ci): list the closed-view save rig as a unit support bridge

The rig builds on the autosave test fixture, which takes the editor slice harness, so
the routing check saw it as a product consumer of that harness. Bridges are an explicit
list, like the browser drawn-from-main fixture.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Show task names for Codex subagents (#32243)

* fix: name Codex subagents from rollout metadata

* Hide generic default role in child agent rows

* Reject non-regular Codex identity transcripts without blocking

* [comment audit] Shorten preload comments (#32257)

* chore: audit preload root comments and track repository coverage

* docs: track repository comment audit coverage

* chore: keep comment audit tracker local

* chore: shorten preload API contract comments

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix: offload macOS deletion spawns and reduce branch cleanup (#32227)

* fix: reduce worktree deletion branch cleanup overhead

Refresh only the remote base branches needed to prove a branch merged, with automatic maintenance disabled. Skip merge simulation when no common ancestor is available and preserve the branch when its remote base cannot be refreshed.

* fix: preserve fetch mappings and live branch cleanup fallbacks

* fix: spawn macOS worktree deletion commands off the main thread

* test: remove redundant cases and start comprehensive value tracker (#32269)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(web): the browser client advertises the desktop's chat capabilities, so its host opens chats (#32253)

* fix(web): the browser client advertises the desktop's chat capabilities, so its host opens chats

The browser client's handshake never named agent-session.structured.v1, so a paired
host refused every agentSession call with structured_agent_session_unsupported and
withheld chat tabs. The desktop window, the Electron remote handshake and the browser
client now build their lists from one shared array of what the renderer's chat implements.

Fixes #32145

* refactor(web): keep the browser client's capability list beside the desktop's in shared

The host-side test parses both handshakes with the host's own parser, which the node
typecheck project can only import from src/shared.

* test(web): assert close-intent support in the auth frame, not the whole capability list

* fix(terminal): a timed-out CLI split names its pending pane, and a retry can never re-run its command (#32278)

* fix(terminal): a timed-out CLI split names its pending pane and can be retried without splitting again

Fixes #32169

* fix(terminal): a blank retry id or a closed pane never re-runs a split's command

* refactor(terminal): a split retry only waits for its pane and never asks the window again

* fix(terminal): a split missing from the graph is reported pending, never closed

* fix(ssh): never block or over-read on an SSH identity file (#32274)

Every place Orca reads an SSH key or identity file now goes through one
reader that refuses directories, FIFOs and devices (including through
symlinks) with a nonblocking open, and caps the read at 1 MB. An auth
failure now names any identity file that was skipped and why.

Fixes #31965. Reported by @Huge, who also proposed the first fix in #31966.

Co-authored-by: Martin Vlach <mr.huge@seznam.cz>

* test: finish fixture work before unit-test cleanup (#32285)

* fix(mobile): keep a terminal tab's chat identity while its handle is unchanged (#32251)

* fix(mobile): keep a terminal tab's chat identity while its handle is unchanged

A status frame that omits agentType or providerSession flipped chat back to the
terminal for tabs with no launchAgent (#31977), and left a launched tab with no
session to read (#32134). Mobile now remembers the last resolved agent and
session per tab and handle, so a missing field is treated as missing evidence.

* fix(mobile): keep remembered chat read-only and drop it on relaunch

A chat resolved only from this phone's memory may sit on a bare shell, so its
writes stay locked until live status confirms the agent. A live agent frame
without a session no longer inherits the previous conversation, and the
latest remembered agent outranks an older launch hint.

* fix(mobile): gate native-chat image sends on a confirmed live agent

An image send from a chat only this phone remembers could paste into a bare
shell; it now shares the confirmed-agent gate with text sends.

* fix(mobile): type remembered chat identity structurally

Importing MobileSessionTab into the eligibility module pulled React Native
globals into the e2e program through nested-agent-idle-session-owner.spec.ts,
retyping setTimeout as number there.

* fix(terminal): never present a half-built synchronized-output frame on reveal or recovery (#32281)

Settled reveal and every other atlas recovery forced the current xterm buffer
onto the screen even while a TUI held DEC 2026 synchronized output. Codex
erases rows inside each held redraw, so a reveal mid-redraw showed a blank
pane for a frame (#32198).

Viewport presents now have one mode: they keep the last coherent canvas and
let xterm present when the TUI closes the frame, bounded by xterm's 1s
synchronized-output safety timeout. Structural replay keeps its retained frame
up until an open synchronized frame closes, bounded by its existing hold cap.

Co-authored-by: YEONGUK LEE <contact@abruption.dev>

* refactor(renderer): colocate task page pagination rules (#32297)

* perf(test): bundle Zod once per isolated Vitest invocation (#32298)

* Use incremental tsrs locally and update Bun to 1.4.4 (#32276)

* Use incremental tsrs for local typechecks

* Update pinned Bun to 1.4.4

* fix(deps): bump dompurify to 3.4.17 and docs next to 16.4.1 for security advisories

dompurify 3.4.17 patches GHSA-cg2g-xh64-v4q7, GHSA-mrv2-3pqr-j5jr and
GHSA-c6gr-qvv4-5v3f in the root and mobile lockfiles. next 16.4.1 patches
GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr and GHSA-p3m5-59mp-jv5r in the
docs site.

* Prepare mobile bundle for smoke benchmarks

* Give native compiler benchmarks a larger ARM runner

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* test: trim redundant coverage and fix vacuous assertions (#32305)

* test: remove redundant cases and repair behavioral assertions

* docs: reconcile audit records with current main

* fix(deps): apply security updates from #32101

Apply the six-file DOMPurify 3.4.17 and Next.js 16.4.1 patch from PR #32101 to resolve the dependency security gate for this test audit. Original patch by Brennan Benson.

* test: satisfy changed-line quality gates

Add required braces and replace filter indexing with find. Rerun both CI quality gates and the 27 affected relay tests; refresh audit hashes and record the corrections.

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* fix(ci): retain ambiguous unit-test import consumers (#32366)

* test: exercise real boundaries and trim redundant cases (#32353)

* test: replace redundant checks with observed behavior

* docs: reconcile completed audit batches and upstream review

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(git): retain zero-net history with current merge-base guards

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: OrcaWin <alpha-eng@stably.ai>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Martin Vlach <mr.huge@seznam.cz>
Co-authored-by: YEONGUK LEE <contact@abruption.dev>
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