Skip to content

feat(sidebar): one lifecycle line per workspace in main, with in-progress hints (switch-gated) - #31553

Merged
Jinwoo-H merged 11 commits into
mainfrom
sidebar-p3-lifecycle-queue
Oct 21, 2026
Merged

Jinwoo-H merged 11 commits into
mainfrom
sidebar-p3-lifecycle-queue

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​730 $\color{#cf222e}{\Huge{\mathbf{−}}}$​63 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​667
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​963 $\color{#cf222e}{\Huge{\mathbf{−}}}$​121 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​842

ELI5

When you create, sleep, wake, close or delete a workspace, the desktop's main process now handles those requests one at a time per workspace, in the order they arrived. It also tells the sidebar feed which workspace has something in flight. Before, two clients could ask for opposite things at the same moment (a phone sleeps while the window deletes), and nothing kept them in order.

This only happens when the sidebar build switch is on. It is off on main, so users see no change.

What Changed

One line per workspace (switch on)

  • New WorkspaceLifecycleQueue in main. There is one first-in-first-out line per host and workspace. Commands start in the order they arrived, even when one first has to look up which workspace a name means. A later command waits at most 500 ms for an earlier one's lookup, so a name lookup stuck on a disconnected SSH host cannot stall other workspaces' lines. They run one at a time and are never merged.
  • Delete is accepted at once. It cancels anything still waiting and waits for the command that is running. A second delete with the same options joins the first; one with different options gets today's "Worktree deletion already in progress" error. Deletes by name or path are keyed by the workspace they resolve to, so worktree rm <name> waits for that workspace's running sleep.
  • An answer the host could not confirm (it lost contact, or could not prove the terminals stopped) pauses that workspace's line. Commands that arrive while it is paused wait behind the pause; they are not refused. When the host answers again, main re-reads the workspace's state (terminal liveness and the listing) and carries on. It never re-runs the paused command; a repeat of that command simply runs again. Force Delete (--force) still runs at once, as today.
  • Sleep, close and delete all read lost contact the same way. A definite answer, even a refusal, is a plain failure, not a pause.
  • Create joins the line as soon as its name is known, so a create never waits behind the earlier occupant's delete. A create always frees its own place in the line, even when a retry under the same creation id took over its listing.
  • Queued paths: the window's delete (worktrees:remove), the phone/CLI worktree.rm, worktree.sleep, terminal.sleep and terminal.closeAll. Metadata edits (rename, pin, comment) are not queued.

In-progress hints in the feed (switch on)

  • New feed section inProgress: which workspace is creating, sleeping, waking, closing or deleting, how many commands wait behind it, and whether its line is paused.
  • Hints live only in memory and are never saved. A hint is dropped in the same feed revision that shows the finished result, so the row never flickers back to its old state. A scan that started before the command finished cannot overwrite the result (version fence).
  • The pending-creation list now comes from the queue. The old creation registry is deleted.

Why

  • One line per workspace is the simplest rule that settles every race we found (sleep vs delete, wake vs sleep, create vs an earlier delete) without per-pair special cases. Merging commands was rejected because "sleep then wake" must end awake, not be collapsed to one of them.
  • Pausing on an unconfirmed answer follows the SSH rule that loss of contact is never proof that something stopped. The alternatives were guessing "done" or showing a new "couldn't confirm" state. Guessing is wrong for SSH, and the new state needs new UI we decided against, so we keep today's kept-open toast and the user retries by repeating the action.
  • Re-reading instead of replaying on resume: there is no way to ask a host what happened to an earlier chat stop or VM suspend, and replaying the paused command would repeat its side effects behind the user's back.
  • Hints in memory only, because a restart should never show a stale "sleeping..." for work that no longer runs.

Linked Issue

Part of the sidebar one-owner design (P3). Stacked on #31513.

Visual Proof

N/A: no reader shows the new sections yet, and the build switch is off.

Testing

  • pnpm tc passes.
  • Unit tests: the full node project passed before this round (965 files). This round's queue and command tests (30) and every affected sidebar-inputs, worktree IPC and worktree/terminal RPC test pass. New tests cover: arrival order across a lookup; deletes by name waiting for the running sleep; delete-option conflicts; the pause, re-observation without replay, a repeat running again, and Force Delete running past it; a retried create freeing its line; and lost contact read the same way for sleep, close and delete.
  • Static gate (this round): 38 of 39 checks pass. The one failure (anti-slop, workspace-git-identity.test.ts:19) comes from Sidebar P2: main publishes without waiting on git, and every source announces its changes (inert) #31513, not this PR.
  • Full e2e with the switch on (first round; macOS, background launch, 2 workers): 913 passed, 49 failed, 159 skipped. The base branch is 912 / 50 / 159. 6 base failures pass here. 5 failures are new by name. On rerun, 4 of them pass. The fifth (terminal-parked-memory, a renderer heap ceiling) failed once more, then passed 2 of 2 on this branch and 2 of 2 on the base.
  • This round, switch on: the sleep, wake and delete specs (22 tests) pass, except worktree-active-delete-scroll-position, which also fails on the base.

What runs with the switch off: nothing new. The queue is not created and every path runs as before. The only switch-off changes are code moves: worktree.sleep moved to its own file, and the delete paths go through a helper that runs directly when there is no queue.

The paired-server metadata write serializer that was in an earlier version of this PR moved out; it lands with its first caller.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Notes

SSH: the line is keyed by execution host plus workspace, so the same path on two hosts never shares a line. A lost connection pauses the line rather than marking a command done. Folder workspaces use the same keys as git worktrees.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…lip)

The fixes found while the sidebar ran from main's feed, without turning
that on: ORCA_SIDEBAR_INPUTS_IS_MAIN stays false, and none of flip-a's
stop-gaps come along.

- Main stops counting a closed tab's terminal once it was asked to stop
  and no pane shows it; a failed or refused stop takes the request back,
  and a host out of contact stays unverifiable.
- Main fetches a paired server's rows with the transport's normal bound,
  so a server slower than 5 s still lists.
- A deferred unread raise flips the folder row it was decided for, and a
  read while the owner check is out cancels it.
- Phone: no worktree.ps flash before the feed; a host's last installed
  feed stands in while a fresh read is out; it highlights its own
  last-opened workspace and a fold never scrolls; projects file under
  their project group with the desktop's indent; the collapse spinner
  shows only after 500 ms; "Reopen to update" keeps the rows on screen.
- e2e helpers and journeys for the switch-on suite.
…d prune pending unread raises

- A stop-and-wait that throws takes its stop request back, like one that fails.
- A final stop the legacy relay still owes stays marked, since the relay retries it.
- Pending unread raises are tracked only while one waits, so the map no longer grows.
- The paired-server fallback poll test gives its third fetch a reply and asserts live.
…stores; detected, view and live-content domains (inert)
…n metadata writes, no phone wait on detected checkouts
…gress hints (switch-gated)

Create, delete, terminal.closeAll, terminal.sleep and worktree.sleep now run through one
first-in, first-out queue per host-qualified workspace: strict order, no merging, delete
cancels what has not started and waits for what has, an unconfirmed outcome pauses until
the host's own answer. Hints publish in a new inProgress feed domain (no reader yet); the
creations domain is its projection. A finished create or delete keeps its hint until a scan
started after it applies, in the same revision. Adds the paired-server metadata serializer
(saving domain, no caller yet). Replaces the creation registry.
- A command issued while paused waits behind the pause; when the owner answers again main
  re-reads terminal liveness and the listing, then carries on. A forced delete runs past it.
- Commands keep their arrival order across a workspace lookup; deletes by name key by the
  resolved id, so they wait for that workspace's running sleep.
- A second delete with different options is refused as already in progress.
- Close and delete read lost contact as sleep does.
- A create always frees its own queue entry, even after a retry took over its id.
- Drops the unused opId, and the paired-server write serializer and its feed section,
  which land with their first caller.

Co-Authored-By: Claude <[email protected]>
Also: split the workspace-wide terminal stops into their own RPC module (line limit), and let a
pending name lookup hold other workspaces' commands only briefly.

Co-Authored-By: Claude <[email protected]>
@Jinwoo-H
Jinwoo-H changed the base branch from sidebar-p2-producer-prep to main October 21, 2026 17:53
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0772170d-7da4-4976-842b-c5b5b7718635
📥 Commits

Reviewing files that changed from the base of the PR and between 28d3be4 and a33e88d.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

The change adds a per-workspace lifecycle queue for workspace creation, terminal operations, and worktree deletion. Runtime handlers route lifecycle commands through the queue and classify outcomes using terminal observation and lost-contact handling. Sidebar inputs publish creation snapshots and lifecycle hints. Workspace row production updates lifecycle membership after a fresh scan.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 28d3b

The lifecycle queue is switch-gated and off by default on main. With the switch on, a failed workspace scan can drop in-progress hints early, a forced delete can stall behind a membership refresh, and overlapping deletes from different clients can be rejected. Fix these before enabling the feature broadly.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 28 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: switch-gated per-workspace lifecycle lines and in-progress hints in the sidebar.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is mostly complete. It includes ELI5, What Changed, Why, a linked issue, visual-proof justification, testing details, notes, and checklist confirmations. The Review and Agent skill ups…
Full details: Description check

Explanation

The description is mostly complete. It includes ELI5, What Changed, Why, a linked issue, visual-proof justification, testing details, notes, and checklist confirmations. The Review and Agent skill upstream boundary sections are omitted, and AI Disclosure is not included; AI Disclosure may be intentionally omitted for an internal contributor.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45806f0b-9730-4116-8f03-c88c1d0aa378
📥 Commits

Reviewing files that changed from the base of the PR and between 0985d6f and 28d3be4.

📒 Files selected for processing: 30
  • src/main/ipc/worktrees-create-registry.test.ts
  • src/main/ipc/worktrees-test-runtime-stub.ts
  • src/main/ipc/worktrees/create/register-worktree-create-handlers.ts
  • src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
  • src/main/runtime/managed-worktree-create-registry.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/sidebar-inputs.ts
  • src/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods.ts
  • src/main/runtime/rpc/methods/terminal/terminal-workspace-stop-methods.ts
  • src/main/runtime/rpc/methods/worktree-sleep-method.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/main/runtime/sidebar-inputs/cached-scan.test.ts
  • src/main/runtime/sidebar-inputs/cached-scan.ts
  • src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts
  • src/main/runtime/sidebar-inputs/sidebar-inputs-feed-announcements.test.ts
  • src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
  • src/main/runtime/sidebar-inputs/sidebar-inputs-switch-off.test.ts
  • src/main/runtime/sidebar-inputs/workspace-creation-registry.test.ts
  • src/main/runtime/sidebar-inputs/workspace-creation-registry.ts
  • src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts
  • src/main/runtime/sidebar-inputs/workspace-rows-producer.ts
  • src/main/runtime/sidebar-inputs/workspace-rows-publish-cost.test.ts
  • src/main/runtime/workspaces/workspace-creation.ts
  • src/main/runtime/workspaces/workspace-lifecycle-command.ts
  • src/main/runtime/workspaces/workspace-lifecycle-commands.test.ts
  • src/main/runtime/workspaces/workspace-lifecycle-commands.ts
  • src/main/runtime/workspaces/workspace-lifecycle-creations.ts
  • src/main/runtime/workspaces/workspace-lifecycle-queue.test.ts
  • src/main/runtime/workspaces/workspace-lifecycle-queue.ts
  • src/shared/sidebar-list/workspace-lifecycle-hints.ts
💤 Files with no reviewable changes: 2
  • src/main/runtime/sidebar-inputs/workspace-creation-registry.test.ts
  • src/main/runtime/sidebar-inputs/workspace-creation-registry.ts

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

})
.catch((error: unknown) => {
console.warn(`[${this.deps.label}] scan failed`, error)
this.settleFresh(version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect whether membership completion removes settling create/delete hints.
ast-grep outline src/main/runtime/workspaces/workspace-lifecycle-queue.ts --match WorkspaceLifecycleQueue
ast-grep outline src/main/runtime/workspaces/workspace-lifecycle-creations.ts --match WorkspaceLifecycleCreations
rg -n -C 6 'membership\(|settling|finishEntry|settlingKeys' \
  src/main/runtime/workspaces/workspace-lifecycle-queue.ts \
  src/main/runtime/workspaces/workspace-lifecycle-creations.ts

Repository: stablyai/orca

Length of output: 15678


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- cached-scan.ts ---'
nl -ba src/main/runtime/sidebar-inputs/cached-scan.ts | sed -n '1,220p'
printf '%s\n' '--- WorkspaceRowsProducer references ---'
rg -n -F --glob '*.ts' -e 'new CachedScan' -e 'afterFresh' -e 'setMembership' -e 'membership:' src/main/runtime/sidebar-inputs src/main/runtime/workspaces
printf '%s\n' '--- lifecycle queue completion blocks ---'
nl -ba src/main/runtime/workspaces/workspace-lifecycle-queue.ts | sed -n '285,365p'
printf '%s\n' '--- lifecycle creation completion block ---'
nl -ba src/main/runtime/workspaces/workspace-lifecycle-creations.ts | sed -n '45,112p'

Repository: stablyai/orca

Length of output: 12021


Do not settle lifecycle membership after a failed scan.

When scan() rejects, CachedScan calls settleFresh(version) without applying a new listing. WorkspaceRowsProducer connects this callback to the lifecycle queue, so a failed scan can clear a create or delete hint while rows still show the previous membership. Settle membership only after an applied result. Provide a retry or explicit failure path for the waiter.

Comment on lines +169 to +214
private enqueue<T>(key: string, command: LifecycleCommand<T>, seq: number): Promise<T> {
const queue = this.queueFor(key)
const pendingDelete = queue.entries.find((entry) => entry.kind === 'delete')
if (pendingDelete) {
const pending = pendingDelete.command?.delete
if (command.kind !== 'delete') {
return Promise.reject(new Error(WORKSPACE_DELETED_ERROR))
}
if (pendingDelete.reply && pending?.key === command.delete?.key) {
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: an equal delete shares the pending delete's reply, as a removal in flight always has.
return pendingDelete.reply as Promise<T>
}
// A forced delete replaces an unforced one still waiting (behind a pause); never a running one.
if (!command.delete?.force || pendingDelete.state === 'running') {
const label = command.delete?.label ?? key
return Promise.reject(new Error(`Worktree deletion already in progress: ${label}`))
}
}
if (command.kind === 'delete') {
this.cancelQueued(queue)
}
let settle!: (attempt: LifecycleAttempt) => void
const reply = new Promise<unknown>((resolve, reject) => {
settle = (result) => (result.threw ? reject(result.error) : resolve(result.value))
})
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: widened only to be stored; run's result is handed back to this command's own caller.
const stored = command as LifecycleCommand<unknown>
const entry: Entry = {
kind: command.kind,
seq,
state: 'queued',
command: stored,
reply,
settle
}
// In arrival order among what has not started; a late lookup goes ahead of later arrivals.
const after = queue.entries.findIndex((queued) => queued.state === 'queued' && queued.seq > seq)
queue.entries.splice(after === -1 ? queue.entries.length : after, 0, entry)
this.revision.bump()
if (command.delete?.force) {
queue.wake?.()
}
void this.drain(key)
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: settled only with this command's run result.
return reply as Promise<T>
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'optionKey|options|key' src/main/runtime/workspaces/workspace-lifecycle-queue.ts | sed -n '1,60p'
sed -n '130,170p' src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
rg -n 'queueWorkspaceDelete' -A40 src/main/runtime/workspaces/workspace-lifecycle-commands.ts

Repository: stablyai/orca

Length of output: 5090


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- helper references ---'
rg -n -F --glob '*.ts' -e 'getWorktreeRemovalOptionsKey' -e 'getRuntimeWorktreeRemovalOptionsKey' -e 'type RemoveWorktreeArgs' -e 'interface RemoveWorktreeArgs' src
printf '%s\n' '--- imports and helper definitions ---'
rg -n -F --glob '*.ts' -e 'getWorktreeRemovalOptionsKey' -e 'getRuntimeWorktreeRemovalOptionsKey' src/main | head -80
printf '%s\n' '--- command tail ---'
sed -n '180,245p' src/main/runtime/workspaces/workspace-lifecycle-commands.ts
printf '%s\n' '--- removal handler context ---'
sed -n '1,180p' src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
printf '%s\n' '--- queue type definitions ---'
sed -n '1,115p' src/main/runtime/workspaces/workspace-lifecycle-queue.ts

Repository: stablyai/orca

Length of output: 17174


🏁 Script executed:

rg -n -F --glob '*.ts' -e 'getWorktreeRemovalOptionsKey' -e 'getRuntimeWorktreeRemovalOptionsKey' -e 'interface RemoveWorktreeArgs' -e 'type RemoveWorktreeArgs' src; sed -n '180,235p' src/main/runtime/workspaces/workspace-lifecycle-commands.ts; sed -n '1,180p' src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts; sed -n '1,115p' src/main/runtime/workspaces/workspace-lifecycle-queue.ts

Repository: stablyai/orca

Length of output: 15231


🏁 Script executed:

rg -n -F --glob '*.ts' -e 'getWorktreeRemovalOptionsKey' -e 'getRuntimeWorktreeRemovalOptionsKey' -e 'interface RemoveWorktreeArgs' -e 'type RemoveWorktreeArgs' src

Repository: stablyai/orca

Length of output: 2029


🏁 Script executed:

set -o pipefail
sed -n '1,80p' src/main/ipc/worktrees/removal/worktree-removal-coordinator.ts
sed -n '1,65p' src/main/runtime/runtime-worktree-selection.ts
sed -n '1,55p' src/main/ipc/worktrees/ipc-context-schemas.ts
sed -n '1,45p' src/main/runtime/workspaces/workspace-lifecycle-commands.ts

Repository: stablyai/orca

Length of output: 8519


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- queueWorkspaceDelete callers ---'
rg -n -F --glob '*.ts' -e 'queueWorkspaceDelete(' src/main
printf '%s\n' '--- runtime removal consumers ---'
sed -n '85,130p' src/main/runtime/workspaces/workspace-removal.ts
rg -n -F --glob '*.ts' -e 'runHooks' -e 'skipArchive' src/main/runtime src/main/ipc/worktrees/removal | head -100
printf '%s\n' '--- key resolution ---'
rg -n -F --glob '*.ts' -e 'function explicitKey' -e 'function lookedUpKey' -e 'explicitKey(' -e 'workspaceLifecycleKey(' src/main/runtime/workspaces/workspace-lifecycle-commands.ts src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts
printf '%s\n' '--- IPC execution options ---'
rg -n -F --glob '*.ts' -e 'skipArchive' -e 'allowFailedArchiveHook' src/main/ipc/worktrees/removal/execute-worktree-removal.ts src/main/ipc/worktrees/removal

Repository: stablyai/orca

Length of output: 16527


🏁 Script executed:

set -o pipefail
sed -n '90,155p' src/main/runtime/workspaces/workspace-lifecycle-commands.ts
sed -n '255,300p' src/main/runtime/rpc/methods/worktree.ts
sed -n '145,178p' src/main/ipc/worktrees/removal/execute-worktree-removal.ts
sed -n '65,100p' src/main/runtime/workspaces/workspace-removal.ts
sed -n '1,70p' src/main/runtime/rpc/methods/worktree.ts

Repository: stablyai/orca

Length of output: 9961


🏁 Script executed:

sed -n '70,100p' src/main/runtime/runtime-registered-local-worktree-removal.ts

Repository: stablyai/orca

Length of output: 1393


Use the same delete-option key format in both removal paths.

When an archive-enabled IPC delete and a hook-enabled RPC delete overlap for the same explicit worktree and host, the IPC key is normal:run-archive:require-pty-stop:require-archive, while the RPC key is normal:run-hooks:require-pty-stop:require-archive. The queue compares these keys directly, so the second request can throw Worktree deletion already in progress instead of joining the active delete.

Suggested fix
-  const archiveKey = args.skipArchive === true ? 'skip-archive' : 'run-archive'
+  const archiveKey = args.skipArchive === true ? 'skip-hooks' : 'run-hooks'

Comment on lines +337 to +342
if (answered === true) {
await new Promise<void>((done) => this.membership(done))
if (queue.paused === paused) {
queue.paused = null
this.revision.bump()
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Does afterFresh request a scan itself, or only wait for one that demand allows?
fd cached-scan.ts src/main/runtime/sidebar-inputs --exec cat -n {}

Repository: stablyai/orca

Length of output: 4367


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- queue target and related symbols ---'
rg -n -F -- 'awaitOwner' src/main/runtime/workspaces/workspace-lifecycle-queue.ts
rg -n -F -- 'wake()' src/main/runtime/workspaces/workspace-lifecycle-queue.ts
rg -n -F -- 'afterFresh' src/main/runtime/workspaces src/main/runtime/sidebar-inputs || true
sed -n '250,390p' src/main/runtime/workspaces/workspace-lifecycle-queue.ts
printf '%s\n' '--- queue callers and membership binding ---'
rg -n -F -- 'setMembership' src/main
rg -n -F -- 'WorkspaceRowsProducer' src/main
rg -n -F -- 'scans.afterFresh' src/main

Repository: stablyai/orca

Length of output: 335


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- target queue block ---'
nl -ba src/main/runtime/workspaces/workspace-lifecycle-queue.ts | sed -n '240,370p'
printf '%s\n' '--- queue symbols ---'
rg -n -F -e 'wake' -e 'membership' -e 'forced' -e 'force' -e 'delete' src/main/runtime/workspaces/workspace-lifecycle-queue.ts || true
printf '%s\n' '--- membership and queue wiring ---'
rg -n -F -e 'setMembership' -e 'WorkspaceRowsProducer' -e 'afterFresh' src/main || true

Repository: stablyai/orca

Length of output: 9820


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- forced-delete enqueue path ---'
nl -ba src/main/runtime/workspaces/workspace-lifecycle-queue.ts | sed -n '150,220p'
printf '%s\n' '--- WorkspaceRowsProducer membership binding ---'
nl -ba src/main/runtime/sidebar-inputs/workspace-rows-producer.ts | sed -n '77,105p'

Repository: stablyai/orca

Length of output: 5080


Do not block forced delete on membership refresh.

awaitOwner races the owner observation against woken, but it does not race the subsequent this.membership(done) wait. A forced delete calls queue.wake?.(), yet the existing wait does not observe that signal. Race the membership wait against woken:

🐛 Suggested fix
--- "a/src/main/runtime/workspaces/workspace-lifecycle-queue.ts"
+++ "b/src/main/runtime/workspaces/workspace-lifecycle-queue.ts"
@@ -334,12 +334,15 @@
         ),
         woken
       ])
       if (answered === true) {
-        await new Promise<void>((done) => this.membership(done))
-        if (queue.paused === paused) {
+        const listed = await Promise.race([
+          new Promise<'listed'>((done) => this.membership(() => done('listed'))),
+          woken
+        ])
+        if (listed === 'listed' && queue.paused === paused) {
           queue.paused = null
           this.revision.bump()
         }
       } else if (answered === false) {
         await Promise.race([this.retryDelay(OBSERVE_RETRY_MS), woken])
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (answered === true) {
await new Promise<void>((done) => this.membership(done))
if (queue.paused === paused) {
queue.paused = null
this.revision.bump()
}
if (answered === true) {
const listed = await Promise.race([
new Promise<'listed'>((done) => this.membership(() => done('listed'))),
woken
])
if (listed === 'listed' && queue.paused === paused) {
queue.paused = null
this.revision.bump()
}

@Jinwoo-H
Jinwoo-H merged commit bd0f326 into main Oct 21, 2026
47 checks passed
Jinwoo-H added a commit that referenced this pull request Oct 22, 2026
…tore-view-attach

apply-mobile-session-tab-navigation.ts takes main's renamed selection-projection import; C1c's numbered-record lookup keeps replacing the stable-key read, so main's makePaneKey import is unused and dropped.

Claude-Session: W5b
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