Skip to content

Improve update experience: toasts, graceful restart, sidebar indicator - #14

Merged
nwparker merged 1 commit into
mainfrom
nwparker/update-crash
Mar 22, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/update-crash

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Summary

  • Toast notifications: Menu > Check for Updates now shows a loading toast → success/error result (auto-checks on launch stay silent). When an update finishes downloading, a persistent toast with "Restart Now" action appears.
  • Fix macOS crash: Gracefully destroy all windows before calling autoUpdater.quitAndInstall() to prevent the "quit unexpectedly" dialog on macOS.
  • Sidebar update indicator: Show a tinted "Restart now (update)" / "Downloading v…" banner above the Add Repo button in the sidebar toolbar when an update is available.
  • Shared state: Moved updateStatus from Settings-local state to Zustand UI slice so both sidebar and settings can read it.

Test plan

  • Menu > Check for Updates shows "Checking..." loading toast, then "You're on the latest version" success toast
  • When an update downloads, sidebar shows "Restart now (update)" banner and a persistent toast appears
  • Clicking "Restart Now" (toast or sidebar) restarts without macOS "quit unexpectedly" dialog
  • Settings > Updates section still works correctly (reads from store)
  • Auto-check on launch does NOT show toasts when already up to date

🤖 Generated with Claude Code

- Add sonner toast notifications for menu-triggered "Check for Updates"
  with loading → success/error flow (auto-checks stay silent)
- Fix macOS "quit unexpectedly" crash by gracefully destroying windows
  before calling autoUpdater.quitAndInstall()
- Add update available/downloaded banner in sidebar toolbar footer
- Move updateStatus to Zustand store for global access (Settings now
  reads from store instead of local state)
- Replace native dialog feedback with renderer-side toasts throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nwparker
nwparker merged commit 234c422 into main Mar 22, 2026
Jinwoo-H added a commit that referenced this pull request May 4, 2026
…reamble+ask, QoL (#1403)

* feat(orchestration): transport keepalive + delivered_at split for check --wait

Implements the four §3 fixes from the check-wait design doc:

- §3.1 Transport keepalive: long-poll RPCs (orchestration.check --wait) emit
  `{"_keepalive":true}` frames every 10s so neither server nor client tears
  the socket down on idle. A `longPoll` admission counter capped at 16 fails
  fast with `runtime_busy` when saturated; an AbortController wired through
  the RPC dispatcher cancels the inner waiter the moment the socket closes.
- §3.2 delivered_at split: push-on-idle now stamps `delivered_at` instead of
  flipping `read`, so the check caller remains the sole consumer of its
  queue. Adds a synchronous idempotent schema migration that hard-fails on
  error.
- §3.3 inbox/check parity: `orchestration inbox --terminal <handle>` and
  `orchestration check --all` agree on the same rows (sequence DESC, no
  mark-read). `check --unread=false` kept for one release as a compat shim.
- §3.4 CLI heartbeat: `orca orchestration check --wait` emits JSON heartbeat
  lines to stderr every 15s so Claude Code's Bash tool sees continuous
  output and doesn't auto-background the subprocess.

Tests: extends runtime-rpc, orca-runtime, envelope-schema, orchestration
method, and formatter suites; adds a subprocess test that spawns the built
CLI and verifies stderr line-flushing, heartbeat cadence, and stdout
cleanliness end-to-end.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): preamble rules + heartbeat schema

- Preamble (#7, #15, #9): worker_done body ("3-sentence summary" + reportPath),
  BEHAVIOR RULE #1 forbidding AskUserQuestion, heartbeat every 5 minutes with
  taskId+dispatchId payload, AFTER YOU SEND grace window.
- Schema v2 migration: adds 'heartbeat' to messages.type CHECK, adds
  dispatch_contexts.last_heartbeat_at, gated by user_version PRAGMA with
  transactional rebuild + explicit CREATE INDEX to avoid silent perf regress.
- DB helpers: recordHeartbeat (dispatched-only), getStaleDispatches,
  getThreadMessagesFor (thread+handle scoped for ask).

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): coordinator heartbeat + stale detector

