Repository navigation
Conversation
Snooze sleeps a workspace, hides it from the sidebar, kanban board, jump palette default list and mobile, and stores a wake condition on its metadata. A main-process service wakes due workspaces every 30s and on resume from OS sleep, marking them unread. The context menu offers presets, a pick-a-time dialog and Wake Now; a "Hide snoozed" filter peeks snoozed rows for the session. worktree.set and folderWorkspace.update gain an optional snooze field, gated by the workspace.snooze.v1 runtime capability so older hosts refuse instead of dropping it. Contract approved by Trevor Smith, recorded on stablyai#24940 as "orca-runtime worktree.set + worktree.ps snooze field". Refs stablyai#24940 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Important
The wake ticker is only installed on the Electron entry path, so a headless orcad host — including a paired remote environment — persists a snooze but never wakes it. That contradicts the stated mechanism and is the exact host class the main-process timer was added for.
Reviewed changes
- Snooze model and wire contract — new
WorkspaceSnooze(snoozedAt, optionalwakeAt/afterSession) threaded throughWorktreeMeta,FolderWorkspace,WorktreeandRuntimeWorktreePsSummary;worktree.set/folderWorkspace.updateaccept it nullable, andnulldeletes the stored field. - Wake service —
WorkspaceSnoozeWakeServiceticks every 30s, once at startup, and on OS resume; each due workspace is woken through the runtime (snooze cleared, marked unread, activity bumped). - Renderer UX — context-menu Snooze submenu with presets, a Pick-a-Time dialog, Wake Now, a session-only Hide-snoozed peek, and a snoozed badge.
- Visibility filtering — sidebar
computeVisibleWorktrees, the lineage ancestor index, kanban ids, the jump-palette empty-query list and mobile all hide snoozed rows; a typed palette search still finds them. - Remote capability gate —
workspace.snooze.v1is asserted before writing to a paired environment so an older runtime fails loudly instead of stripping the field.
⚠️ Headless and paired-remote hosts never wake a due snooze
The wake ticker is started only from initializeReadyRuntimeServices, which is reached only from the Electron entry (src/main/index.ts). The headless server orcad builds its own runtime in src/main/orcad/orcad-entry.ts and starts no equivalent; a repo-wide search finds no snooze symbol anywhere under src/main/orcad/. Because a paired remote environment is orcad and owns its own metadata store, a snooze written there via worktree.set/folderWorkspace.update is persisted but never auto-woken, so the row stays hidden until a client sends an explicit Wake Now. This undercuts the reason the timer lives in the main process.
Technical details
# Headless/remote wake is never scheduled
## Affected sites
- src/main/startup/main-process-ready-runtime.ts:60-61 — the sole production start of `WorkspaceSnoozeWakeService`.
- src/main/index.ts:124 — the sole caller of `initializeMainProcessReady`.
- src/main/orcad/orcad-entry.ts:210,321 — `orcad` constructs `OrcaRuntimeService` and starts the RPC server; it starts no wake service and has no snooze reference.
## Required outcome
- Any host that owns snoozed metadata runs its own wake tick against its own store, including `orcad`.
## Suggested approach (optional)
- Start `createWorkspaceSnoozeWakeService(profileStore, runtime)` in `orcad-entry` alongside the other host-local services, and stop it on shutdown; or factor the desktop runtime-service wiring so both entries install it.
## Open questions for the human (optional)
- Is the paired-remote path expected to be the Electron `--serve` app rather than `orcad`? If so, direct `orcad` deployments still need the tick, since the PR body advertises both.deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)📝 WalkthroughWalkthroughThe change adds snooze metadata for worktrees and folder workspaces, persists and propagates it through runtime and IPC paths, and adds a service that wakes due workspaces. The sidebar adds snooze controls, a custom wake-time dialog, status badges, and a setting to show snoozed workspaces. Snoozed worktrees are excluded by default from supported sidebar, jump-palette, and mobile lists. Tests cover metadata, wake behavior, visibility, and end-to-end snooze and wake flows. Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to A workspace snoozed again on another host may wake earlier than requested. Check the snooze on the host being updated before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The inspected wake path changes workspace metadata without demonstrating new privileges or cross-user access. Concurrency safeguards reduce stale updates, but multi-host ownership, restart recovery, and compatibility with older remote hosts remain incompletely established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7375e5df-9697-4fe4-a08e-dec9a338a108
📒 Files selected for processing (65)
mobile/src/worktree/workspace-list-sections.tsmobile/src/worktree/workspace-list-types.tsmobile/src/worktree/worktree-list-snapshot.tssrc/main/ipc/repos/repo-ipc-arg-schemas.tssrc/main/ipc/worktree-metadata-merge.tssrc/main/ipc/worktrees/folder-workspace-model.tssrc/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.tssrc/main/persistence-worktree-meta-and-folder-workspaces.test.tssrc/main/persistence/loading-store/worktree-meta-write-normalization.test.tssrc/main/persistence/loading-store/worktree-meta-write-normalization.tssrc/main/persistence/restoring-sessions/folder-workspace-operations.tssrc/main/runtime/rpc/methods/worktree.tssrc/main/runtime/runtime-folder-workspace.tssrc/main/runtime/runtime-project-group-controller.tssrc/main/runtime/runtime-worktree-ps-summaries.tssrc/main/startup/main-process-quit.tssrc/main/startup/main-process-ready-runtime.tssrc/main/startup/main-process-state.tssrc/main/workspace-snooze/workspace-snooze-wake-runtime.tssrc/main/workspace-snooze/workspace-snooze-wake-service.test.tssrc/main/workspace-snooze/workspace-snooze-wake-service.tssrc/preload/api/worktree-api.tssrc/renderer/src/components/sidebar/SidebarFilter.tsxsrc/renderer/src/components/sidebar/SidebarWorkspaceFilterSection.tsxsrc/renderer/src/components/sidebar/SnoozeWorkspaceDialog.tsxsrc/renderer/src/components/sidebar/WorkspaceSnoozeBadge.tsxsrc/renderer/src/components/sidebar/WorkspaceSnoozeMenuItems.tsxsrc/renderer/src/components/sidebar/WorktreeContextMenuView.tsxsrc/renderer/src/components/sidebar/index.tsxsrc/renderer/src/components/sidebar/use-visible-workspace-kanban-worktree-ids.tssrc/renderer/src/components/sidebar/use-worktree-context-menu-commands.tssrc/renderer/src/components/sidebar/visible-worktree-indexes.tssrc/renderer/src/components/sidebar/visible-worktree-options-from-state.tssrc/renderer/src/components/sidebar/visible-worktrees.tssrc/renderer/src/components/sidebar/workspace-snooze-flow.test.tssrc/renderer/src/components/sidebar/workspace-snooze-flow.tssrc/renderer/src/components/sidebar/workspace-snooze-presets.test.tssrc/renderer/src/components/sidebar/workspace-snooze-presets.tssrc/renderer/src/components/sidebar/worktree-card-header.tsxsrc/renderer/src/components/sidebar/worktree-list/listing/use-filters.tssrc/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.test.tsxsrc/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.tssrc/renderer/src/components/use-worktree-jump-palette-store-state.tssrc/renderer/src/components/use-worktree-jump-palette-worktrees.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/store/folder-workspaces/folder-workspace-mutations.tssrc/renderer/src/store/repos/repo-state.tssrc/renderer/src/store/slices/ui/ui-slice-contract-contextual.tssrc/renderer/src/store/slices/ui/ui-slice-contract-preferences.tssrc/renderer/src/store/slices/ui/ui-slice-preference-actions.tssrc/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.tssrc/shared/folder-workspace-types.tssrc/shared/folder-workspace-worktree.tssrc/shared/folder-workspaces.test.tssrc/shared/folder-workspaces.tssrc/shared/protocol-version.tssrc/shared/rpc-contract/folder-workspace-params.tssrc/shared/rpc-contract/worktree-params.tssrc/shared/runtime-worktree-contracts.tssrc/shared/workspace-snooze.test.tssrc/shared/workspace-snooze.tssrc/shared/worktree/meta-types.tssrc/shared/worktree/types.tstests/e2e/workspace-snooze.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
- orcad starts the wake service too, so headless and remote hosts wake snoozes - wake pass logs listing failures instead of rejecting - wake skips a workspace re-snoozed or woken after the pass listed it - snooze actions skip already-snoozed rows in mixed selections - lineage index keeps snoozed parents while the peek is on - stored snooze parse keeps unknown keys so newer conditions survive re-persist Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The follow-up commit 12542490bc addresses both prior findings and hardens the wake path.
- Headless
orcadhost now wakes snoozes —orcad-entrystartscreateWorkspaceSnoozeWakeService(profileStore, runtime)after recovery and stops it first on shutdown, so a paired-remote host that owns snoozed metadata runs its own tick. - Stored parse preserves unknown wake conditions —
parseStoredWorkspaceSnoozenow parses with a.loose()schema, so a condition written by a newer build survives the folder-workspace load/save round-trip. - Wake skips a workspace the user changed mid-pass — the runtime adapter re-reads the stored
snoozedAtwith no await before writing and bails when it no longer matches, so a re-snooze or Wake Now is not clobbered. - Listing failure no longer aborts the service — a throwing
listSnoozed()is warned and retried on the next pass instead of rejecting. - Snooze menu ignores already-snoozed rows — the context-menu snooze actions filter to non-snoozed rows so re-snoozing cannot overwrite an existing wake time.
- Peek-aware lineage index —
getLineageAncestorIndexnow takes the peek flag, with a per-valueWeakMapcache, so a snoozed parent resolves its children only while Hide snoozed is off. - Tests — new coverage for the headless startup wake, the re-snooze/wake race, listing-failure retry, persistence round-trip, and peek-aware nesting. All focused suites pass locally.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Runtime worktree meta update takes an optional precondition, read after its last await and before any write. Wake passes "snoozedAt unchanged", so a re-snooze during selector resolution survives. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The follow-up commit d443c87 closes the re-snooze race that the prior adapter check could not: the worktree path awaits resolution before it writes.
- Precondition checked after every await —
updateRuntimeManagedWorktreeMetadatagains an optionalpreconditionand runs it afterresolveWorktreeand the parent resolve, immediately before the synchronous write. The parent resolve was hoisted above the check so the guard really sits after the last await. - Wake skip is not a failure —
WorkspaceSnoozeWakeRuntime.updateManagedWorktreeMetapasses(meta) => unchanged(meta?.snooze)and the service swallowsWorktreeMetaPreconditionError, so a workspace the user re-snoozed mid-resolution is left alone without a warn or retry. Folder workspaces keep the earlier pre-read check, which is sufficient becauseupdateFolderWorkspacehas no await for a snooze update. - Tests — a refusal test that proves no write/notify when the stored
snoozedAtmoved during resolution, and a wake-runtime test pinning the precondition verdicts plus the silent skip. The wake-service test was updated for the third argument.
The focused suites (runtime-managed-worktree-metadata, workspace-snooze-wake-runtime, workspace-snooze-wake-service) pass and pnpm tc:node is clean.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
54f9aac8-4143-49ed-9b42-ae90d58fe5cb
📒 Files selected for processing (5)
src/main/runtime/orca-runtime-create-managed-remote-worktree.tssrc/main/runtime/runtime-managed-worktree-metadata.test.tssrc/main/runtime/runtime-managed-worktree-metadata.tssrc/main/workspace-snooze/workspace-snooze-wake-runtime.test.tssrc/main/workspace-snooze/workspace-snooze-wake-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/workspace-snooze/workspace-snooze-wake-runtime.test.ts
- src/main/workspace-snooze/workspace-snooze-wake-runtime.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| ? await args.ports.resolveWorktree(lineage.parentWorktree) | ||
| : null | ||
| // Why after every await: a check before one would let a concurrent write slip in before ours. | ||
| if (args.precondition && !args.precondition(args.store.getWorktreeMeta(worktree.id))) { |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect the store's getter, host-specific setter, and their call sites.
rg -n -C 5 'getWorktreeMeta\s*[:=(]|setWorktreeMetaForHost\s*[:=(]|getWorktreeMetaForHost\s*[:=(]' src/main
rg -n -C 5 'updateManagedWorktreeMeta\s*\(|snoozedAt' src/main/workspace-snoozeRepository: stablyai/orca
Length of output: 45667
🏁 Script executed:
printf '%s\n' '--- managed worktree update ---'
sed -n '1,155p' src/main/runtime/runtime-managed-worktree-metadata.ts
printf '%s\n' '--- declarations / implementations in files binding host metadata methods ---'
rg -l 'getWorktreeMetaForHost|setWorktreeMetaForHost' src/main --glob '*.ts' | head -40
printf '%s\n' '--- method definitions ---'
rg -n 'getWorktreeMeta\s*\(|getWorktreeMetaForHost\s*\(|setWorktreeMetaForHost\s*\(' src/main --glob '*.ts' -g '!*.test.ts' | head -100
printf '%s\n' '--- snooze wake call chain ---'
sed -n '1,100p' src/main/workspace-snooze/workspace-snooze-wake-runtime.tsRepository: stablyai/orca
Length of output: 17595
🏁 Script executed:
printf '%s\n' '--- store method implementations ---'
sed -n '1,115p' src/main/persistence/loading-store/metadata-lineage-operations.ts
printf '%s\n' '--- host-keyed metadata operations ---'
sed -n '135,245p' src/main/persistence/loading-store/worktree-identity-metadata.ts
printf '%s\n' '--- canonical alias projection ---'
sed -n '1,220p' src/main/persistence/loading-store/worktree-meta-alias-projection.ts
printf '%s\n' '--- host-specific operation references and generic getter wiring ---'
rg -n -C 3 'getWorktreeMetaForHost|setWorktreeMetaForHost|project.*WorktreeMeta|worktreeMetaById' src/main/persistence/loading-store --glob '*.ts' -g '!*.test.ts' | head -180Repository: stablyai/orca
Length of output: 36084
🏁 Script executed:
printf '%s\n' '--- setter projection rule ---'
sed -n '208,285p' src/main/persistence/loading-store/worktree-identity-metadata.ts
printf '%s\n' '--- managed update callers and bindings ---'
rg -n -C 3 'updateRuntimeManagedWorktreeMetadata\s*\(|updateManagedWorktreeMeta\s*[:=]' src/main --glob '*.ts' -g '!*.test.ts' | head -180
printf '%s\n' '--- wake service construction / wake path ---'
rg -n -C 3 'createWorkspaceSnoozeWakeService|workspaceSnoozeWake|listSnoozed' src/main --glob '*.ts' -g '!*.test.ts' | head -120
printf '%s\n' '--- target-file changes from PR base ---'
git diff --unified=5 f7b1f9d8be14d12244957ee0b710a3482ec62383 d443c87521ee14f85963511e4d375da6709b1efc -- src/main/runtime/runtime-managed-worktree-metadata.ts | sed -n '1,180p'Repository: stablyai/orca
Length of output: 14033
🏁 Script executed:
printf '%s\n' '--- managed update wrapper ---'
sed -n '110,190p' src/main/runtime/orca-runtime-create-managed-remote-worktree.ts
printf '%s\n' '--- selector resolution bindings in runtime source ---'
rg -n -C 4 'resolveWorktree\s*[:=]|resolveWorktree\(' src/main/runtime --glob '*.ts' -g '!*.test.ts' | head -200
printf '%s\n' '--- selector id resolution ---'
sed -n '150,220p' src/main/runtime/orca-runtime-resolve-worktree-selector.tsRepository: stablyai/orca
Length of output: 20215
🏁 Script executed:
sed -n '1,155p' src/main/runtime/orca-runtime-resolve-worktree-selector.ts | cat -nRepository: stablyai/orca
Length of output: 7945
🏁 Script executed:
rg -n -C 5 'resolveExplicitWorktreeIdScoped' src/main/runtime --glob '*.ts' -g '!*.test.ts'Repository: stablyai/orca
Length of output: 6086
🏁 Script executed:
sed -n '105,195p' src/main/runtime/orca-runtime-list-known-resolved-worktrees-for-explicit-target.ts | cat -nRepository: stablyai/orca
Length of output: 4767
🏁 Script executed:
rg -n -C 8 'resolveScopedWorktreeIdRow' src/main/runtime --glob '*.ts' -g '!*.test.ts'Repository: stablyai/orca
Length of output: 6535
🏁 Script executed:
sed -n '175,265p' src/main/runtime/repo-worktree-row-resolution.ts | cat -nRepository: stablyai/orca
Length of output: 2557
🏁 Script executed:
rg -n 'resolveRepoWorktreeRows|readWorktreeMetaForHost|getWorktreeMetaForHost' src/main/runtime/repo-worktree-row-resolution.ts
sed -n '1,175p' src/main/runtime/repo-worktree-row-resolution.ts | cat -nRepository: stablyai/orca
Length of output: 9214
🏁 Script executed:
sed -n '1,180p' src/main/runtime/runtime-store-contract.ts | cat -n
rg -n -C 2 'getWorktreeMetaForHost' src/main/runtime/runtime-store-contract.ts src/main/runtime/orca-runtime-create-managed-remote-worktree.tsRepository: stablyai/orca
Length of output: 8918
🏁 Script executed:
rg -n -C 8 'mergeWorktreeMetaForWrite' src/main/persistence/loading-store/worktree-meta-write-normalization.tsRepository: stablyai/orca
Length of output: 724
🏁 Script executed:
sed -n '31,60p' src/main/persistence/loading-store/worktree-meta-write-normalization.ts | cat -nRepository: stablyai/orca
Length of output: 1173
Check metadata for the host that the update will write.
getWorktreeMeta(worktree.id) reads the generic locator row, but an id: selector can resolve to a different host and write through setWorktreeMetaForHost. If the generic row still holds the snooze that the wake service listed, the precondition can pass even when the resolved host has a newer snooze. The snooze: null write can then clear that newer snooze. Read metadata for the resolved executionHostId before evaluating the precondition.
🐛 Suggested fix
--- a/src/main/runtime/runtime-store-contract.ts
+++ b/src/main/runtime/runtime-store-contract.ts
@@
getWorktreeMeta: Store['getWorktreeMeta']
+ getWorktreeMetaForHost: Store['getWorktreeMetaForHost']
setWorktreeMeta: Store['setWorktreeMeta']
--- a/src/main/runtime/runtime-managed-worktree-metadata.ts
+++ b/src/main/runtime/runtime-managed-worktree-metadata.ts
@@
const parent = lineage?.parentWorktree
? await args.ports.resolveWorktree(lineage.parentWorktree)
: null
+ const executionHostId = worktree.identity?.executionHostId ?? worktree.hostId
+ const currentMeta =
+ executionHostId && args.store.setWorktreeMetaForHost
+ ? args.store.getWorktreeMetaForHost(worktree.id, executionHostId)
+ : args.store.getWorktreeMeta(worktree.id)
// Why after every await: a check before one would let a concurrent write slip in before ours.
- if (args.precondition && !args.precondition(args.store.getWorktreeMeta(worktree.id))) {
+ if (args.precondition && !args.precondition(currentMeta)) {
@@
- const executionHostId = worktree.identity?.executionHostId ?? worktree.hostId
if (executionHostId && args.store.setWorktreeMetaForHost) {
ELI5
Sometimes a workspace is worth keeping but not worth looking at today. Snooze puts it to sleep, hides it from the sidebar, and brings it back as unread at the time you pick.
What Changed
Before: a workspace you wanted to set aside stayed in the sidebar. Sleep freed memory but the row kept its place in the list.
After:
Mechanism:
WorktreeMetaandFolderWorkspace) gains an optionalsnooze: { snoozedAt, wakeAt?, afterSession? }. Sendingnullclears it.afterSessionis reserved for the follow-up that wakes a workspace when another session finishes. Nothing writes it yet.worktree.setandfolderWorkspace.updateaccept the field, andworktree.psreports it.Why
Snooze reuses the existing Sleep teardown instead of adding a second way to free a workspace. Snooze is Sleep plus a saved wake condition and hiding.
The timer lives in the main process, not the renderer. That way a snooze fires with no window open, on headless servers, and after the laptop wakes, when an in-renderer timer would have stalled.
Remote hosts check their parameters with a schema that silently strips unknown fields. An older host would drop
snoozeand still report success. The client therefore checks a newworkspace.snooze.v1runtime capability and shows "Update the remote runtime to snooze workspaces" when the host lacks it. Older clients ignore the new field and simply keep showing snoozed rows.Linked Issue
Part of #24940. This PR covers timed snooze only. A
orca worktree snoozeCLI command and "wake when another session finishes" follow in separate PRs.Visual Proof
Before: no Snooze item in the context menu.

After: screenshots below





Testing
I manually tested these changes locally (macOS, background Electron launch driven over CDP)
Automated tests added/updated
Unit tests:
E2E:
tests/e2e/workspace-snooze.spec.tspnpm tc, the mobile typecheck,pnpm run check:code-quality:changedand thepnpm lintsteps pass. One exception:audit:code-quality:nativereports fiveimport(no-cycle)warnings inmobile/src/transportandmobile/src/terminal, files this PR does not touch.Linux, Windows and SSH were not run by hand. The change has no platform-specific code. SSH and remote hosts go through the capability gate, and the wake runs on whichever host owns the metadata.
AI Disclosure
Written with Claude Code (Claude Opus 5.5), reviewed and directed by me.
Review
Cross-boundary contract (the
snoozefield onworktree.set,folderWorkspace.updateandworktree.ps): contract approved by Trevor Smith, recorded on #24940 as "orca-runtime worktree.set + worktree.ps snooze field".Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code