Repository navigation
Conversation
OrcaWin
pushed a commit
that referenced
this pull request
Jul 28, 2026
…persist a watermark past them (stablyai#10816) * fix(mobile): keep the reconnect watermark alive across the app's own teardown The catch-up added in stablyai#8690 could never run. app/index.tsx unsubscribes the notification stream on every non-'connected' state and builds a fresh subscription on reconnect, so the closure holding the ready-counter, the delivered watermark and the seen-set is destroyed exactly when a reconnect needs them. Every reconnect looked like a cold open, `reconnectReadyCount` was always 1, and notifications dispatched while the socket was down were never fetched. Move that state to a per-host module-scope session so it survives the teardown. Refs stablyai#8591 Co-authored-by: Orca <help@stably.ai> * fix(mobile): tag the notification watermark with a counter epoch so a desktop restart can't kill catch-up The desktop's notification `seq` is a per-process in-memory counter that starts at 0 on every launch. The mobile client's watermark is persisted in AsyncStorage and monotonic. After a desktop restart the two index different counters, so a client holding seq 57 meets a fresh counter at 2, `57 >= 2` cuts everything, and reconnect catch-up dies silently until the new process out-dispatches the old watermark — 57 notifications later. Users see nothing and get no error (stablyai#8591). Stamp every dispatched notification with an epoch identifying the counter lifetime, ride it on the `ready` frame and the getMissedSince response, and persist it beside the watermark. A watermark whose epoch doesn't match the live counter is void: the client resets to 0 and the desktop returns its retained buffer instead of nothing. The epoch param is optional on the wire in both directions, so a client or daemon that predates it degrades to today's seq-only cut rather than erroring. Also extracts the OS-permission helpers to notification-permissions.ts (re- exported, so no importer changes) to keep mobile-notifications.ts under its max-lines budget. Mutation-tested: 3 mutations applied to the epoch logic, 3 killed — including the storage-seed race guard, whose first mutant survived until the deferred-read test was added. * fix(mobile): make the notification watermark atomic and counter-scoped Round-1 review found four ways the epoch fix could still lose notifications. All four are addressed here. 1. Seen-set survived an epoch change. Seen-keys are seq-derived, and terminal bells carry no notificationId (they key on `seq:N` alone). After a restart the fresh counter re-issues low seqs, so a replayed post-restart bell was dropped as a duplicate of a bell from the previous counter. The dedup window belongs to one counter lifetime, so it is cleared on epoch change. 2. Legacy watermarks were trusted. Pre-upgrade installs stored a bare seq with no epoch. Adopting the first observed epoch as "nothing changed" left that unprovenanced seq cutting a counter it was never measured against — stablyai#8591 through the upgrade path. An epoch-less seq no longer survives adoption. 3. seq and epoch were separate storage keys. A process death between the two writes left epoch-B beside seq-57-from-A: a pair that looks internally valid on the next launch and is therefore trusted. They are now one JSON value, which cannot tear, with a read-only migration from the legacy key. 4. Sessions were never retired. They live at module scope so they survive the subscription teardown a reconnect performs, so host removal is the only thing that can drop them. Removal now retires the session and its watermark. Mutation-tested: 3 mutations, 3 killed. The first version of the bell test passed with the fix removed — it exercised the live path, which only adds to the seen-set; only the replay path consults it. Rewritten against the replay path, it fails with `expected 1 to be 2`: the literal lost notification. Mobile notifications + transport: 355 passed. Desktop replay: 11/11. * fix(mobile): catch up on the first connection after a cold open Catch-up hung off 'has this process connected before', which is false on the first ready of a fresh launch — exactly the post-upgrade / post-eviction case that loses everything between the stored watermark and the next live seq. Wait for the persisted read, then catch up whenever this device has delivered for the host before; a first-ever pairing still gets no replay. Co-authored-by: Orca <help@stably.ai> * fix(mobile): serialize live delivery behind the watermark seed, and key catch-up on the record Co-authored-by: Orca <help@stably.ai> * test(mobile): pin the two catch-up mechanisms mutation testing found unguarded Mutating each mechanism of the stablyai#8591 fix in turn showed two survived with the suite still green: the seed's epoch-provenance check, and the host session outliving the subscription teardown. Both are load-bearing, so pin them. - seen-set survives teardown: the desktop's retained buffer replays a notification already delivered live, and only the session-scoped seen-set stops a duplicate banner. - a seed resolving after a live epoch was adopted must not reinstate the dead watermark. Not reachable through subscribeToDesktopNotifications today ('ready' awaits the seed first), so it asserts on the exported pair and says so. Co-authored-by: Orca <help@stably.ai> * fix(mobile): serialize notification delivery per host so the watermark can't outrun what was shown Addresses two MAJOR findings from review of this branch. MAJOR #1 — the watermark could be persisted past a notification the user never saw. `deliverLive` advanced `lastDeliveredSeq` before awaiting the local show, and replay + live delivery ran concurrently, so a live seq 11 handled while catch-up was still showing seq 6 persisted 11. A process death before 7..10 were shown lost them permanently: the next launch asks the desktop for seq > 11. This predates the branch — `origin/main` advances the watermark at the same point — so it is a residual this fix closes, not a regression the branch introduced. It is fixed here because the branch is what makes the watermark load-bearing. Three changes: - the advance moves AFTER the show/dismiss await, so the watermark means "everything up to here reached the user" rather than "was dispatched" - a per-host `deliveryTail` promise chain (`enqueueHostDelivery`) serializes deliveries, so a monotonic advance is also an in-order one - the catch-up batch is ONE queue entry, not one per event. Awaiting per event returns to the event loop between replays and let a live event slot in between seq 6 and 7 — which is exactly the interleave being fixed. The RPC stays outside the queue: `sendRequest` waits up to 30s and holding the chain for that would stall live delivery on a slow link. MAJOR #2 — every delivery awaits the persisted read, so an AsyncStorage read that never settled disabled the host's notifications for the whole app lifetime, with no error and nothing to see. The seed is now bounded at 3s; a late seed still applies when it lands. Proceeding unseeded is strictly better: the watermark stays 0, so catch-up over-fetches and the seen-set de-duplicates. Serializing removed an overlap the duplicate-suppression relied on: `showLocalNotification` deduped two same-id events by observing the first still pending when the second arrived. With deliveries serialized the first completes first, so the second saw no pending state and scheduled a second banner for the same notification. The claim moves to enqueue time, where the overlap is still observable. Dismisses are deliberately not claimed — a dismiss for a shown id is what retires it. Evidence — each mechanism disabled individually against the unchanged suite: - batch-as-one-entry -> reverted to per-item enqueue: ordering test fails - watermark advance -> moved back before the await: ordering test fails - seed timeout -> removed: wedged-read test fails - live-path claim -> removed: concurrent-dedup test fails - replay-path claim -> removed: cross-path dedup test fails Each kills exactly one test, so no mechanism is unguarded and none is redundant. `mobile-notifications.test.ts`'s local `flushAsync` drained 10 microtask ticks. Deliveries are now several awaits deeper, so a fixed tick count under-drains; it yields to the macrotask queue instead. Verified with real timers that the behavior it asserts is unchanged — only the drain depth was wrong. Full mobile suite: 344 files, 2499 passed, 2 skipped. tsc clean, oxlint clean. --------- Co-authored-by: Orca <help@stably.ai>
OrcaWin
pushed a commit
that referenced
this pull request
Jul 29, 2026
…(C1) (stablyai#10625) * fix(terminal): park SSH worktrees like local ones (C1 retention, slice A) SSH ptys were blanket-excluded from hidden-view parking, so a hidden SSH worktree retained every pane forever (C1: renderer heap climbs to the V8 ceiling). SSH bytes transit local main — fact-mode watchers already cover them, and main keeps a headless model served over pty:getMainBufferSnapshot that the SSH reattach path never consulted. - isParkRestorableTerminalPty: snapshot-backed OR (SSH + policy); threaded through both park verdicts, both selectors, watcher coverage, and the watcher start guard. Remote-runtime/fail-open/foreign/null unchanged. - Parked-SSH reveal paints from main's headless model (dimension-matched, ~5k rows) and degrades to the relay 100KiB replay unless the snapshot is a non-empty source==='headless' payload — never a blank/stale paint. - Kill switch: settings.terminalSshViewParking (default on). DESIGN.md records the approved plan and the H1 magnitude non-claim. Co-authored-by: Orca <help@stably.ai> * fix(terminal): bound hidden-worktree retention with a force-park budget (C1, slice B) Un-parkable worktrees (remote-runtime ptys, uncoverable tabs, SSH with the slice-A switch off) had unlimited retention: the parking cap/TTL only ever saw eligibility-passing worktrees, so one bad tab pinned a whole worktree's panes forever. Retention is now memory-bounded, not eligibility-bounded. - terminal-hidden-worktree-retention.ts: retention budget (12 hidden / 45min TTL, sized from the measured 2.5-19MB per-pane V8 cost, DESIGN.md §2) over hidden worktrees ordinary parking can never evict; reuses the hot-retain ranking so last-active exemption, deterministic ties, and deadline-driven rechecks hold. Fail-open/foreign-pty tabs are eviction-exempt (a remount would fresh-spawn and orphan the live shell). - Terminal.tsx: force-parked ids join the parked set AFTER the coverage veto (darkness for uncoverable tabs is the accepted cost); buffers captured via the sleep-flow registry before the unmount render; retention TTL added to the recheck deadlines for budget candidates only. - Verdict stays out of its own effect deps; policy test asserts idempotence and time-monotone membership (flip-loop dwell regression). - Kill switch: settings.terminalHiddenWorktreeRetentionBudget (default on). Co-authored-by: Orca <help@stably.ai> * fix(terminal): demote hidden scrollback for eviction-exempt worktrees (C1, slice C) The retention budget (slice B) must exempt worktrees holding fail-open or foreign-worktree ptys — a remount would fresh-spawn and orphan the live shell — which would leave that class unbounded again. Instead, past the same 45min retention TTL their hidden panes drop to the minimum scrollback tier (measured: ~19MB -> ~1.3MB V8 heap per 50k-row pane; trimmed history is gone by design, reveal restores the configured cap for future output). - terminal-hidden-scrollback-demotion.ts: module-state verdict registry (parked-watcher pattern) with content-equality notify damping; applied in the existing scrollback-rows effect in use-terminal-pane-lifecycle. - selectScrollbackDemotedTerminalWorktrees: pure, TTL-gated, time-monotone. - Retention TTL wakeups now also cover exempt worktrees so demotion fires. - Kill switch: settings.terminalHiddenScrollbackDemotion (default on). Co-authored-by: Orca <help@stably.ai> * fix(terminal): paint the SSH model snapshot inline, not via nested coordinator (C1 slice A fix) applyMainBufferSnapshot runs its own structuralReplayCoordinator.run; calling it from applyReattachPayload (already inside the coordinator when a relay replay exists) deadlocks on the coordinator's tail chain. The model paint now mirrors the daemon-snapshot branch inline (folded scrollback + rehydrate + screen, dimension-matched, escape tail last) and arms the restored-snapshot seq baseline so deferred/live chunks the snapshot covers dedupe instead of double-painting. Also falls through (no early return) so reattachPayloadApplied still latches. Adds the folder-workspace id parity unit case. Co-authored-by: Orca <help@stably.ai> * test(terminal): SSH park+reveal e2e round-trip + as-built design notes (C1) Docker-gated (ORCA_E2E_SSH_DOCKER=1) spec: SSH tab parks behind a decoy and reveal restores marker content at multi-viewport scrollback depth. DESIGN.md records the as-built deltas (inline paint, force-park shape, last-active floor) and the residuals so follow-ups aren't lost. Co-authored-by: Orca <help@stably.ai> * fix(terminal): paint SSH reveal from main's model even when the relay replay is empty (C1 review #1) A relay restart empties the replay buffer; the reveal previously painted nothing even when main's headless model held the session. The reattach now prefetches the model snapshot when no structural replay exists (SSH-shaped ptys only) and paints it inside the coordinator; emptiness is judged on the composed payload (scrollbackAnsi + data + pendingEscapeTailAnsi) so an alt-screen snapshot with an empty screen frame still paints. Co-authored-by: Orca <help@stably.ai> * fix(terminal): decouple scrollback demotion (slice C) from the retention-budget switch (C1 review #2) Per the approved contract each slice reverts behind its own switch: slice C now requires only the master terminalHiddenViewParking plus its own terminalHiddenScrollbackDemotion flag. The TTL wakeup timer fires for demotion candidates even with the budget switch off. No DEFAULT_SETTINGS entries exist for sibling flags (defaults are the '!== false' optional pattern), so no explicit defaults are added. Co-authored-by: Orca <help@stably.ai> * fix(terminal): scope eviction exemption to the tab, not the worktree (C1 review #3) One eviction-exempt tab (fail-open/foreign pty) previously vetoed force-park for its whole worktree, pinning co-located remote-runtime tabs forever. The worktree now force-parks while exempt tabs keep their mounted panes via a per-tab exclusion mirroring the Activity-portal pattern (legacy watcher sync, legacy render, and the overlay cold-parking hook). Ordinary parking is untouched — a worktree with an exempt tab still cannot ordinary-park. Slice C now also demotes exempt tabs' panes as soon as their worktree force-parks under the count budget (they are the only panes left mounted). Co-authored-by: Orca <help@stably.ai> * fix(terminal): demote un-parkable worktrees the force-park lever spared (C1 review #4) The last-active exemption means a single hidden un-parkable worktree never force-parks — and slice C previously only targeted exempt-tab worktrees, so its panes held full scrollback forever. Demotion now also covers un-parkable non-exempt worktrees past the retention TTL that are absent from the force-parked set (last-active spared, or slice B switched off). Membership stays time-monotone for fixed inputs; covered by new idempotence/monotone selector tests. Co-authored-by: Orca <help@stably.ai> * fix(terminal): keep the hidden clock running through transient background-measure windows (C1 review #5) Whole-worktree background mounts (browser-automation bootstrap lease, mobile mounts, agent wakes) open a ~3s self-clearing measure window that previously deleted hiddenSince — every remount restarted the 30s hysteresis and the 45min retention TTL, so a periodically re-mounted force-parked worktree never re-parked. The measure window still pauses parking/eviction verdicts (all selectors skip measuring candidates); only the clock survives, so the prior verdict resumes as soon as the window closes. Visible and portal-holding worktrees still reset the clock. Co-authored-by: Orca <help@stably.ai> * test(terminal): make the SSH park+reveal depth assertion prove the model paint (C1 review #6a) Pad the session with ~180KB of output after the numbered markers so the earliest marker falls outside the relay's 100KiB rolling replay buffer while staying inside main's ~5k-row headless model; asserting marker_1 after reveal now proves the headless-model paint rather than passing under the relay fallback. Co-authored-by: Orca <help@stably.ai> * docs(terminal): rewrite DESIGN.md as the single as-built C1 contract (review #7) One contract matching the code: status IMPLEMENTED around force-park (not the unmount proposal), real kill-switch names with coupling + revert matrices, the true retention-floor formula with measured per-pane and demotion numbers, an explicit when-OOM-is-still-possible paragraph naming the H2 pendingSideEffects residual, the applyMainBufferSnapshot deadlock constraint inside the slice-A section, stable-signal phrasing instead of a capability latch, fail-open AND foreign-worktree exemption class, verified cites, and a planned/landed/follow-up test matrix. Co-authored-by: Orca <help@stably.ai> * fix(terminal): resolve the eviction exemption per pane, not per tab (C1 review #8) isEvictionExemptTerminalTab read only tab.ptyId — the FIRST leaf's pty — while the coverage veto that makes a worktree a retention candidate walks every pane. A split tab whose second leaf held an unrestorable pty therefore failed coverage (→ force-park target) yet looked exempt-free, so force-park unmounted it and orphaned the live shell. The exemption now resolves panes through the same resolveParkedTerminalPaneCandidates, keeping tab.ptyId in the union for the no-layout/no-capture case. Also from the same review round: - force-park's capture passes includeLocalBuffers:false like every other shutdownBufferCaptures caller; it was serializing up to 512KB/pane of scrollback into the store inside a fix meant to bound renderer heap. - Terminal.tsx unmount resets the scrollback-demotion registry — module state with no reset path, read by a pane effect that runs before the host effect that would clear it, so a stale verdict trimmed restore replays. - memoize watcher coverage per tab within the parking pass; the retention candidates re-asked it for every mounted worktree, not just the parked few. * docs(terminal): drop DESIGN.md — the as-built C1 contract moves to the PR body Co-authored-by: Orca <help@stably.ai> * fix(terminal): cap the deferred PTY side-effect queue (C1 residual H2) pendingSideEffects grew without bound under background timer throttling (~64 drained/s vs hundreds queued/s overnight). Cap at 512 entries with oldest-first eviction: titles drop (last-wins), a pending bell latches onto the next survivor, agent-status payloads collapse onto the survivor keeping the newest 16 (last-wins store state, KB-scale strings). Co-authored-by: Orca <help@stably.ai> * fix(terminal): carry command-lifecycle facts through parked watchers (C1 follow-up) Parked fact-mode watchers omitted onCommandFinished/onCommandCode*, so OSC 133;D and Command Code scrape signals went dark while parked. New parked-terminal-command-status.ts ports the store-level subset: git-UI nudge on every command finish, same-turn status-row drop for SSH PTYs (exact mounted-path parity — the foreground tracker refuses SSH ids), and the Command Code working seed / 1500ms done settle. Byte mode scans the same shared parsers for authority-off parity. Local-PTY status drops stay with the mounted pane: they need pty-connection's process-confirm ladder to tell a leaked nested-shell 133;D from a real agent exit. Co-authored-by: Orca <help@stably.ai> * test(terminal): retention-budget force-park e2e with a retentionLimit override (C1 6b) ORCA_E2E_TERMINAL_RETENTION_LIMIT flows preload → e2e-config → getTerminalParkingPolicyOverrides (exposeStore-gated, positive-integer only) so a spec can shrink the force-park budget to 1. The Docker-gated spec opens two remote worktrees on one relay target (second pre-seeded remote repo), disables terminalSshViewParking to make both un-parkable, hides both behind the local context, and proves the older one force-parks while the last-active exemption spares the newest; re-activating the evicted worktree restores the marker tail via relay replay. Co-authored-by: Orca <help@stably.ai> * test(terminal): retention-budget e2e via same-repo remote worktrees (passes docker lane) The first draft added a second remote repo mid-session, whose pane pty spawn misroutes to the local daemon with the remote cwd (pre-existing multi-repo issue, reproducible without any retention override — a seeded local repo plus one remote repo shows the same misroute). The spec now budgets across three worktrees of the ONE connected repo, created through the product createWorktree path (an external git-worktree-add only lands as a detected worktree needing adoption) and polled through the relay's transient post-connect reconnect window. Verified green on the local Docker lane in 20.8s. Co-authored-by: Orca <help@stably.ai> * fix(terminal): prevent remount thrashing during post-measure cool-down ( Implements the C1 retention contract: preserve worktree `hiddenSinceMs` through a background-measure window (so TTL/ranking stay honest), but re-park waits for a full `coldParkDelayMs` cool-down after the measure ends. Without the cool-down, every ~3s measure lease on a past-deadline worktree thrashes remount/reattach. Core changes: - Terminal.tsx: add measure clock (measuringTerminalWorktreeIdsRef) and post-measure cool-down tracking (terminalWorktreeParkCooldownUntilRef); gate parking candidates until cool-down expires. - Extract snapshot replay choreography to shared terminal-snapshot-replay-paint.ts (used by SSH reattach + daemon restore paths). - Add SSH model snapshot timeout (750ms) with fallback to relay replay. - Move cold-park recheck deadline logic to terminal-cold-park-recheck-deadlines.ts; add cool-down deadline to scheduling. - useTerminalTabColdParking: implement matching measure-clock contract with per-tab cool-down gate to keep tab deadlines synced with worktree retention clock. - Add resolveTerminalMountScrollbackRows() to demote new xterms under demoted worktrees (pane births during demotion must take the demoted tier at create). - Add kill switches: terminalSshViewParking, terminalHiddenWorktreeRetentionBudget, terminalHiddenScrollbackDemotion. * fix(terminal): detect Command Code completion in parked mid-turn panes Seed the byte watcher with in-flight turn state from agent status: the watcher is recreated per park cycle with no startup command to arm it, and the banner scrolled away before parking. Also memoize eviction-exempt checks and use SSH PTY ID builder in tests. * fix(terminal): flush pending command-code settles on reveal remount When a parked pane reveals mid-Command Code turn, the new detector cannot re-observe the already-passed idle composer. Cancelling the settle leaves the row stranded at 'working', so dispose now flushes the pending settle instead. Extract readInFlightCommandCodeTurn to shared space and seed detectors with in-flight turns so remounts complete mid-flight commands. Also memoize SSH model probes to prevent double timeouts on reattach. * fix(terminal): remove scrollback demotion (C1 slice C) The scrollback demotion feature for eviction-exempt hidden worktrees is no longer needed. Retention budget limits are now sufficient without this additional bound. Remove the terminal-hidden-scrollback-demotion module, the selectScrollbackDemotedTerminalWorktrees function, and related per-pane demotion logic. * test(terminal): assert bounded probe during stalled reveal Add assertion to verify that a stalled reveal operation makes exactly one `getMainBufferSnapshot` call, ensuring retry logic doesn't introduce redundant probes that would extend the timeout window before relay fallback. * fix(terminal): implement C1 retention budget for hidden parked worktrees Addresses OOM regressions in hidden parked terminals by force-evicting worktrees past a retention budget: at most 12 mounted while hidden, none past 45 minutes (absolute, not exempted by last-active). Eviction is least-recently-hidden-first. Exempt tabs (unrestorable local PTYs) keep their panes to avoid orphaning shells; worktrees are force-parked even if they contain exempts, and their buffers released elsewhere. SSH/remote worktrees serialize buffers pre-eviction for reveal; local worktrees keep daemon snapshots. Command Code's done-settle window is transferred across park/reveal boundaries so the row cannot strand at 'working'. Model probe on SSH reattach is scoped to park-reveal only, not ordinary reconnects. Includes new E2E suite proving the budget actually releases memory. * memoize eviction-exempt terminal tabs to avoid redundant store reads Each tab's exemption check re-reads the store and walks the layout tree. Introduce selectEvictionExemptTerminalTabIds() to resolve all exempt tabs for a worktree in a single pass, then memoize the result in Terminal.tsx and useTerminalTabColdParking. This prevents O(n) store reads when checking exemptions across multiple tabs and ensures the set remains stable across unrelated re-renders. * refactor: reformat hidden-worktree retention comments Reflow to 80-character lines and remove internal ticket references (C1, C1 slice C). * fix(lint): split overlay slot and eviction-exempt tabs under max-lines Static analysis failed because TerminalPaneOverlayLayer (401) and terminal-parked-tab-watchers (304) exceeded oxlint max-lines. Extract the slot component and eviction-exempt helpers into dedicated modules. * test(terminal): stabilize retention budget e2e control arm Stage un-parkable remote pty ids only after both worktrees are hidden, and keep re-staging during the control-arm poll so a late updateTabPtyId cannot flip the decoy back to park-restorable and ordinary-park it before budget engages. * test(terminal): pin retention e2e decoy to a mounted pane snapshot Use the active pane-identity snapshot for the decoy tab instead of all worktree tabs, and re-assert un-parkable ids after the control-arm hold so a deferred/empty tab id cannot fail the budget-off mounted-count check. * fix: memoize terminal eviction exemptions on layout leaf PTYs Splits add leaf panes to the layout store without changing the tabs array. A memo keyed only on tabs misses this change, leaving new panes unexempted for unmount. Include layout leaf PTYs in the exemption memo key so it recalculates when splits occur or PTYs are re-minted. --------- Co-authored-by: Orca <help@stably.ai>
innocarpe
pushed a commit
that referenced
this pull request
Sep 8, 2026
… tab layout (stablyai#18409) * perf(runtime): stop the expired-SSH-lease sweep from rescanning every tab layout The `runtime:syncWindowGraph` IPC handler is the most expensive thing the main process does: measured on a real session it costs 20.7 ms per call at 0.71 calls/sec, which is 1.47% of wall and ~17% of all main-thread JS. 76% of that sits in one subtree: `getHydrationTargets` -> `hasRuntimeOwnedPtyCandidate` -> `getRecentExpiredSshLease` -> `findTerminalTabIdForLeaf`. Three pieces of pure waste, none of which change an answer: 1. `getRecentExpiredSshLease` evaluated its cheapest and most selective filter LAST. `SSH_PANE_RECOVERY_GRACE_MS` is 30 s, so nearly every stored expired lease fails it — but only after the predicate had already resolved the lease's leaf to its current tab, which is the expensive part. The freshness and reattach-eligibility gates now run first; the predicate is otherwise identical and side-effect free, so the selected lease is unchanged. 2. The sweep ran once per tab. `workspaceSessionWorktreeHasRuntimeOwnedPtyCandidate` asked "does a recent expired lease name THIS tab" for every tab in a worktree, and each ask re-read and re-filtered the whole lease list. It now resolves the worktree's recoverable tab ids once, lazily, so a worktree whose first tab already owns a serve/SSH pty still never sweeps. 3. `findTerminalTabIdForLeaf` allocated a `Set` and walked a whole pane tree per tab to answer one leaf lookup. It now reads a leafId -> tabId index built once per layouts record and reused until a layout object is replaced, which keeps first-tab-wins ordering identical. Measured by replaying a real 414-worktree / 801-tab / 137-lease session: 2.51 ms -> 0.27 ms per publish for this subtree, a 9.3x cut. No user-facing trade-off: same leases selected, same tabs reported recoverable, same SSH pane recovery affordance. * fix(runtime): revalidate the leaf membership index on root identity persistPtyBinding grafts a leaf by assigning `layout.root` on the SAME layout object inside the SAME layouts record, so the layout-identity revalidation kept serving an index blind to the grafted leaf and findTerminalTabIdForLeaf answered `undefined` where the pre-index linear scan answered the tab. That fed the SSH reattach fence (restoreReattachedPtyRuntime) and the expired-lease pane recovery resolver, both of which then fall back to the frozen lease tabId. Membership is a pure function of the root tree and no writer mutates a node in place, so root identity is the exact revalidation key — same O(tabs) pointer compare, no new cap, cadence or staleness window. * perf(runtime): resolve a leaf's tab by scan instead of a cached membership index Fix #3 of this PR cached a leafId -> tabId map per layouts record and revalidated it by comparing every root reference on every read. It was the only mutable cross-call state in the change, the only piece carrying a staleness invariant, and it had already needed one follow-up fix (1c23c54) after a layout-identity key turned out to be blind to `persistPtyBinding`'s in-place `layout.root` graft. The index was never what produced the measured win. After fix #1 moves the freshness gate first, the reporter's replay never calls `findTerminalTabIdForLeaf` at all — every stored expired lease is older than the 30 s recovery grace, so the entire 24.9 ms -> 0.9 ms comes from fixes #1 and #2, both of which are unchanged. `findTerminalTabIdForLeaf` is now an allocation-free scan over the existing `layoutContainsLeafId`, which short-circuits on the first matching leaf instead of materialising a Set per tab. Same answers, same first-tab-in-record-order semantics, no revalidation key, nothing for a writer to invalidate. Re-measured on the same 414-worktree / 801-tab / 137-lease replay (process.cpuUsage deltas, median of 3; wall clock is useless on this box): scenario main index scan all leases stale (replay) 24.86 0.87 0.88 ms/publish one lease inside the grace 24.31 1.08 1.04 ms/publish all 137 inside the grace 18.04 3.71 4.31 ms/publish The measured win is unchanged. Only the synthetic worst case — every one of 137 leases expiring inside the same 30 s window — pays for the cache's absence, and even there the two ranges overlap because the index's own revalidation is O(tabs) per lookup. Removes 208 net lines. `terminal-leaf-tab-resolution.test.ts` keeps the parity cases and adds the guard the cache needed: a subtree replaced in place after an earlier read must be visible to the next one. That test fails against the index. * docs(runtime): say why the leaf scan keeps Object.keys 'Allocation-free' overstated it — Object.keys does allocate one key array. A guarded for...in trades that for a hasOwn call per tab and measures slower, so record the reason the next reader does not re-litigate it.
innocarpe
pushed a commit
that referenced
this pull request
Sep 8, 2026
…stablyai#18356) * fix(crash-reporting): sample system memory before the renderer dies * fix(crash-reporting): make the pre-gone host sample decisive, not just present Round-1 review said the shipped field set could not decide G4-oom. Fixed. Decisive field (blocking #1). The investigation's own win-lowspec repro falsified "low available commit kills": at a 127 MB commit floor Windows grew the pagefile to 2029 MB and nothing died, and it named the missing datum — pagefile-growth headroom / system-drive free space. `getSystemMemoryInfo()` gives neither. Added `swap-volume-free-space.ts`: one `fs.statfs` on the volume backing the pagefile (SystemRoot on Windows, the root fs elsewhere, resolved via `path.parse().root`), published as `systemMemoryPreGoneSwapVolumeFreeMB`. Together with the already-emitted commit limit that separates "commit was low" from "commit was refused". Pagefile *max* size needs a registry read; skipped deliberately — per-operation interpreter spawning is exactly what docs/reference/windows-edr-posture.md says not to add for telemetry. Darwin honesty (blocking #2). Every reading now carries `systemMemoryPressureSignal`: `available-commit` on Windows (swapFree is ullAvailPageFile), `mem-available` on Linux when MemAvailable is present, `none` otherwise — which is always on darwin. A future analyst cannot now table `freeMB: 272` from a healthy Mac as evidence of exhaustion, because the same record says the platform gave no pressure verdict. Partial rebuttal on the suggested reuse: `host-memory.ts:86` was considered and rejected as a periodic source. It spawns `/usr/bin/memory_pressure` per call, and the sampler this PR needs runs every 10 s for the app's lifetime; a subprocess at that cadence is worse than the gap it closes. The reviewer conceded this tradeoff is arguable — what was not acceptable was shipping the darwin gap silently, so it is now in the data, not only in a comment. Staleness (blocking #3). Confirmed the measurement: four of five G4 reports carried a ~37 s-old sample (4872/36796/37332/38017/39715 ms). Host memory no longer rides the 60 s process-metrics sweep; `pre-gone-host-memory.ts` samples it on its own 10 s timer with its own `systemMemoryPreGoneSampleAgeMs`. One GlobalMemoryStatusEx-class call plus one statfs is cheap enough at that rate. A refusal shorter than the interval stays invisible and the module comment says so — no polling cadence fixes that. Non-blocking, all taken: renamed `gone-time-system-memory.ts` -> `system-memory-details.ts` with the now-false "reads AFTER the crash" framing scoped to the gone-time caller; pre-gone host keys moved out of the `processMetrics` namespace to `systemMemoryPreGone*`, so the string-surgery `preGoneDetailKey` helper is gone and a `systemMemory` prefix scan sees both reads; the bare catch no longer spans both halves of the sample, and a test pins that a throwing host read leaves the process-metric sample intact; the inert second test is replaced by three that go red without this change (verified: swap-volume, pressure-signal and cadence assertions all fail when the production hunks are reverted). Rebuttal, non-blocking #5 (duplicated electron mock across two test files): declined. `vi.mock` is hoisted per file, so the mock cannot be shared without a setup module, and this directory already has 26 focused test files that each re-declare it. Splitting by concern is the local convention. `startPreGoneProcessMetricsSampling` is renamed `startPreGoneCrashSampling` since it now starts two samplers. * fix(crash-reporting): test the arming, gate the swap volume, unblock the host read Round-2 review blocked on four items. All four addressed. WHAT THIS BRANCH ACTUALLY DOES, AT HEAD (blocking #4). The commit-1 message ("13 lines, 1 production file, no new module, new optional numeric fields only", `processMetricsPreGoneSystemMemory*` keys, a `preGoneDetailKey` helper, a `pre-gone-system-memory.test.ts`) describes a superseded revision; every one of those claims is false now, so it must not be used as the PR description. The change against origin/main is: 3 new production modules (`pre-gone-host-memory.ts`, `system-memory-details.ts`, `swap-volume-free-space.ts`), 1 deleted (`gone-time-system-memory.ts`), plus edits to `process-gone-diagnostics.ts` and `main-process-ready-runtime.ts` and 2 test files. It adds a second main-process interval timer that runs for the life of the app: every 10 s one synchronous GlobalMemoryStatusEx-class read, and on win32/darwin one `fs.statfs` on the swap-backing volume. Details are `systemMemoryPreGone*`, and two of them are STRINGS, not numbers: `systemMemoryPreGonePressureSignal` (enum) and `systemMemoryPreGoneSwapVolume` (a drive label, separator-trimmed so it is not a path). Both are assigned after `sanitizeCrashReportDetails`; neither carries user content. Arming is now tested (blocking #1). The reviewer deleted `startPreGoneSystemMemorySampling(...)` from `startPreGoneCrashSampling` and all 264 tests stayed green — confirmed and fixed. `pre-gone-host-memory.test.ts` now calls `startPreGoneCrashSampling()` with production defaults and asserts both `setInterval` calls, their literal periods `[60_000, 10_000]`, that both timers are unref'd, and that advancing 10 s takes a fresh host sample that reaches `buildProcessGoneCrashDetails` with `SampleAgeMs: 0`. Verified red on revert: deleting the arming line -> 1 failure; changing the interval constant to 30_000 -> 1 failure (the old assertion compared the constant to itself and caught neither). The tautological `10_000 < 60_000 / 2` test is gone, superseded by this one. Swap volume is win32/darwin only (blocking #2). On Linux swap is a fixed partition, a fixed-size swapfile, or zram; none grow into root-fs free space, so `SwapVolumeFreeMB: 380000` beside `SwapFreeMB: 0` would have invited exactly the wrong verdict on the two Linux cluster members. `swapVolumeAnchor` returns undefined off win32/darwin, so no field and no statfs at all. The comment claiming "elsewhere swap is on the root fs" was wrong and is gone. The Windows anchor is still the DEFAULT pagefile volume, so the measured volume now ships with the number (`systemMemoryPreGoneSwapVolume: 'C:'`) instead of being implied. The honesty label covers it: win32 reads `available-commit` only when the volume datum is present, and `available-commit-unqualified` otherwise — which also fixes non-blocking #5, where the synchronous gone-time read claimed a verdict its own fields could not support. Host read no longer waits on statfs (blocking #3). `samplePreGoneSystemMemory` now commits the synchronous memory reading first and merges volume free space in afterwards, so the cadence is 10 s regardless of disk-metadata latency and a hung volume can no longer stop host sampling — precisely the paging-storm case this exists for. The in-flight latch now guards only the statfs. Verified red on revert to the serialized shape (2 failures). A stale-but-slow-moving volume value merging into a newer memory sample is deliberate and commented. Non-blocking #3 (reset does not invalidate an in-flight sample): fixed with a generation counter bumped by `resetPreGoneSystemMemorySamplingForTest`, so a late statfs cannot repopulate a reset sample. Separately, the volume read now only runs after a host sample committed, which removes the real `statfs('/')` side effect from `process-gone-diagnostics.test.ts` entirely. REBUTTAL, darwin `memory_pressure` reuse (non-blocking #2): declined, with evidence. `readDarwinAvailableMemory` at src/main/memory/host-memory.ts:87 is reached only via `collectHostMemory` <- `runSnapshot` <- `collectMemorySnapshot`, whose only callers are the `memory:getSnapshot` IPC handler and orca-runtime-pty-foreground-process-reads.ts:170 — both on demand. There is no periodic snapshot, so there is no cached reading to reuse for free; adopting it means spawning `/usr/bin/memory_pressure` on a main-process timer for the life of the app, and its module-global `darwinAvailabilitySupported` latch is shared with the memory UI. The gap is not hidden: darwin ships `PressureSignal: 'none'` in the data, and the module comment now cites the existing reader and why it is not used here rather than claiming Orca lacks one. Verified: `vitest src/main/crash-reporting src/main/startup src/main/memory` = 769 passed / 6 skipped (crash-reporting re-run 5x, no flake); `tsc --noEmit -p config/tsconfig.node.json` 0; `oxlint` 0; `oxfmt --check` 0. * fix(crash-reporting): stop a stale statfs qualifying the commit verdict Round-3 adversarial review, 2 blocking. Both fixed with mutation-verified tests. 1. `mergeSwapVolumeFreeSpace` merged the volume reading into whatever sample was current at RESOLUTION time, and `pressureSignal` then upgraded win32 from `available-commit-unqualified` to the decisive `available-commit` on the strength of it. The `swapVolumeReadInFlight` latch makes every intervening tick skip the merge, so the lag is as old as the last STARTED statfs, not the last tick — and no age field exposed it, because `systemMemoryPreGoneSampleAgeMs` describes only the synchronous memory read. Reviewer's executed scenario: a statfs issued at t=0 on a healthy host (40 GB free) resolving at t=20 s of commit pressure emitted `SwapFreeMB: 200` beside `SwapVolumeFreeMB: 40000`, labelled `available-commit`, with `SampleAgeMs: 0`. That reads as "the pagefile had room, so this was not a commit refusal" — the opposite conclusion, wearing the branch's highest-confidence label, on exactly the win32 G4-oom reports this exists to decide. The datum still ships (it is the only pagefile-expandability signal there is), but now: - the sample carries `swapVolumeSampledAtMs` — the tick that ISSUED the statfs, never the one it resolved on — surfaced as `systemMemoryPreGoneSwapVolumeAgeMs`; - only a statfs that answers on its own tick may qualify the verdict. `withSwapVolumeFreeSpace` takes `coTimed`; false keeps `available-commit-unqualified`. The next tick issues a fresh statfs, so the verdict recovers on its own. 2. The branch's sole production entry point — `startPreGoneCrashSampling()` at main-process-ready-runtime.ts:128 — was untested. Deleting it left 691 tests across crash-reporting/ and startup/ green, while a comment in the new test file claimed that gap was why the test was written. This is pure instrumentation, so that one line is the whole of its value in the shipped app. Added a source-level wiring test (the pattern this repo already uses for arm-once ready-phase lines) that pins the import, exactly one call, the call at statement indent, and that `main-process-ready.ts` awaits the function it lives in. The misleading comment is gone. Mutation-verified — each goes red alone: coTimed -> always true 1 failed (verdict) drop swapVolumeSampledAtMs age 1 failed (verdict test) delete startPreGoneCrashSampling() 1 failed (wiring) wrap it in `if (!is.dev) { ... }` 1 failed (wiring) Verified: tsc -p config/tsconfig.node.json exit 0; oxlint src/main/crash-reporting src/main/startup exit 0; 268 tests in crash-reporting/ pass. Across crash-reporting/ + startup/ + memory/: 769 passed, 2 failed — both environment-dependent and failing identically on the unmodified tree (Xvfb rebind, and a whole-repo glob census that times out). * fix(crash-reporting): stop free disk standing in for pagefile growability The win32 reading was promoted to the decisive `available-commit` whenever a co-timed volume number merely existed, which the data cannot support: a fixed or disabled pagefile grows into no amount of empty disk, its maximum is unreadable here, and the measured volume is only the DEFAULT pagefile drive. A host with 180 MB of available commit, a commit limit at RAM and 812 GB free read as "the pagefile had room" — the opposite conclusion, under the branch's most confident label. The volume datum is now named for what it is (`available-commit-volume-cotimed`, context beside the commit number), and the one decisive win32 case — a commit limit at or below RAM, i.e. no pagefile behind it — gets its own label. Also: carry the last volume reading onto the sample that replaces it, aged and non-qualifying, so a statfs slower than one tick no longer makes the field vanish from the reports it exists for; don't commit a reading whose every memory field failed, which shipped an age and a disk-free number with no host memory beside them; and move the startup wiring test beside the file it pins, scoped to the ready-phase entry's own body so the call cannot satisfy it from a sibling export nothing calls. * fix(crash-reporting): co-time the statfs by tick, not sample identity A tick whose host read fails leaves the pre-gone sample object in place, so the identity check still read a 25 s-late statfs as co-timed.
innocarpe
pushed a commit
that referenced
this pull request
Sep 18, 2026
…eeds You" (stablyai#21389) * fix(agent-status): stop an auto-reviewed Codex approval reading as "Needs You" Codex runs its PermissionRequest hook as decider #1, ahead of both its own review agent and the user, so the event means "a decision is being made", not "a human is blocked". Under the "Approve for me" posture the review agent resolves it seconds later, so every gated tool call drove the pane from Working to Needs You and back, plus a desktop notification each time. The execution host now reads the turn's approvals_reviewer off the rollout it already tails for subagent reconciliation, and keeps a reviewer-owned approval as working. Positive evidence only: an absent field, an older rollout, or an unreadable file all still raise the wait, so this can never hide a real prompt. Splits the incremental rollout JSONL cursor out of the subagent transcript module, which the new reader pushed over the file-length cap. * fix(agent-status): avoid stale Codex approval ownership * fix(agent-status): reconcile Codex child approval ownership * perf(agent-status): avoid reads for Codex child activity * fix(agent-status): scope Codex reviewer ownership by transcript
innocarpe
force-pushed
the
fix/tui-idle-grok-background-tasks
branch
from
October 22, 2026 03:13
b236a04 to
8bced6d
Compare
innocarpe
force-pushed
the
fix/tui-idle-grok-background-tasks
branch
from
October 29, 2026 11:00
8bced6d to
5ea10d9
Compare
… events (stablyai#37013) * feat(plugins): panels talk to their own worker, read storage, settings and events - plugin.request (host API 1.2): a panel or editor asks its plugin's worker, which answers with orca.panels.handle(name); the worker pushes with orca.panels.post. Same plugin only, JSON checked, 1 MiB answers, 256 KiB/200-per-10s posts, a deadline and the panel's lifetime. - Panels and editors get storage.*, settings.* and secrets.* behind the same capabilities, and storage/settings onDidChange on every surface; events.subscribe delivers workspace and agent events to panels that hold the read capability. - contributes.settings: typed settings (a JSON Schema subset) with defaults and value checks. - Frames get orca.plugin/storage/settings/secrets; components panels import plugin, storage, settings, secrets from 'orca', and atom(key, init, { persist: 'storage' }) shares a value with the worker. Workers get orca.panels/storage/settings/secrets sugar. - One typed contract: declare module 'orca' { interface PluginRequests / PluginPanelEvents }. - Desktop push channel per open panel session (plugins:openPanelPush). * feat(plugins): Orca Settings shows and edits a plugin's contributes.settings The plugin page lists declared settings with Orca's own controls (switch, picker, text and number fields, Reset to default). Edits are checked against the declaration in main, written to the plugin's settings, and reach open panels and the running worker through onDidChange. * docs(plugins): hello-tsx talks to its worker; authoring guide covers panels, workers and data The example now uses one of each: plugin.request answered by orca.panels.handle, a worker post heard with plugin.on, a persist: 'storage' atom the worker watches, two contributes.settings and agent.status.changed in the panel, all typed by one src/protocol.ts. The build-less TSX e2e drives the whole loop. * fix(plugins): typed bridge overloads, panel call budget, settings IPC and catalog keys - PluginBridgeApi/PanelsApi use overloads: declared names are typed (and complete), any other name carries JSON; no never-unions for the type-aware lint. - The per-plugin panel call budget is 120 per 10 s, since a panel loading storage atoms, settings and its first requests makes a burst; the hostile fixture floods past it. - Settings IPC builds its host per call; the settings section's strings are in en.json. * test(plugins): the example's declared settings show under the plugin with the person's value * refactor(plugins): keep hello-tsx the minimal starter; the bridge demo is hello-worker-panel hello-tsx goes back to a sandboxed-ui panel with no worker or capabilities. The worker, protocol, storage atom, settings and events move to examples/plugins/hello-worker-panel, with their own e2e (plugin-worker-panel) and PR route. * feat(plugins): test kit covers the panel bridge and plugin data mockHost keeps the plugin's storage, settings and secrets in memory (seeded with storage, settings, secrets; read with host.data()) and fakes the worker with requests, so plugin.request, storage/settings/secrets and persist: 'storage' atoms work under mount(), writes reach onDidChange, and panel.post(event, payload) is what plugin.on hears. Typed by PluginRequests and PluginPanelEvents. * test(plugins): focusInGuest waits for the guest and retries focusing as one step Under load the custom-editor guest could still be attaching, so executeJavaScript threw 'dom-ready' before the focus poll began. Wait for waitForGuestReady, then retry focusing the webview and the element together, tolerating a guest that is still attaching or remounts. * docs(plugins): the authoring skill covers panels, workers and data; persistence leaves the renderer - skill-guides/orca-plugin-authoring.md gains Panels, workers and data (plugin.request/on, orca.panels.handle/post, persist: 'storage', contributes.settings, panel events, test kit), and its generated references read orca-services.d.ts for shell, files, on and the bridge types. - After the dev-loop rebase, persisted-atom wiring (queue plus storage sync) moves to createDeclarativePersistence so the renderer stays under max-lines. * feat(plugins): panels show agents: agents.list, terminal ids on agent events, workspace.changed - agents.list (agent:read, every surface): the focused workspace's agents with terminalId, title, agent kind, state and stateStartedAt, from the hook server's store. - agent.status.changed carries terminalId and title: paneKey mapped through the runtime's terminal list (tabId:leafId) or the status's terminal handle; looked up only while a plugin listens, in arrival order. - workspace.readContext terminals carry title; workspace.changed (workspace:read) fires after workspace session writes when the focused workspace or its terminals change. - Event subscriptions are kept per panel session, so one made before the push channel opens still counts. - shell.openExternal never prompts on a hidden or minimized window: it settles { opened: false, reason: 'consent-unavailable' } and says so in the plugin log, which also notes 'waiting for the person to confirm' while a prompt is up; the rate budget is spent only when Orca acts. e2e launches never open a real browser or mail client. - A worker may export activate as default or by name; docs, typings and the authoring skill document the entry, the agent events and a live agent status recipe. * fix(plugins): the plugin page names the workspace.changed subscription * fix(plugins): workers activate only by default export, and say so when it is named Orca calls the worker module's default export. A module with a named `activate` and no default now fails to start with an error naming the fix (`export default function activate(orca)`), instead of being called by a fallback; docs, typings and the skill say default export. hello-worker-panel gains a picker setting (suggestionOrder) the worker reads.
…tablyai#37008) * feat(plugins): orca plugin open and shot; dev watch --shot - orca plugin open <key> [--panel|--editor] shows a panel in the right sidebar or a file in the plugin's custom editor, by changing renderer state only (no focus or window raise). - orca plugin shot <key> [--panel] [--theme] [--width] [--out] [--json] waits for the panel's current code to draw, then crops webContents.capturePage to the panel (html guests included), with background throttling off while hidden. --width and --theme are temporary in-memory overrides; the PNG returns base64 (5 MiB cap), so --environment works. - dev watch --shot <dir> writes a PNG per panel after the load and each good reload. - The authoring skill's loop is now dev watch --check --shot → read the PNG → plugin test. * fix(plugins): shots never disturb a visible Orca - shot --theme is skipped while the Orca window is on screen (themeApplied: false with a themeReason); the override applies only to a hidden or minimized window. - dev watch --shot opens the first panel (or --shot-panel <id>) once, then shoots it with ifShown: if the user moved the sidebar away it emits one shot_skipped instead of switching. * fix(plugins): dev loop dogfood fixes; orca plugin dev emit - dev watch: approval re-run command drops watch-only flags and old --approve; a folder added by a refused load is owned by the next approved load (Ctrl-C unloads it); check events carry the plugin's status (no green while pending/errored); reloaded prints before that reload's logs; --json errors are one NDJSON line. - Errors: log, banner and check share source-mapped positions (a line-1 prelude hands sucrase mappings to the components runtime); check dedupes issues and locates syntax errors; Orca runtime frames and the error module's bogus location are dropped from logs. - .orca/types tsconfig sets preserveSymlinks (tsc 7 loaded typings twice under /tmp). - Templates' READMEs use dev watch. - orca plugin dev emit <dir|key> <event> [--data] sends a test event to a dev plugin's worker through the real delivery rules (plugins.devEmit). * test(plugins): fixed timestamp in the dev emit test * fix(plugins): shot captures an html panel's guest itself On Linux the main window's capturePage leaves a <webview> guest blank. The renderer now reports the guest's rect, and main captures the guest's own webContents and draws it over the window capture at that rect (raw bitmaps, nativeImage only). Components panels are drawn by the host, so the window capture alone stays right for them. * refactor(plugins): keep plugin-service and main-process-plugins under max-lines After rebasing onto stablyai#37013 both files crossed 300 lines. The guest log sink moves into the desktop view binding (bindPluginDesktopViews), and plugin-service tightens emitEvent and its event-delivery imports.
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…down, code, images (stablyai#36997) * plugins: components catalog 2 (forms, tabs, table, tree, markdown, code, images) Adds 18 components to TSX components panels, drawn with Orca's own primitives and gated by ui.catalog 2 / ui.has() (Orca 1.4.247): Textarea, Checkbox, RadioGroup, Slider, Field, Tabs/Tab, Collapsible, Toolbar, Grid, a virtualized Table with sort, selection and pull-based paging, a keyboard Tree with lazy children, Markdown (sanitized, links through the checked open path), CodeView (Orca's highlighter), Image (header-checked plugin files read by main), KeyValue, Callout and Skeleton, plus a tooltip prop on Button and IconButton. Value controls share the edit protocol; handlers get plain JSON event args, including small objects ({ keys }, { key, expanded }). The test kit gains matching actions and hides unselected tabs and closed collapsibles; a components-gallery example and e2e cover the catalog end to end. * plugins: worker test harness, host refusals in tests and check - orca/testing gains mountWorker(main, { host, events, commands }): it calls the default-exported activate(orca) with the orca object Orca itself builds (createPluginWorkerOrcaApi, moved to shared so the kit reuses it), backed by mockHost. emit() checks payloads against Orca's event schemas and only delivers subscribed events; command(), request() (the worker's orca.panels.handle, as a panel's plugin.request), posts, logs, refusals and deactivate(). Storage and settings share the mock host's in-memory store. - orca plugin test loads a worker main's module graph as Orca's worker host does (.ts/.mts transform, Node resolution, no runtime orca import). - mockHost records refusals (capability_denied, not_permitted, ...) even when plugin code catches them; panel.refusals exposes them and orca plugin check reports them as warnings. Check dedupes repeated issues. - Typings, docs and a generated references/testing.md skill reference; the reference generator reads the split orca typings.
…lyai#37026) * feat(plugins): dev emit also reaches the plugin's open panels orca plugin dev emit now publishes through the panel bridge to that dev plugin's open panels that subscribed with orca.on, under the same approval and capability rules as the worker, and reports delivered.panels. The bridge's publishEvent takes an optional pluginKey filter and returns how many panels heard it. A panel-only plugin no longer needs a worker; an event nothing listens for is refused. * docs(skills): trim the plugin authoring guide; details move to references The main guide drops from 299 to 121 lines: the decision table, build-less rules, core loop (create → dev watch --check --shot → read the PNG → test → check → release-entry), approval and top gotchas. Test/check and orca/testing (panels and workers), dev watch events, shot, open and dev emit move to a hand-written references/workflow.md; the panel/worker/data and agent status recipes to references/recipes.md, each with a read-when row. The guide test now also scans hand-written references for commands and caps the main guide at 150 lines.
…7038) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…37047) - orca plugin check mounts the plugin's worker (main) on the same mock host as each panel, so plugin.request reaches its orca.panels.handle handlers as in Orca; a worker that fails to activate or deactivate is an issue named after its file. In orca/testing, a worker mounted on a host answers that host's panel requests unless `requests` stubs the name. - Check scenarios: <entry>.check.ts (e.g. src/panel.check.ts) exports defineCheck({ name: { ...mockHost options, persisted, theme, events } }); check renders the panel once per scenario and labels each result. - RelativeTime (catalog 3, since 1.4.247) and { type: 'relative', at } Table cells: Orca ticks them (each second under a minute, then less often), so plugins never poll. Inline inside Text; test kit reads them as drawn. - Typings, docs, skill guide, generated references; gallery shows it.
…37053) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…#36970) * fix(mobile): show workspace images in session Markdown tabs * fix(mobile): show workspace images restored by undo or paste * fix(mobile): keep session image loader current and inside the workspace * fix(mobile): classify entity-encoded image URLs by their decoded scheme * refactor(mobile): classify editor images with the shared Markdown href router * test(mobile): expect workspace image markup in the code-block selection check
…en on Android (stablyai#36977) * fix(mobile): keep Android split screen from restarting or squeezing the app One UI gives a split-screen pane its own density. Android recreated MainActivity on that change, and React Native seeds its display metrics from the application context, which keeps the full-screen density, so the pane was laid out at the wrong scale. A config plugin declares density in configChanges and re-seeds the metrics from the activity. * fix(mobile): catch React Native's rotation re-seed before the frame draws A one-shot listener added on configuration change missed a cold start or a 180-degree flip at a non-zero rotation, where React Native's root view re-seeds from the application context without a configuration change. * fix(mobile): publish re-seeded display metrics in one step Text measurement reads the holder off the UI thread, so build the pane-density screen metrics before publishing them.
…ut polish (stablyai#37049) * feat(plugins): orca plugin dev request; --template worker-panel - orca plugin dev request <dir|key> <name> [--data] [--panel] [--timeout-ms] calls a dev plugin's orca.panels.handle handler through the real panel bridge (plugins.devRequest) and prints the answer; handler errors become plugin_request_failed with the worker's code. - orca plugin create --template worker-panel scaffolds a build-less trusted-worker plugin: a components panel, src/worker.ts, a shared src/protocol.ts contract, and panel and worker tests that pass under orca plugin test and type-check with tsc. * feat(plugins): shot --act, shots in the plugin folder, quieter logs - orca plugin shot --act '<json>' presses, types, selects and toggles in the live components panel (the test kit's queries and acts, through Orca's own controls and onEvent) before the capture, waiting for each to settle. Only that plugin's panel, only with Orca's window hidden or minimized; html panels refused; acts are not user gestures. Results in actions[]. - shot run inside a plugin folder defaults to its .orca/shots, like dev watch --shot. - dev watch prints identical [frame] lines once per reload with a count; logged stacks drop <anonymous>/native frames; the floating workspace button hides during a capture. - Skill: worker-panel template in the decision table, dev request, shot --act, and a gotcha that a worker save drops its in-memory state.
…autocorrected word (stablyai#36947)
…tablyai#36966) * fix(mobile): scroll wide tables in the rich Markdown editor instead of squashing columns * fix(mobile): keep CJK table columns from shrinking to one character
* fix(mobile): quote expo-constants iOS build paths so checkouts with spaces build Backports the expo-constants 58 quoting of the app.config build phase (podspec bash -l -c argument and basename $PROJECT_DIR) to 55.0.17. * fix(mobile): quote react-native-xcode.sh call in the iOS bundle phase Expo SDK 55's template leaves the command substitution unquoted, so the Bundle React Native code and images phase splits a checkout path with a space. Expo's SDK 58 template applies the same quoting.
…ibe (stablyai#37044) A panel that loaded before Orca focused a workspace showed nothing until the next change, and a subscription made before the panel's push channel opened was never told at all. Now each new subscriber gets the current context first: the panel bridge replays it once the channel is open (or right away), and a worker's events.on('workspace.changed') reads it through workspace.readContext. Unit tests for both, and the agents e2e checks the first event arrives with no change happening.
…ile (stablyai#36953) A Claude Read of a PNG returns only base64; the path is on the call. A shared rule turns each finished file-read of a raster image into an image-ref under the tool run header on desktop and mobile. Mobile chat prose now draws https, data and absolute-path markdown images inline, every image in a paragraph, through the existing host image read.
…ated Save/Cancel (stablyai#36928) The queue card's invisible full-text line-count probe overflowed its two-line row and stretched the queue's scroll range far past the real rows. Clip it to the card text. The queued-message editor drew Save and Cancel labels inside 38pt round icon controls, so translated labels spilled over each other. They are now pills that hug their label and truncate only when the row runs out of room.
…it back (stablyai#36944) * fix(native-chat): keep a Claude reply visible when a Stop hook sends Claude back Claude writes a blocking Stop hook's reason as an injected user turn, which both Claude decoders dropped. The settled-turn fold then took the post-hook continuation as the turn's only answer and folded the real reply away. Both decoders now turn that feedback into a 'Stop hook feedback' row, and the fold keeps the prose before each such row as an answer too. * fix(native-chat): keep the Stop hook row when catching up a Claude chat transcript * refactor(native-chat): one row table for hook outcomes * fix(native-chat): import journal types from their new home * fix(native-chat): import moved translation and status-block modules from their new homes
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…o main's Mobile checks pass (stablyai#37370) * fix(plugins): build the consent fingerprint without toSorted so the phone bundle passes Hermes checks Main's Mobile verify has failed since stablyai#37316 because the plugin consent fingerprint (bundled into the phone app via src/shared) used Array.prototype.toSorted, which Hermes lacks. flatMap already returns a fresh array, so sorting it in place keeps the same result. * test(plugins): pin the consent fingerprint's command-order independence Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…opulations (stablyai#37385) Deletes terminal-tail-redraw-wall-time: its result equality duplicates the randomized equivalence suite and its complexity claim is pinned by the join-counting scaling suite; it only added a 3x wall-clock race. Shrinks scaling suites whose bounds are exact or log-bounded formulas in n to the smallest population that still separates linear from superlinear work, and pairs a worktree-poll test's scans so it no longer waits out the 5 s scan timeout.
* test: remove 15 low-value test declarations * test: remove scheduling and routing budget checks; route editor shots --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
* test: remove 43 low-value test declarations * test: update catalog scaling conversation view import --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
stablyai#37376) * fix(wsl-move): land on the workspace view after a move's window reload A move or "Use on this computer again" reloads the window from Settings. Settings cannot restore which page was open, so the reload opened General, and the saved view kept reopening Settings on later launches. Main now switches the saved view from Settings to the workspace view right before that reload. Co-Authored-By: Claude <noreply@anthropic.com> * fix(wsl-move): leave Settings even when the window is gone at reload The landing view now comes from the write hold whenever a reload is owed, so a window closed before the reload still relaunches on the workspace view. Co-Authored-By: Claude <noreply@anthropic.com> * fix(wsl-move): keep the reload going if the landing view cannot be saved Picking the landing view is now best-effort, so a failing store write no longer strands the write hold or skips the reload. Adds a wiring test that fails if the landing is not registered. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
…that already runs as one (stablyai#37377) * fix(wsl): offer the existing host when adding a folder from a distro that already runs as one * fix(wsl): translate the existing-host offer, let a later drop win, keep the offer when the host fails to start - Translate existingTitle/existingWhy/existingAccept into every locale. - A drop onto the open dialog after "Add on host" now prefills the dropped path. - A failed host start keeps the offer so the user can retry or add on this computer. - Tests run the real saved-host read (flag off gives the run-as-host offer) and the offer-to-prefill wiring.
* WSL move dialog: one line on why to move, and the way back * Capitalise Git in the WSL move why-line
…tablyai#37383) * fix(repo-icon): round project image icons on desktop to match mobile Mobile rounds project image icons with a 4px radius, but desktop draws them with square corners, so the same avatar looks different across clients and sits awkwardly beside the rounded sidebar controls. Apply the same 4px radius to the image in RepoIconGlyph so every desktop surface picks it up. Emoji and lucide icons are unchanged. Covered by a repo-icon test that failed before the change. * test: drop repo-icon radius test --------- Co-authored-by: Rongzheng Liu <tianlrz@users.noreply.github.com> Co-authored-by: Neil <neil@stably.ai>
…out spread 10.2% → 3.8%) (stablyai#37393) * ci: refresh unit shard timings from a 12-shard four-worker run Replaces the October 25 five-shard eight-worker baseline with run 41403569437, which includes the November 1 test-time fixes. On an independent run's measurements the projected per-shard spread falls from 12.0% to 7.4%. * ci: average unit shard timings over five runs A single run's per-file noise left this PR's own run 21.8% apart. The importer now accepts several complete runs and averages each file; held out, the averaged baseline projects 3.8% against 10.2% for the October 25 baseline.
…tablyai#37342) * fix(appearance): changed divider colors also paint tab-group splits Co-authored-by: mmarabel <mmarabel@users.noreply.github.com> * fix(appearance): follow the terminal divider slot and keep the value's case --------- Co-authored-by: mmarabel <mmarabel@users.noreply.github.com>
… and surface failures (stablyai#37369) * fix(fonts): enumerate Windows fonts natively instead of through PowerShell Read the registered font files' name/fvar/STAT tables so a Group Policy block on PowerShell no longer collapses the picker to five fonts, and say so in the picker when the OS list is unreadable. * fix(fonts): harden sfnt parsing and Windows font file discovery * fix(fonts): follow STAT naming rules and bound Windows font reads * test(fonts): type platform timeout cases without assertions * refactor(fonts): list Windows fonts with Chromium's queryLocalFonts instead of a custom sfnt parser * fix(fonts): scope the local-fonts grant to the main window and keep the web client quiet
…tablyai#37353) * feat(settings): let the Ghostty import read a config file you pick * fix(settings): guard Ghostty file-pick races and non-regular files
…ablyai#34891) * Nest chat-UI orchestration workers under the agent that started them Main's lineage projection only walked terminal panes, so workers running in the chat UI never got a parent link and listed flat in the sidebar. It now also projects chat workers, keyed by their visible chat row, and resolves a chat creator or coordinator to that chat's visible row instead of its handle or private mailbox pane key. * Fix public worker lineage across assignment and row identities * Complete terminal lineage provenance and bound active session selection * Repair lineage test runtime boundaries and SQLite counters * Provide read-only crew snapshots for each agent * Batch public lineage verification after exact recency selection * Derive crew relations once per meaningful host change * Remove package manager lockfile churn from hook * Show each pane’s agent crew with open and copy actions * Use checked runtime values in lineage integration tests * Preserve host-aware crew navigation remedies * Document the trusted Dispatch SQL row boundary * Keep lineage integration imports within their test programs * Load native lineage fixtures before test execution * test: complete lineage inputs in runtime and sidebar fixtures * test: seed benchmark facts from active dispatches * test: replace partial orchestration DB casts with typed fixtures * test: complete stale-leaf mailbox fixture session input * Derive durable crew parents from retained assignment proof * fix(test): render worker lineage fixture with production list * fix: preserve crew pane controls and summary identity * refactor: extract crew row details presentation * Add scoped terminal identity acquisition and preserve crew source wakes * Share raw crew identity inputs through scoped production readers * Exercise crew generation retirement through actual source owners * Retire crew inputs on consumed ownership and visibility writes * Use typed crew mutation and fixture access * fix: use owned crew styles and committed render counters * Repair crew fixture and RPC type contracts * Count crew consumer render attempts in the fixture * Localize crew panel labels and details * Align crew integration fixtures and RPC parameter contracts * Encapsulate terminal identity mutations and captured reader contracts * Seed terminal identity fixtures through canonical mutations * Complete crew panel English catalog entries * Fix terminal identity fixture return type * Cover terminal identity lifecycle schedules * Align terminal fixtures with canonical identity sources * Repair runtime fixture source contracts * Use checked database fixtures for federation contracts * Update crew source inventories and exit fixtures * Preserve crew setup outcomes at existing subscription owners * Match managed restore fixture to its nullable async return type * Keep absent setup observations distinct from undefined failures * Drive pending Crew questions from existing metadata * Preserve nested pairing repair outcomes for shared callers * Route attached workers to explicit local recipients * Type Crew pending-question measurement receipts * Match SSH repair fixture target absence to store contract * Add finite crew subscription boundary candidates * Isolate crew portal in terminal file drop fixture * test: use checked property access for crew owner assertions * Consolidate web runtime auth type imports * test: type crew API legacy arguments and pending results * Bound cold terminal layout construction and finite pane acquisition * test: use public runtime identity in pane acquisition fixture * Avoid repeated searches in cold workspace layout loading * Verify cold loader fault identity and hook claimant effects * Revert "Route attached workers to explicit local recipients" This reverts commit f1335d1. Keep attached workers on the existing Run-home routing path for this change. * Omit crew peer addresses outside the active home route * Align crew disclosure and availability with shared UI * Keep crew retries on the verified runtime session * Bound cold layout retirement and recorded-key construction * Verify original cold layout failure identity * fix: preserve surviving layout split references * test: use typed retirement instrumentation properties * Keep crew overlay inside narrow panes * Resume Crew streams on verified runtime sessions * test: preserve pane and retirement fixture contracts with checked types * Prepare Crew record admission and wake identity changes * Derive Crew recipient actions from current target owners * Keep nested Crew process facts within selected acquisition * Defer Crew legacy facts to consumers and complete raw coverage on success * Use deterministic time in Crew command fixtures * Restore pane-local Crew menu dismissal focus * Document schema-owned Dispatch row assertions * test: align Crew authority fixtures with typed project boundaries * test: place Crew CLI integration in cross-surface project * Type retained identity test meters with canonical source maps * test: adapt mounted Crew fixture to Run unbind contract * Document suffix Dispatch row boundary and preserve fixture unbinding * Close crew menus when their terminal pane hides * Remove unused structured activity component * test: migrate Crew authority arguments and mailbox observations * Forward native pane visibility to crew menus * Fix pointer dismissal enrollment and modal permission * Remove shared menu primitive patches * Reuse message avatars in the crew panel * Derive Crew attention and actions from complete recipient authority * test: repair Crew avatar store fixture and operation accounting * Fix Crew public-command fixture type contracts * Align Crew fixtures with runtime reader and routing contracts * Keep shared message avatar glyphs at their declared size * Narrow receiving fixture calls to unary RPC methods * Age pending question fixtures from every actual answer timestamp * Complete Crew public-command workspace fixture result * Test delegated helper follow-up through Crew advertised address * Qualify Crew follow-up addresses through shared command admission * Complete finite follow-up authority and lifetime evidence * Assert exact remote authority acquisition error identity * Consolidate Crew SQL test fixture imports * Trim Crew panel tests to the high-impact set Keep one mounted test per panel flow, the review-found regressions (avatar glyph size and attribution, stable labels, unavailable sending, hidden-pane menus, navigation remedies), the real producer-to-hook contract, cross-version refusal and recovery, and one N vs 10N contract per scaling piece. Remove permutation matrices, focus-timing proofs, and the duplicated web API and attempt suites. * Trim Crew read-model tests to the high-impact set Keep the real CLI/RPC/database command paths, one regression per review-found bug, the cross-version contracts and one N vs 10N operation contract per scaling piece. Drop permutation matrices, equivalence oracles, near-duplicate scenarios and diagnostic output, and return the SSH, managed-server and WSL test files to main, since their production changes were reverted earlier in this PR. * Drop diagnostic output and a duplicate error case from Crew tests Remove two leftover console.log diagnostics, an unused 2x2 sample matrix and unused return fields in the follow-up cost contract, and the subscription AbortError serialization case that the subscription identity and preload tests already cover. * Pass the recorded-leaf reader in main's check-details loader test * Build the approved orchestration panel design Closed tab: panel icon, lineage icon with the worker count, then agents grouped by status (needs you, working, idle, failed) with the sidebar's status icon, up to three overlapping agent icons and +n. Rows are one card with the task, the latest message or question, the relative time and Details, Open, More. Rows sort by latest message. The open panel reaches the pane top under the title strip. No user-visible 'crew' text; counts use plurals. One store subscription resolves every row's live sender state so the tab and the rows agree. * Keep pane title buttons above the orchestration panel; tick row times The open panel now sits just below the pane title strip in stacking order and starts at the pane top in every host, so the strip's buttons draw over its top band and no chat or terminal text shows above it. An open panel lifts its pane's drag strip above it. Row times re-render on the sidebar's shared 30s clock. Each status group keeps one fixed icon, and the panel's needs-you count has its own plural. * Move the orchestration row into its own file * List every status case in the orchestration icon switches * Fit the orchestration tab and avatar stack to main's Button and key lint rules * Subscribe the memoized crew row to language changes; read the nullable listener count * Ship the orchestration panel's plural labels in the boot catalog * End the chat's orchestration panel above the composer The panel overlaid the whole chat body, so with it open the composer's send button sat underneath it. The frame now wraps only the transcript; the queued drafts, prompt cards and composer stay where main puts them. * Skip escalations when choosing a crew row's latest message Orca writes its failure notices (a worker stopped without reporting, a chat agent error, a terminal exit) as the worker's own escalation, with terminal, task and dispatch IDs and CLI syntax meant for the coordinator agent. The panel showed that text as the row's second line. Only the panel reads this query, so escalations are skipped there and the row shows the agent's last real message. An agent's own Blocked escalation is skipped too; it still reaches the coordinator's inbox. * Say why a crew row's agent can't be opened Opening a row whose agent is gone showed "This agent is no longer available." Use the existing reasons instead: the chat is no longer on this host, or the terminal has exited. * End the panel above the composer in terminal-hosted chats too A terminal's chat view still mounted the orchestration panel over the whole chat, so it covered that view's composer and send button. Both chat hosts now wrap their transcript in the same frame, which takes the panel's props. * Show only an agent's own words as a crew row's latest message Besides failure notices, the latest line could pick up an empty setup receipt (a blank line that also moved the row) or a lifecycle message Orca rewrote to "Orca rejected this worker_done: ...". The panel's query now admits only conversational types with a body and without the lifecycle rejection marker, before choosing each peer's latest. * Keep worker launch stages out of crew rows and Details A row with no message fell back to the worker's internal launch stage ("input accepted", "worker report queued") as its second line, and Details repeated it as Progress. The row now has no second line until the agent says something, and Details drops Progress; the status icon already shows the state. * Give the recipient-authority test's history message a body The panel no longer admits empty-body messages as a row's latest; the test's history message now carries the words a peer would send. * Clip the chat's orchestration panel to its transcript In a short split or under a tall composer, the transcript can be shorter than the panel's header, which then painted over the composer. The chat frame now clips the panel to the transcript; terminals are unchanged. * Translate the crew row Open failure toasts The crew's Open failures were English literals. They now go through translation, and a gone or outdated chat uses main's existing texts. * Translate the crew row Open fallback for agents without a target * Put the Orchestration panel behind an experimental setting, default off Settings > Experimental > Orchestration panel (experimentalOrchestrationPanel). Off mounts nothing: the chat frame, the terminal-hosted chat's identity lookup and the terminal pane portals all gate where they mount, and toggling applies live without remounting the transcript. * Give the terminal-hosted chat's panel its own module * Leave the setting-off path exactly as on main The message card's avatar and its single-sender hook are back to main's code; the panel keeps its own list hook. The panel's code now loads only when it first mounts, behind the setting. * Keep main's abort reason and send-failure handling for every web subscription * Build the panel tests' settings from defaults instead of a cast * Load the panel with plain lazy so a failed load never retries or reloads the app * Let a failed panel load try again the next time the panel mounts
…stablyai#37356) * feat(settings): delete imported terminal themes from the theme picker * fix(settings): theme delete reads latest settings, undo keeps later choices, focus stays in picker * fix(settings): serialize theme deletes and keep later edits on undo * fix(settings): theme delete button visibility on a wrapper, not a Button restyle
…stablyai#33254) * feat(settings): preview each font in its own typeface in font pickers * perf(settings): skip offscreen font rows so opening the picker loads only visible fonts * fix(settings): keep symbol font names readable in font pickers * fix(settings): size skipped font rows by their content box --------- Co-authored-by: Neil <neil@stably.ai>
* test: remove 20 low-value test declarations * test: prune allowances for removed Git profiling suite --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
…i#34836) * Add scoped terminal identity acquisition and preserve crew source wakes * Share raw crew identity inputs through scoped production readers * Exercise crew generation retirement through actual source owners * Retire crew inputs on consumed ownership and visibility writes * Use typed crew mutation and fixture access * fix: use owned crew styles and committed render counters * Repair crew fixture and RPC type contracts * Align crew fixtures with pane and mention contracts * Count crew consumer render attempts in the fixture * Localize crew panel labels and details * Align crew integration fixtures and RPC parameter contracts * Keep mention contracts within their compiler boundaries * Encapsulate terminal identity mutations and captured reader contracts * Seed terminal identity fixtures through canonical mutations * Complete crew panel English catalog entries * Fix terminal identity fixture return type * Cover terminal identity lifecycle schedules * Align terminal fixtures with canonical identity sources * Repair runtime fixture source contracts * Use checked database fixtures for federation contracts * Update crew source inventories and exit fixtures * Preserve crew setup outcomes at existing subscription owners * Match managed restore fixture to its nullable async return type * Keep absent setup observations distinct from undefined failures * Drive pending Crew questions from existing metadata * Preserve nested pairing repair outcomes for shared callers * Route attached workers to explicit local recipients * Type Crew pending-question measurement receipts * Match SSH repair fixture target absence to store contract * Repair composer fixture and consolidate crew English catalog * Add finite crew subscription boundary candidates * Isolate crew portal in terminal file drop fixture * test: use checked property access for crew owner assertions * Consolidate web runtime auth type imports * test: type crew API legacy arguments and pending results * Bound cold terminal layout construction and finite pane acquisition * test: use public runtime identity in pane acquisition fixture * Follow image reference module relocation in mention serializer * Avoid repeated searches in cold workspace layout loading * Verify cold loader fault identity and hook claimant effects * Revert "Route attached workers to explicit local recipients" This reverts commit f1335d1. Keep attached workers on the existing Run-home routing path for this change. * Omit crew peer addresses outside the active home route * Align crew disclosure and availability with shared UI * Keep crew retries on the verified runtime session * Bound cold layout retirement and recorded-key construction * Verify original cold layout failure identity * fix: preserve surviving layout split references * test: use typed retirement instrumentation properties * Keep crew overlay inside narrow panes * Resume Crew streams on verified runtime sessions * test: preserve pane and retirement fixture contracts with checked types * Prepare Crew record admission and wake identity changes * Derive Crew recipient actions from current target owners * Keep nested Crew process facts within selected acquisition * Defer Crew legacy facts to consumers and complete raw coverage on success * Use deterministic time in Crew command fixtures * Restore pane-local Crew menu dismissal focus * Document schema-owned Dispatch row assertions * test: align Crew authority fixtures with typed project boundaries * Cover menu agent mentions through production insertion paths * test: place Crew CLI integration in cross-surface project * Type retained identity test meters with canonical source maps * test: adapt mounted Crew fixture to Run unbind contract * Document suffix Dispatch row boundary and preserve fixture unbinding * Close crew menus when their terminal pane hides * Remove unused structured activity component * test: migrate Crew authority arguments and mailbox observations * Forward native pane visibility to crew menus * Keep rich draft offsets aligned with agent references * Preserve later explicit pane selection after Mention delivery * test: check the complete overlay focus host fixture * test: use the DOM containment contract for menu focus * Fix pointer dismissal enrollment and modal permission * Remove shared menu primitive patches * Reuse message avatars in the crew panel * Focus the captured input when Mention is pressed * Test the exact Mention all worker selection * Derive Crew attention and actions from complete recipient authority * test: repair Crew avatar store fixture and operation accounting * Keep selected references structural during paste projection * Fix Crew public-command fixture type contracts * Align Crew fixtures with runtime reader and routing contracts * Keep shared message avatar glyphs at their declared size * fix: preserve existing native mention separators * Narrow receiving fixture calls to unary RPC methods * test: load crew Open sender before test execution * test: consolidate pasted text value imports * test: supply crew avatar panel mention contract * Age pending question fixtures from every actual answer timestamp * test: give mounted mention fixture a portable return type * Complete Crew public-command workspace fixture result * Test delegated helper follow-up through Crew advertised address * Qualify Crew follow-up addresses through shared command admission * Complete finite follow-up authority and lifetime evidence * Assert exact remote authority acquisition error identity * Consolidate Crew SQL test fixture imports * Trim Crew panel tests to the high-impact set Keep one mounted test per panel flow, the review-found regressions (avatar glyph size and attribution, stable labels, unavailable sending, hidden-pane menus, navigation remedies), the real producer-to-hook contract, cross-version refusal and recovery, and one N vs 10N contract per scaling piece. Remove permutation matrices, focus-timing proofs, and the duplicated web API and attempt suites. * Trim Crew Mention tests to the high-impact set Keep the native and terminal Mention flows, the review-found regressions (send and Goal serialization, label collisions, offsets and handback, Mention-all membership, press-time focus, late write responses, the native double space), the provider delivery contract, and the serializer N vs 10N bound. Remove menu and boundary permutation matrices, panel duplicates, recall and paste cases covered elsewhere, and the retained-group selection fixture. Panel-test cuts mirror the lower PR's so the stack merges cleanly. * Trim Crew read-model tests to the high-impact set Keep the real CLI/RPC/database command paths, one regression per review-found bug, the cross-version contracts and one N vs 10N operation contract per scaling piece. Drop permutation matrices, equivalence oracles, near-duplicate scenarios and diagnostic output, and return the SSH, managed-server and WSL test files to main, since their production changes were reverted earlier in this PR. * Drop diagnostic output and a duplicate error case from Crew tests Remove two leftover console.log diagnostics, an unused 2x2 sample matrix and unused return fields in the follow-up cost contract, and the subscription AbortError serialization case that the subscription identity and preload tests already cover. * Pass the recorded-leaf reader in main's check-details loader test * Build the approved orchestration panel design Closed tab: panel icon, lineage icon with the worker count, then agents grouped by status (needs you, working, idle, failed) with the sidebar's status icon, up to three overlapping agent icons and +n. Rows are one card with the task, the latest message or question, the relative time and Details, Open, More. Rows sort by latest message. The open panel reaches the pane top under the title strip. No user-visible 'crew' text; counts use plurals. One store subscription resolves every row's live sender state so the tab and the rows agree. * Keep pane title buttons above the orchestration panel; tick row times The open panel now sits just below the pane title strip in stacking order and starts at the pane top in every host, so the strip's buttons draw over its top band and no chat or terminal text shows above it. An open panel lifts its pane's drag strip above it. Row times re-render on the sidebar's shared 30s clock. Each status group keeps one fixed icon, and the panel's needs-you count has its own plural. * Move the orchestration row into its own file * List every status case in the orchestration icon switches * Name the orchestration row 'Mention <agent>:' while keeping its status, task and message * Use the outline xs Button as is for Mention all * Subscribe the memoized orchestration row to language changes; type the listener count * Fit the orchestration tab and avatar stack to main's Button and key lint rules * Ship the orchestration panel's plural counts in the runtime English catalog * Subscribe the memoized crew row to language changes; read the nullable listener count * Ship the orchestration panel's plural labels in the boot catalog * End the chat's orchestration panel above the composer The panel overlaid the whole chat body, so with it open the composer's send button sat underneath it. The frame now wraps only the transcript; the queued drafts, prompt cards and composer stay where main puts them. * Skip escalations when choosing a crew row's latest message Orca writes its failure notices (a worker stopped without reporting, a chat agent error, a terminal exit) as the worker's own escalation, with terminal, task and dispatch IDs and CLI syntax meant for the coordinator agent. The panel showed that text as the row's second line. Only the panel reads this query, so escalations are skipped there and the row shows the agent's last real message. An agent's own Blocked escalation is skipped too; it still reaches the coordinator's inbox. * Point Mention's tests at the modules main moved Main moved the composer command, send mutation and Claude dispatch content modules; two of this PR's test files still imported the old paths and failed to load. Also drop a mock of a module main removed. * Say why a crew row's agent can't be opened Opening a row whose agent is gone showed "This agent is no longer available." Use the existing reasons instead: the chat is no longer on this host, or the terminal has exited. * End the panel above the composer in terminal-hosted chats too A terminal's chat view still mounted the orchestration panel over the whole chat, so it covered that view's composer and send button. Both chat hosts now wrap their transcript in the same frame, which takes the panel's props. * Show only an agent's own words as a crew row's latest message Besides failure notices, the latest line could pick up an empty setup receipt (a blank line that also moved the row) or a lifecycle message Orca rewrote to "Orca rejected this worker_done: ...". The panel's query now admits only conversational types with a body and without the lifecycle rejection marker, before choosing each peer's latest. * Keep worker launch stages out of crew rows and Details A row with no message fell back to the worker's internal launch stage ("input accepted", "worker report queued") as its second line, and Details repeated it as Progress. The row now has no second line until the agent says something, and Details drops Progress; the status icon already shows the state. * Fit both chat hosts under the line limit after the frame merge Name each host's existing Mention availability once and pass it in the frame's one-line crew props. * Mention each agent once per chat draft Mention all after a row Mention added a second chip for the same agent. Inserting references now skips agents already in the draft or repeated in the list; a repeat row click just focuses the composer. Terminal Mention types text and is unchanged. * Test a row Mention followed by Mention all The QA sequence is two separate inserts; cover the draft scan that keeps the first agent from being added again. * Give the recipient-authority test's history message a body The panel no longer admits empty-body messages as a row's latest; the test's history message now carries the words a peer would send. * Clip the chat's orchestration panel to its transcript In a short split or under a tall composer, the transcript can be shorter than the panel's header, which then painted over the composer. The chat frame now clips the panel to the transcript; terminals are unchanged. * Check a terminal's readiness when Mention is pressed The panel read the terminal's connection once while rendering. A restored pane connects later without a re-render, so its rows and Mention all stayed disabled. Mention is now available whenever the pane has a terminal, and the pane and connection are captured and checked when the user presses it. * Keep a row's status at full strength when it can't be mentioned A row that couldn't be mentioned dimmed everything on it, including another agent's "Waiting for you" line. Its content now stays as is; only the hover highlight and pointer cursor go away. * Translate the crew row Open failure toasts The crew's Open failures were English literals. They now go through translation, and a gone or outdated chat uses main's existing texts. * Translate the crew row Open fallback for agents without a target * Put the Orchestration panel behind an experimental setting, default off Settings > Experimental > Orchestration panel (experimentalOrchestrationPanel). Off mounts nothing: the chat frame, the terminal-hosted chat's identity lookup and the terminal pane portals all gate where they mount, and toggling applies live without remounting the transcript. * Give the terminal-hosted chat's panel its own module * Leave the setting-off path exactly as on main The message card's avatar and its single-sender hook are back to main's code; the panel keeps its own list hook. The panel's code now loads only when it first mounts, behind the setting. * Leave /goal and ordinary sends exactly as on main A typed multi-line /goal is prose again, as on main; only Mention's own routing lines after a one-line /goal join its objective. A draft with no agent reference skips the reference serializer, so its send text is projected once, as before. The routing line format now lives with the other reference formats. * Keep main's abort reason and send-failure handling for every web subscription * Build the panel tests' settings from defaults instead of a cast * Load the panel with plain lazy so a failed load never retries or reloads the app * Keep main's /goal parser and put a goal's Mention notes on its one line The shared command parser is main's code again, so any typed or pasted text parses as before. A typed /goal or Goal-mode objective with mentions carries its routing notes on the same line instead. * Let a failed panel load try again the next time the panel mounts * Type the queued-edit test's pending send as main's boolean result * Keep a mention's routing notes in Goal mode on hosts without goals There /goal goes to the agent as a message, so its notes keep their own lines, as a typed /goal there already does. A draft with no mention sends main's text. * Give the lazy panel test the Mention props this branch's panel requires
… per-mode terminal themes (stablyai#37368) * feat(settings): import Ghostty themes, including light/dark pairs, as per-mode terminal themes * fix(settings): keep Ghostty theme re-imports stable and explicit colors when a theme half is missing * fix(settings): reuse identical built-in terminal themes and label Ghostty variants * fix(settings): keep same-named Ghostty theme files apart, import theme divider colors, follow Ghostty lookup order for picked configs
* Rename Chat settings section to Chat UI * Localize Chat UI settings titles * Update chat settings search fallback to Chat UI
…lyai#37420) - Box (ui.catalog 4, since 1.4.248): direction, gap/padding/paddingX/ paddingY/margin on the gap scale, align, justify, wrap, grow, shrink, width/height/min/max (px up to 4096 or whole percents), columns, scroll, border (true or a tone), radius, background (theme surfaces or tone tints). Strict props: hex colours, CSS lengths and unknown props are dropped with a warning like other components. - Renderer maps props to theme tokens through data attributes; sizes reach inline style only as validated px or percents. - Typings, docs, skill references, gallery Layout tab; orca/testing finds Boxes and summarizes danger or warning Boxes.
… import pipeline (stablyai#37375) * feat(settings): import Kitty configs through a shared terminal config import pipeline * fix(settings): harden Kitty include and value parsing * fix(settings): match Kitty globs linearly, skip read-only system configs, report non-family font selectors * refactor(settings): read current settings through a typed map when diffing imports * style: format Ghostty importer * fix(settings): type the import hook stub and let dialog primitives own their typography
) * Launch an agent with a first prompt from its setup panel The agent setup panel in the new-tab menu gets an optional prompt box above its Launch buttons. It is the chat composer in a compact launch layout: one line that grows to six, Attach as its only control, / listing the launch workspace's skills and commands and @ finding its files. Enter launches the panel's default way, either Launch button sends the prompt its own way, and with nothing typed both launch exactly as before. The prompt rides the existing launch prompt field and is kept in memory only until the launch. * Preserve launch prompt input across submission and refusal * Retain scoped composer submissions through launch ownership * Keep launch prompt tests deterministic during collection and persistence checks * Retire launch source drafts at committed qualified removals * Retain workspace launch setup through ordinary rich drafts * Preserve rich draft authority through accepted setup handoffs * Keep setup prompt moves within current rich draft memory * Create setup drafts on first input instead of on row render Rendering an agent row in the launch menu or search no longer creates a setup record. The row derives its scope from its workspace, host and agent without touching session state; the record is created by the first typed prompt, option change or pending attachment, matching main, which kept only authored setups. Catalog applies, readoptions and renames now visit authored setups only. Option listeners use the existing per-scope draft listeners and subscribe only while the setup popover is open. Also return the runtime-status files to main, which only carried leftovers from a removed hook. * Return group-delete draft revocation to main and repair launch tests Deleting a project group no longer retires in-flight setup submissions for its folders: folder keys are never derived again, so it changed nothing users could see. The group mutation, its removal state and the prompt-delivery type widening go back to main's content, with the test that exercised the revocation. Test fixtures catch up with the setup prompt composer: the TabBar window stubs gain event listeners, the picker inventory's mock store gains agent status, create-rejection handbacks expect inComposer, and the folder removal test expects a same-ID survivor's chip to stay, as on main. * Keep each search preset's setup options in its own slot Opening a search result's setup no longer writes its preset over the workspace's setup. As on main, each preset keeps its own options slot, now inside the workspace/host/agent setup, keyed by what the search parsed rather than by defaults; the plain row keeps its own slot. Only a real change saves, into that entry's slot, and creates the setup then. The typed prompt stays one per workspace, host and agent. * Fix the moved agent profiles import and merge duplicate imports Main moved the native chat agent profiles module under shared/native-chat, so the setup prompt composer imports it from there. Files that imported one module twice now import it once; nothing else changes. * Fix the web typecheck for the setup prompt changes The catalog continuity test no longer imports the main process's SSH target reassignment, which pulled the whole main graph into the web program; it builds the reassigned folder inline. Test fixtures and spies now match current types, the edit-session tests pass a composer ref as production does, and the setup panel again accepts callers that return no launch answer. The pending-chip owner filter drops an unused name. No shipped behavior changes. * Show the setup prompt's skill and file lists above the setup panel In the agent setup popover, the / and @ lists opened underneath the panel, so they could not be seen or clicked. A list opened inside a popover now takes the menu layer that selects and dropdowns already use above popovers; an ordinary chat's lists keep their container and layer. The prompt placeholder is translated in every locale, and folder draft continuity takes the fetched catalog itself instead of reading its folder list field. * Fit the setup prompt box to a placeholder that wraps With a longer translation, the empty setup prompt's placeholder wrapped to a second line that the one-line box cut off. The empty launch prompt now lets its placeholder's wrapped height count, so the box fits it; English still fits one line, and an ordinary chat's box is unchanged. * Type the submit test's pending sends as the boolean main now returns * Show the dictation button in the agent setup prompt * Update draft test handle for agent references
* Show the open orchestration panel as a floating card The open panel now floats in the closed tab's corner as a card as tall as its rows. In chats it stops above the composer (the transcript frame already ends there); in terminals it keeps the bottom quarter clear for the CLI's prompt and recent output. Past that it scrolls inside. * Keep the orchestration card's collapse button reachable in tiny panes A terminal split can be 50px high, leaving the card no room under the 75% limit, so its header and collapse button were clipped away. The card is now never shorter than its header. * Keep the orchestration card's collapse button inside narrow cards In a narrow split the card is 20px narrower than the pane and its title didn't truncate, so the collapse button was pushed past the card's edge. The title now truncates and the header's side padding gives way before the button, down to the 50px pane minimum.
* fix(native-chat): an open chat moves to the account you switch to before its next message A running chat's agent read its account only when it started, and nothing compared it with the account a start would use now, so open chats kept answering on the old account after a switch. The agent a chat runs now records the account its launch used, and the host's replace-before-the- next-send check replaces an idle one whose account is no longer what a start would use. A chat mid-reply finishes on the old account first. Claude chats follow; agents whose chats keep the account they were created on are never compared. A chat's model-list reads and saves now use the account it runs on, so a moved chat no longer writes its new account's list under its first account (STA-11281). Tracked in STA-11211. * fix(native-chat): declare the launch-account read for the runtime layer that wires the host * fix(claude): find custom chat history before managed-account resume * test(claude): assign the complete custom account home * feat(native-chat): offer account switching and hand-off at usage limits * fix: track the provider in account-list reload effects * fix(native-chat): target recovery actions at the chat host and transcript * fix(native-chat): verify account recovery for each chat on its host * refactor(native-chat): retain the existing image-support result * fix(native-chat): withdraw account recovery after failed eligibility reads * fix(native-chat): leave unavailable recovery facts absent * Align Japanese usage-limit recovery copy with catalog convention * Preserve complete chat context through usage-limit recovery * Keep Continue callback focus optional * Keep recovery fixtures and account effects type safe * Keep chat recovery on native sources and native accounts * Validate native recovery files after path admission * Use the optional cursor shape in recovery fixture * fix(native-chat): exclude source CLI family from limit handoff * Resolve recovery context in the owning workspace directory * Add the continue-at-usage-limit-reset setting and its chat row lines * Continue chats automatically after usage limits reset * Fix automatic continuation fairness, lifecycle and host settings * fix: bind automatic continuation withdrawal to accepted actions * fix: withdraw source auto continuation after handoff starts * Read unopened chats with the saved-record reader for usage-limit continue Unopened chats were read through the raw-row replay, which no longer sees chats saved as keyed records, so a usage-limited chat that was not open was never continued after its reset. Read them the way the rest of the app reads a chat without opening it. Also use the shared visible-tab check, keep the ordinary rewind result without a sequence as main does, and adapt two tests to the current queued-message and saved-status behavior. * Keep a usage-limited turn idle after any rewind restores it Rewind completion read the resulting conversation through the raw-row replay, which no longer sees chats saved as keyed records, and a forked rewind wrote its completion before the new history's records. So a limited turn that a rewind brought back was continued automatically after its reset. The completion now reads the saved result the way the app reopens a chat, and the forked rewind writes its completion after the new history in the same transaction. * Type the usage-limit auto-continue test mock without an assertion * Fix type errors from main's settings, failure-wording and refusal changes * Keep ordinary settings replies when the paired host changes mid-call, and list the cancel method in wire contracts Settings reads and writes that don't carry the automatic-continue choice go through the common runtime call again, so a reply that completes after the paired host is removed still merges, as before this change. Only a write of that choice stays pinned to the host it was made for. The structured method count and the cross-version method manifest now include the cancel method. * Keep a stopped turn's automatic continue withdrawn when its usage limit arrives later A person could Stop a running Codex turn, have the turn then end with a usage-limit failure, and still get an automatic "Continue where you left off." after the reset, because Stop had nothing to cancel yet. The journal write that first reveals a limited turn the latest personal Stop owns now saves the same exact cancellation in that transaction, and a Stop accepted just after the limit landed withdraws it too. Resume, deleting a queued card and restarting keep it withdrawn; manual Continue and later turns are unaffected. * Bound the automatic-continue sweep and keep notice rows from re-rendering The 10-second sweep now does nothing while the setting is off, republishes only chats with a scheduled continuation, reads at most three unopened chats per pass, and keeps going when one chat's saved history can't be read (that chat is retried after the others instead of stopping every chat on the host). Settings writes republish only when the switch changes. Working out the usage-limit cut no longer indexes the whole conversation on every streamed row. The chat's notice rows no longer re-render for status changes they don't show. Adds operation-count and render-count tests for these bounds. * Test that streamed journal commits after a Stop scan no history and build no command index Drives real Codex rows through the host at 20 and 200 history rows: each streamed commit runs the Stop's commit hook and the status projection's cut reader with no newest-turn scan, no render and no full command index; the next turn end scans once and renders nothing. * Leave a usage limit manual once its reset passed more than a day ago Turning automatic continue on later no longer sends into chats whose limit reset days ago. Eligibility, which the row's summary, the sweep and the pre-send recheck all read, now requires the reset to be within the last 24 hours; older limits show the usual manual actions and are never continued unasked. * Show only manual actions for a usage limit Orca can never continue A limit more than a day past its reset is never continued, but its row still showed the setting link, inviting people to turn on a switch that could not help that chat. One shared check now decides whether a cut can ever be scheduled; the status summary and the sweep's eligibility both use it, so past the bound the row keeps only Continue Now, Hand Off and Add Account. A row already on screen when the day passes drops the line on the shared minute clock; the host alone decides sends. * List every journal row kind in the Stop cut filter The type-aware lint requires exhaustive switches; epoch, tombstone, submission and queue rows still cannot reveal a cut. * Type the status-subscription mock instead of casting its handler The changed-code casting gate rejects type assertions; the mock now carries the real subscription signature, so the recorded handler is typed. * Open store-less conversations without the Stop withdrawal hook Acquisition-only opens have no record store, so a person's Stop followed by a limited turn end made the journal commit throw and drop the turn end. Install the withdrawal only when a store exists; without one there is no continuation to withdraw. Also narrow the status summary before reading it and type the sweep test's send mock.
Grok Build can keep an idle OSC title and ready composer while background tasks are still active. Coordinators that use `terminal wait --for tui-idle` as task-complete evidence then advance early. Suppress idle resolution when the wait-text still shows Grok-style background task HUD chrome. Fixes stablyai#9905
innocarpe
force-pushed
the
fix/tui-idle-grok-background-tasks
branch
from
November 2, 2026 09:57
5ea10d9 to
4851e61
Compare
nwparker
added a commit
that referenced
this pull request
Nov 15, 2026
stablyai#41288) Structured image sends replace inline composer chips with `[Image #N]` tokens for the provider prompt, which left sent `[Image #N]` markers visible in user message bubbles, copied text, rail/outline previews, and row height estimates. Strip in-range `[Image #1..imageCount]` markers across user message display, copy text, row height estimation, and rail/outline previews while preserving literal markers past `imageCount`, in quoted file references, or inside inline backticks and fenced code blocks. Fixes stablyai#32727 Co-authored-by: lurunzi <lurunzi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream
Summary
Grok Build can look idle while background tasks are still running. Suppress
terminal wait --for tui-idlesuccess when Grok-style background HUD chrome is present.Note
Do not merge this into
innocarpe/orcamain until the upstream PR is merged (then sync fork fromstablyai/orca).This open PR exists so visitors can see my in-flight work on this fork's Pull requests tab.