Handle incoming 'heartbeat' messages by calling recordHeartbeat keyed on
payload.dispatchId (strict — log-and-skip if missing, no taskId fallback so
a straggler heartbeat from a previously-failed dispatch cannot mask a hung
retry per §5.3.4). On every tick after the 10-minute threshold, emit one
log per stale dispatched row — no auto-fail.

Also threads dispatchId through buildDispatchPreamble so workers can
attribute their heartbeats back to the correct dispatch context.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): orca orchestration ask verb

Adds a CLI verb that sends a decision_gate message and blocks on the
coordinator's reply, scoped to the outbound message's thread. Group
addresses (@ALL, @idle, …) are rejected — fan-out questions must use
send --type decision_gate explicitly.

--json emits bare single-line JSON (bypassing printResult) so workers can
pipe `orca orchestration ask … --json | jq -r .answer` without unwrapping
an RPC envelope; human mode prints just the answer. On timeout the verb
exits 1 and returns {answer: null, timedOut: true}.

This is the CLI surface BEHAVIOR RULE #1 in the dispatch preamble points
workers at instead of AskUserQuestion.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): QoL bundle — preamble visibility, status enum, dispatch cross-ref, inbox --full

Addresses four items from ORCHESTRATOR_FEEDBACK:

- #5 preamble visibility: `dispatch-show --preamble` regenerates the preamble
  text for a task; `dispatch --inject --dry-run` previews without mutating
  state; `dispatch --return-preamble` echoes the injected preamble in the JSON
  response so coordinators can audit what a worker received.
- #6 status enum validation: CLI rejects unknown `task-update --status` values
  with `invalid status '<x>', expected one of: pending, ready, dispatched,
  completed, failed, blocked` before the RPC's generic Zod message. Valid
  statuses are listed under Notes in `task-update --help`.
- #13 task-list dispatch cross-ref: `task-list --json` now includes
  `assignee_handle` and `dispatch_id` for tasks in status=dispatched via a
  read-only LEFT JOIN on dispatch_contexts. Non-dispatched rows keep their
  legacy shape so existing consumers are unaffected.
- #14 inbox body visibility: `inbox --full` prints body + payload verbatim;
  default output is unchanged (id/from/to/subject only).

No DB migrations; join-only change on dispatch_contexts so the sibling
preamble PR's `last_heartbeat_at` column addition will not conflict.

Co-authored-by: Orca <help@stably.ai>

* fix(worktree): prevent stale-base worktree creation and dispatch

Addresses feedback #16 per DESIGN_DOC_STALE_BASE_FIX.md §0. Four v1
components coordinated by a single shared fetch cache on the runtime:

1. Concurrent-fetch-with-gate in UI create path: `createLocalWorktree`
   fires `git fetch` BEFORE the suffix loop / PR probe / path
   resolution, then awaits right before `addWorktree` so the new branch
   always spawns from a fresh remote tip. Renderer sees a two-phase
   spinner via the new `createWorktree:progress` IPC event. The cache
   is a `Map<repoPath::remote, Promise<void>>` + 30s success-only
   timestamp on `OrcaRuntimeService` (§7.1 — shared with dispatch).
2. Dispatch pre-flight drift guard in `Coordinator.dispatchTask`:
   probes `rev-list --left-right --count` against the target worktree
   and silently returns (preserves `ready`, no circuit-breaker burn)
   when `behind > 20` unless the task spec carries
   `allow-stale-base: true`. Parsing strips the flag so it never leaks
   into the worker's `--- TASK ---` block.
3. Preamble drift section: populated only when dispatch detected drift.
   Workers see `--- BASE DRIFT ---` with the N-most-recent subjects
   they don't have, so they can pull them in before running.
4. §3.3 Lifecycle: `.finally()` evicts Map entries on BOTH success and
   rejection; timestamp is written ONLY on success. Prevents a single
   DNS hiccup from wedging every future create on the repo until
   restart, and keeps the freshness window honest.

Defers the DB `allow_stale_base` column (§0.2) and the create-time
warn toast; both can layer in later without migration.

Tests: 35 new/updated unit tests covering drift preamble, dispatch
refusal, spec-text flag parsing, fetch Map eviction after rejection,
freshness-window short-circuit, and concurrent-caller serialization.

