Repository navigation
feat(sidebar): after a restart, the host clears sort tiers nothing backs any more (dark) - #30259
Conversation
…live hook rows and terminals (dark)
…tle, seeding hydrated rows
… rest seed adds no clear
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts: 1
405-405: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake the fake probe answer
truefor'pty-live'.The test name says a live terminal keeps the tier. The fake probe instead returns
falsefor'pty-live', andfalsemeans "proven absent." The live case therefore never runs in this test. TheWTtier survives only because'pty-unknown'returnsnull. If the producer ever treated atrueresult as absent, this test would still pass. Returntruefor'pty-live'so this test covers all three ways a tier is kept.🧪 Proposed fix
- probePtyLiveness: async (ptyId) => (ptyId === 'pty-live' ? false : null) + probePtyLiveness: async (ptyId) => (ptyId === 'pty-live' ? true : null)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4a781427-ad03-4add-ad6f-094dd43a2aeb
📒 Files selected for processing: 10
src/main/orcad/orcad-entry.tssrc/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.tssrc/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.tssrc/main/runtime/sidebar-inputs/sort-stamp-records.tssrc/main/runtime/sidebar-inputs/sort-stamps-producer.test.tssrc/main/runtime/sidebar-inputs/sort-stamps-producer.tssrc/main/startup/main-process-pty-startup.tstests/e2e/helpers/agent-hook-endpoint.tstests/e2e/sidebar-sort-stamps-startup.spec.tstests/e2e/sidebar-sort-stamps.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
ELI5
The previous PR (#30235) made the computer that owns a workspace write down "this workspace's agent needs you / is done / is working" on the workspace's record. If Orca quits and the agent dies while it is closed, nothing would ever erase that note. This PR checks the notes once after Orca restarts and erases the ones nothing backs any more. It is still switched off in every build people use.
What Changed
Behind the build switch
ORCA_SIDEBAR_INPUTS=mainonly:SortStampsProducer.reconcileStoredTiersruns once per start, at the point where the host's own evidence has settled:orca serve: at the end of the existing restored-status dead-terminal sweep (main-process-pty-startup.ts), which runs after the hook server has loaded its saved rows and the local PTY provider is ready;resolveAgentWorkspaceExecutionHostId+isLocalExecutionHost, the same rule the dead-terminal sweep uses; unknown ownership is not treated as local);sort-stamp-records.tsto keep the producer under the line limit.With the switch off nothing here runs: the reconcile lives on the switch-only runtime layer, and the two call sites go through
sidebarFacts, which is null.Why
A tier is only true while something backs it. Hook-backed agents are covered by the hook server's own restored-row sweep, which removes rows whose terminal died; hookless agents (title heuristic) have no row, so their tier needed this check. The check never treats an SSH host or a paired server as dead: a host that is not connected yet proves nothing (docs/reference/ssh-execution-boundary.md).
Alternative rejected: reconciling when the producer attaches. On the desktop that runs before the hook server loads its saved rows and before any terminal is known, so it wiped every tier on every start (found in review).
Linked Issue
Follow-up to #30235 (sidebar sort stamps plan, deferred item).
Visual Proof
N/A: dark behind a build switch; nothing reads the stamps for ordering yet.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Unit:
sort-stamps-producer.test.ts(clears an unbacked local tier on a worktree and a folder; keeps tiers backed by a hook row, a live terminal, a terminal the probe cannot answer for, or no terminal on record; seeds rows hydrated without a mutation; never touches another host's tiers),orca-runtime-sort-stamps.test.ts(real runtime, live vs gone terminal).e2e on a switch-on build, hidden window:
tests/e2e/sidebar-sort-stamps-startup.spec.tsrestarts the app with a saved hookdonerow (kept), a folder workspace tier whose terminal died while Orca was closed (cleared) and an SSH host's tier (kept); passes 3 of 3. Positive controls: with the desktop call removed the spec fails (Received: "working"), and with no dead terminal on record the folder tier is kept, so the spec fails too.sidebar-sort-stamps.spec.tsandsidebar-workspace-rows.spec.tsstill pass.pnpm tc, relevant suites,check:code-quality:changed, focus-read ratchet, oxlint: pass. macOS only.Review
Opus review of the diff and of the redesign delta.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)