Co-authored-by: Orca <help@stably.ai>

* test(orchestration): seed v2 DB in migration hard-fail test

After consolidating the schema bump, fresh DBs are initialized directly at
v3 via createTables(), so the v2→v3 ALTER TABLE is skipped on new installs
and the prior test's stub never fired. Seed a v2-shape file on disk so the
guarded ALTER actually runs and the "simulated migration failure" stub
propagates as intended.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
Jinwoo-H added a commit that referenced this pull request Sep 4, 2026
Jinwoo-H added a commit that referenced this pull request Sep 4, 2026
Jinwoo-H added a commit that referenced this pull request Sep 4, 2026
scolety1 added a commit to scolety1/orca that referenced this pull request Sep 10, 2026
…the revalidation checklist

Extends Lane H's structural/metamorphic coverage with a STATIC
counterpart to finding stablyai#14's DYNAMIC (timing-based) TOCTOU fix in
server/command-adoption-execution.mjs.

Exhaustively (2x2x4 = 16 combinations, not sampled) proves
revalidateCommandAdoptionCandidate's own PROJECT_EXECUTION_HOLD_ACTIVE
refusal can never be silently masked by any combination of
worktreeResolved/worktreeClean/ancestry facts, when every earlier check
in the priority chain would otherwise pass.

Deliberately narrow and non-circular: does not re-implement the
function's own branching order as a parallel oracle (the self-
referential trap Lane A's own matrix test caught and corrected earlier
tonight) -- only asserts one specific, safety-critical invariant holds
across variation in fields that must never override it.

Mutation-verified: moving the hold check to run after the worktree/
ancestry checks (instead of before) reproduces a real failure -- a
held project with UNKNOWN ancestry would incorrectly report
CANDIDATE_ANCESTRY_UNKNOWN instead of PROJECT_EXECUTION_HOLD_ACTIVE --
while every pre-existing single-condition example test stayed green,
confirming this property catches a real gap those examples miss.
Restored and reconfirmed 119/119 green across both adoption-execution
test files.

TSF Overnight Control-Plane Burn-In V2, Lane H.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CdU7C6R8tKG5diqfdjNCPp
scolety1 added a commit to scolety1/orca that referenced this pull request Sep 11, 2026
Documents the fresh 2-pass stability sequence run after finding stablyai#18
reset the counter: 3 consecutive real OOM kills (runs stablyai#13/stablyai#14/stablyai#15,
each retried per the owner's own explicit >95%-used-only memory rule,
never blindly), then Pass stablyai#1 (run stablyai#16, PASS) and Pass stablyai#2 (run stablyai#17,
PASS -- 2 new-signature failures isolated-confirmed clean, 7/7,
before being accepted as resource-contention artifacts, never
hand-waved). Updates the session-status header, §12 stability
declaration, §13 SHA ledger, §17 next-highest-value work, and the
terminal declaration block to reflect STABILITY_PASS = 2 of 2 at
current tip SHA c51e61c.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CdU7C6R8tKG5diqfdjNCPp
scolety1 added a commit to scolety1/orca that referenced this pull request Sep 11, 2026
Re-confirmed by direct code reading (not just citing the prior
mission's own finding stablyai#13 disclosure): server/self-improvement-
adoption.mjs's attemptRepairAdoption had NEITHER of command-adoption-
execution.mjs's own two real safety properties -- (1) no per-project
lock around its read-readiness-then-merge sequence (the exact TOCTOU
shape findings stablyai#12/stablyai#14 fixed on the main path), and (2) zero project-
execution-hold awareness at all (a real, active hold an operator set
specifically to stop work on a project was silently ignored, never
checked).

Fixed by reusing the SAME proven primitives directly -- no new
mechanism:
- Exported withAdoptionLock from command-adoption-execution.mjs.
  attemptRepairAdoption now wraps its entire body in it, keyed by
  finding.projectId ?? missionId -- the SAME lock path convention the
  main path uses, so a main-path adoption and a self-improvement
  repair adoption for the SAME project correctly serialize against
  EACH OTHER too, not just against themselves.
- assessRepairAdoptionReadiness gains a holdActive parameter (default
  false, backward compatible), folded into its existing blocker list.
- A fresh hold re-check runs immediately before the real merge,
  mirroring the main path's own exact pattern -- catches a hold that
  appeared while the several awaited git subprocess round-trips were
  still in flight, refusing on current state, never stale state.

Real bug caught and fixed during this fix's own verification: a
missionId can contain colons (e.g. "mission:selfimprove:fixture"),
invalid in a Windows file path segment -- adoptionExecutionLockPath
now sanitizes its key. Live-reproduced (ENOENT) before fixing, not
guessed.

5 new regression tests covering the owner's own explicit test list:
competing adoption (real mutual exclusion via the shared lock),
cross-engine lock (main-path + self-improvement serialize against each
other), hold appears mid-flight, hold already active upfront, and the
colon-safe lock-key fallback. Mutation-verified: disabling the fresh
hold re-check reproduced exactly 1 new test failing, 0 others. 126
relevant tests clean (self-improvement-adoption /
self-improvement-adoption-readiness / command-adoption-execution /
self-improvement-adoption-authorization-gate).

Autonomous self-improvement adoption stays DISABLED throughout -- this
makes the path correct and consistent with the main path's own safety
envelope for whenever it IS reachable; the GATE_CLOSED check,
unchanged, still runs first and still blocks every real production
path today.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CdU7C6R8tKG5diqfdjNCPp
gaberudy added a commit to goldenhelix/vsagent that referenced this pull request Sep 12, 2026
Ported the VSAgent brand mark and the CLI help-text rebrand seam, plus one
package.json script addition, per B5 (stablyai#6, stablyai#8, stablyai#9, stablyai#10, stablyai#14):

- resources/vsagent.svg: net-new flat SVG logo (blue #068AFE mark), copied
  verbatim from the fork (no upstream collision).
- src/renderer/web-index.html: title -> "VSAgent"; inlined SVG favicon (data:
  URI, base64) since `orca serve`'s static handler only exposes
  /web-index.html and /assets/*. Re-derived the base64 from this commit's own
  resources/vsagent.svg (base64 -w0) rather than copying the fork's literal
  string, then diffed byte-for-byte against the fork's inlined value to
  confirm they match exactly.
- src/renderer/src/assets/main.css: added the 9-line `.titlebar-brand-logo`
  rule immediately after `:root:not(.dark) .titlebar-logo { filter:
  invert(1); }` — the VSAgent mark is full-color and must not be inverted in
  light mode the way the monochrome Orca mark is.
- src/cli/help.ts: added `brandHelpText()` (rewrites /\bOrca\b/ and /\borca\b/
  when VSAGENT_BRAND_CLI=1) and wrapped all 3 printHelp() console.log sites
  with it. printHelp's shape and the ROOT_HELP_TEXT_PRIMARY/SECONDARY split
  (upstream's own refactor, unrelated to this bucket) were untouched.
  VSAGENT_BRAND_CLI is the same seam name S15/B2's formatRuntimePairingOffer
  reads and B6's scripts/vsagent-cli launcher sets — not renamed here.
- package.json: added "smoke:web": "node tests/web-client-smoke.mjs" next to
  "smoke:computer" (script backing file lands with B6/S38-S39; the entry is
  inert but harmless until then). Left "name": "orca" and "version": "1.4.197"
  untouched per Q7 — vsagent-next tracks upstream's version, not the fork's
  0.6.10.

Did not touch root-help-text-primary.ts/-secondary.ts (S15's pairing-url
content) or notification-permission-probe.ts/startup-notification-
registration.ts (left unbranded per Q9).

Verification: corepack pnpm tc (tc:node/tc:cli/tc:web) clean; brandHelpText
sanity (`Usage: orca foo` -> `Usage: vsagent foo` only when
VSAGENT_BRAND_CLI=1, unchanged otherwise); src/cli/handlers/terminal.test.ts
(16 tests, exercises printHelp with no VSAGENT_BRAND_CLI set — unbranded
regression) and src/cli/index.test.ts (27 tests) both pass;
check:code-quality:changed clean (0 findings, 13 changed files);
check:max-lines-ratchet and check:runtime-electron-ratchet both unchanged.

Fork-origin: 6669054

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wekb1M8qsHPobDxMHzoMEZ
sinkerine added a commit to sinkerine/orca that referenced this pull request Sep 12, 2026
scolety1 added a commit to scolety1/orca that referenced this pull request Sep 15, 2026
… -- resolved, verified, adoption status

Moves Findings stablyai#2-stablyai#11 to Resolved with real worktree commit SHAs and live
browser-dogfood evidence (isolated disposable runtime, real owner instance
never touched); re-verifies Findings stablyai#12/stablyai#13/stablyai#14/stablyai#16 as still Good As-Is;
honestly flags stablyai#15 as not independently re-exercised (no active research
mission in the fixture data used) but unregressed (no file in this diff
touches that code path).

Records adoption status: implemented and tested in the isolated worktree,
not yet merged to canonical tsf/main. Discloses three real, pre-existing
gaps found while verifying this batch, none introduced by it: the
Projects-grid LifecycleBadge still computing a separate 8-bucket
vocabulary (Findings stablyai#5/stablyai#11's own "apply consistently everywhere"
requirement, not fully met on that one surface); a divergence between
Command's NEEDS_YOU_QUERY and HQ's own Needs You count (two separate,
pre-existing aggregation systems); and a genuine-directive/question-
awareness gap in domain/command-act-model.mjs's VERB_REGISTRY decomposer,
found via a real Codex adversarial-review dispatch and independently
re-verified live (a question like "Should I put X on hold?" can set a
real hold) -- pre-existing across the whole mechanism, not specific to
this batch's own two new hold-phrase additions, and out of scope for a
UI-findings batch to fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CdU7C6R8tKG5diqfdjNCPp
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
stablyai#14)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…reamble+ask, QoL (stablyai#1403)

* feat(orchestration): transport keepalive + delivered_at split for check --wait

Implements the four §3 fixes from the check-wait design doc:

- §3.1 Transport keepalive: long-poll RPCs (orchestration.check --wait) emit
  `{"_keepalive":true}` frames every 10s so neither server nor client tears
  the socket down on idle. A `longPoll` admission counter capped at 16 fails
  fast with `runtime_busy` when saturated; an AbortController wired through
  the RPC dispatcher cancels the inner waiter the moment the socket closes.
- §3.2 delivered_at split: push-on-idle now stamps `delivered_at` instead of
  flipping `read`, so the check caller remains the sole consumer of its
  queue. Adds a synchronous idempotent schema migration that hard-fails on
  error.
- §3.3 inbox/check parity: `orchestration inbox --terminal <handle>` and
  `orchestration check --all` agree on the same rows (sequence DESC, no
  mark-read). `check --unread=false` kept for one release as a compat shim.
- §3.4 CLI heartbeat: `orca orchestration check --wait` emits JSON heartbeat
  lines to stderr every 15s so Claude Code's Bash tool sees continuous
  output and doesn't auto-background the subprocess.

Tests: extends runtime-rpc, orca-runtime, envelope-schema, orchestration
method, and formatter suites; adds a subprocess test that spawns the built
CLI and verifies stderr line-flushing, heartbeat cadence, and stdout
cleanliness end-to-end.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): preamble rules + heartbeat schema

- Preamble (stablyai#7, stablyai#15, stablyai#9): worker_done body ("3-sentence summary" + reportPath),
  BEHAVIOR RULE stablyai#1 forbidding AskUserQuestion, heartbeat every 5 minutes with
  taskId+dispatchId payload, AFTER YOU SEND grace window.
- Schema v2 migration: adds 'heartbeat' to messages.type CHECK, adds
  dispatch_contexts.last_heartbeat_at, gated by user_version PRAGMA with
  transactional rebuild + explicit CREATE INDEX to avoid silent perf regress.
- DB helpers: recordHeartbeat (dispatched-only), getStaleDispatches,
  getThreadMessagesFor (thread+handle scoped for ask).

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): coordinator heartbeat + stale detector

Handle incoming 'heartbeat' messages by calling recordHeartbeat keyed on
payload.dispatchId (strict — log-and-skip if missing, no taskId fallback so
a straggler heartbeat from a previously-failed dispatch cannot mask a hung
retry per §5.3.4). On every tick after the 10-minute threshold, emit one
log per stale dispatched row — no auto-fail.

Also threads dispatchId through buildDispatchPreamble so workers can
attribute their heartbeats back to the correct dispatch context.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): orca orchestration ask verb

Adds a CLI verb that sends a decision_gate message and blocks on the
coordinator's reply, scoped to the outbound message's thread. Group
addresses (@ALL, @idle, …) are rejected — fan-out questions must use
send --type decision_gate explicitly.

--json emits bare single-line JSON (bypassing printResult) so workers can
pipe `orca orchestration ask … --json | jq -r .answer` without unwrapping
an RPC envelope; human mode prints just the answer. On timeout the verb
exits 1 and returns {answer: null, timedOut: true}.

This is the CLI surface BEHAVIOR RULE stablyai#1 in the dispatch preamble points
workers at instead of AskUserQuestion.

Co-authored-by: Orca <help@stably.ai>

* feat(orchestration): QoL bundle — preamble visibility, status enum, dispatch cross-ref, inbox --full

Addresses four items from ORCHESTRATOR_FEEDBACK:

- stablyai#5 preamble visibility: `dispatch-show --preamble` regenerates the preamble
  text for a task; `dispatch --inject --dry-run` previews without mutating
  state; `dispatch --return-preamble` echoes the injected preamble in the JSON
  response so coordinators can audit what a worker received.
- stablyai#6 status enum validation: CLI rejects unknown `task-update --status` values
  with `invalid status '<x>', expected one of: pending, ready, dispatched,
  completed, failed, blocked` before the RPC's generic Zod message. Valid
  statuses are listed under Notes in `task-update --help`.
- stablyai#13 task-list dispatch cross-ref: `task-list --json` now includes
  `assignee_handle` and `dispatch_id` for tasks in status=dispatched via a
  read-only LEFT JOIN on dispatch_contexts. Non-dispatched rows keep their
  legacy shape so existing consumers are unaffected.
- stablyai#14 inbox body visibility: `inbox --full` prints body + payload verbatim;
  default output is unchanged (id/from/to/subject only).

No DB migrations; join-only change on dispatch_contexts so the sibling
preamble PR's `last_heartbeat_at` column addition will not conflict.

Co-authored-by: Orca <help@stably.ai>

* fix(worktree): prevent stale-base worktree creation and dispatch

Addresses feedback stablyai#16 per DESIGN_DOC_STALE_BASE_FIX.md §0. Four v1
components coordinated by a single shared fetch cache on the runtime:

1. Concurrent-fetch-with-gate in UI create path: `createLocalWorktree`
   fires `git fetch` BEFORE the suffix loop / PR probe / path
   resolution, then awaits right before `addWorktree` so the new branch
   always spawns from a fresh remote tip. Renderer sees a two-phase
   spinner via the new `createWorktree:progress` IPC event. The cache
   is a `Map<repoPath::remote, Promise<void>>` + 30s success-only
   timestamp on `OrcaRuntimeService` (§7.1 — shared with dispatch).
2. Dispatch pre-flight drift guard in `Coordinator.dispatchTask`:
   probes `rev-list --left-right --count` against the target worktree
   and silently returns (preserves `ready`, no circuit-breaker burn)
   when `behind > 20` unless the task spec carries
   `allow-stale-base: true`. Parsing strips the flag so it never leaks
   into the worker's `--- TASK ---` block.
3. Preamble drift section: populated only when dispatch detected drift.
   Workers see `--- BASE DRIFT ---` with the N-most-recent subjects
   they don't have, so they can pull them in before running.
4. §3.3 Lifecycle: `.finally()` evicts Map entries on BOTH success and
   rejection; timestamp is written ONLY on success. Prevents a single
   DNS hiccup from wedging every future create on the repo until
   restart, and keeps the freshness window honest.

Defers the DB `allow_stale_base` column (§0.2) and the create-time
warn toast; both can layer in later without migration.

Tests: 35 new/updated unit tests covering drift preamble, dispatch
refusal, spec-text flag parsing, fetch Map eviction after rejection,
freshness-window short-circuit, and concurrent-caller serialization.

Co-authored-by: Orca <help@stably.ai>

* test(orchestration): seed v2 DB in migration hard-fail test

After consolidating the schema bump, fresh DBs are initialized directly at
v3 via createTables(), so the v2→v3 ALTER TABLE is skipped on new installs
and the prior test's stub never fired. Seed a v2-shape file on disk so the
guarded ALTER actually runs and the "simulated migration failure" stub
propagates as intended.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
nwparker added a commit that referenced this pull request Oct 29, 2026
…32355) (#36031)

* fix(native-chat): keep a huge unbroken paste from freezing the chat

A long run with no whitespace ("xxxx…", "0000…", "abab…") wrapped with
kerning makes Chromium reshape it at every line, quadratic in run length:
128 KiB stalls 2.4 s, 1 MiB 19 s, 5 MiB never finishes. ProseMirror forces
that layout on paste and on each keystroke, so the composer freezes in
every terminal-backed chat, including paired servers and WSL. A sent
message stalls the transcript the same way: its fold clips the text but
still lays it all out (128 KiB: 2.5 s).

Runs over 256 characters now render with font-kerning: none, so prose of
any length and Shift+Enter lines keep kerning:
- composer: inline decorations, updated only for the lines a transaction
  touches (a keystroke beside 8,000 decorated lines ~1 ms, not ~190 ms)
- user messages in the transcript and expanded queued cards: the whole
  text when it holds such a run

Text, drafts and what is sent are unchanged. After: 1 MiB single line
84 ms, 5 MiB 312 ms (keystroke 248 ms), 1 MiB of 4000-char lines 50 ms
(was 2.3 s), transcript 128 KiB 80 ms. Worst case left kerned, 256-char
runs: 1 MiB 242 ms, 5 MiB 1.2 s, like 1 MiB of short lines (291 ms).

Fixes #32355

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): keep kerning on long CJK and Thai paragraphs

These scripts have no spaces but Chromium can break between their
characters, so a long paragraph is not one unbreakable run. Count
ideographs, kana, Hangul and Thai as break opportunities so such text
keeps kerning.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): rescan only the edited run, and wait out IME compositions

Splitting one run inside a block of thousands replaced every decoration
in that block, and ProseMirror's removal is quadratic: 1,411 ms for one
space in a paragraph of 8,000 long runs. A change now rescans only from
the run edge before it to the run edge after it, and removes only the
decorations that overlap: ~1 ms for the same edit.

Decorations are only mapped while an IME composition is in progress, so
the composing text node is not re-rendered. The deferred range is
rescanned with the next non-composing change, or on compositionend when
none follows.

The keystroke-timing test is replaced by deterministic ones: unaffected
decorations are reused and the result equals a full scan; a composition
defers the rescan and compositionend runs it.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): never split a CJK code point, and treat NBSP as glue

A supplementary ideograph (U+20000-U+3FFFF) broke a run at its high
surrogate only, so the decoration began on the low surrogate and split
the pair across elements. Both the run scan and the leftward edge scan
now treat the pair as one break.

NBSP joins words for Chromium's line breaker (UAX #14 class GL), so an
NBSP-joined paste is one unbreakable run and must lose kerning; drop it
from the break set. No other non-breaking characters were in it.

Drop a composer test whose coverage the decoration reuse test already
has.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): classify surrogate pairs whole at a rescan's edge

Two lone-surrogate edge cases made the incremental rescan disagree with
a full scan:
- an edit completing a pair at the window start (a lone high surrogate,
  then a pasted low surrogate and run) began the decoration on the low
  surrogate; the window now widens past the whole pair
- a lone low surrogate after any break counted as a pair end, dropping
  it from the run; that now requires a preceding high surrogate

A seeded fuzz also found inclusive decoration edges mapping across a
joined block's boundary, where ProseMirror cannot remove them; the
decorations are no longer inclusive.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

---------

Co-authored-by: Manan Chataut <mananchataut@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant