Skip to content

A slept native-chat workspace reads asleep and hides - #28457

Merged
brennanb2025 merged 23 commits into
mainfrom
brennanb2025/slept-chat-workspace-hides
Oct 21, 2026
Merged

brennanb2025 merged 23 commits into
mainfrom
brennanb2025/slept-chat-workspace-hides

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

After Sleep stops a workspace's native chats, the workspace still looks awake and stays listed under “Hide sleeping workspaces.” A retained chat tab currently counts as awake even after its agent stops.

This change makes an explicitly slept chat workspace read asleep and hide under that filter. It stays asleep across app restarts. Opening it shows its history without waking it; sending a new message wakes it through the existing send path.

What Changed

The machine running each chat saves sleptAt on that chat's session record when an explicit Sleep proves it stopped. Its existing status feed publishes that optional field. The window keeps an unsaved projection and derives the existing sleeping indicator, filter, board, search and Sleep availability from it.

A newly admitted message from any client clears the saved mark. Held drafts clear it only when submitted. Merely opening a workspace, restoring history, an idle shutdown or moving a project to WSL does not write or clear Sleep.

While restored chats await their host's first answer, their sleep state is unknown and they wait to appear under Hide sleeping. Known answers survive disconnection. Hosts without the new capability receive the existing stop request without the new parameter; those chats remain awake. Failed stops continue through the remaining chats and use the existing single toast. If an earlier Sleep already confirmed a chat stopped, a later failed Sleep keeps that earlier confirmed state; the workspace can remain asleep and hidden. This is intended: the failed request does not erase the host's last confirmed state.

A legacy chat whose host cannot be identified keeps its workspace awake and visible under Hide sleeping, as on main. Once its host is known, that host’s actual Sleep state applies. This is intended.

Why

An idle or absent chat process does not mean the user chose Sleep. The execution host stores that explicit fact with the chat, so another client's new message can clear it and a restart can restore it. This replaces the earlier saved window record and wake-on-open behavior.

Differences from the common pattern are intended: explicit workspace Sleep also coordinates terminals and chats across publishing hosts, so only a proved stop can mark a chat. Existing startup and send behavior stays on its normal path.

Linked Issue

Reported in the workspace Sleep discussion. The stopping behavior is tracked in merged PR #28445; this PR adds sleeping presentation and visibility.

Visual Proof

The saved-profile comparison below ran on M4Air: main 3be5039eed0a versus branch 75fdf27bb05e. It covered the same chats/profile through main restart and branch upgrade/restart. Both Claude and Codex produced two real replies after restart, one from the desktop composer and one from an independent authenticated WebSocket client. Held drafts, queued submission, replay, both card styles, board, palette, batch Sleep, folder exemptions and default terminal recreation were exercised.

Main after Sleep with Hide sleeping enabled:

Main retains slept native-chat workspaces

Branch with the same saved inventory and filter:

Branch hides slept native-chat workspaces

Quiet slept chat shows Sleeping in New cards

On that branch head, a fresh-profile restart passed continuous document-mutation observation for 60 seconds (3,561 frames, zero target-row insertions or visible samples through the first host answer). Opening retained history and the saved Sleep mark; a real composer send replied and restored visibility. Opening can run the existing model-list probe without resuming the saved conversation.

Sleep during a running Codex turn stopped its process, saved the mark and hid it in both card styles for 20 seconds each. A real send/reply cleared the mark and kept it visible. When shown, its card retained Interrupted · Unread because existing attention takes precedence over Sleeping; quiet slept chats show Sleeping.

Running Codex before Sleep

Hidden after mid-turn Sleep

Visible after real send and reply

Final-head real Electron QA passed on exact cbb493e on M4Air (ticket 1016, isolated profile, real Claude and Codex through the load balancers). Context-menu Sleep stopped both providers with no failure toast. New cards showed the moon and accessible Sleeping label; both card styles hid the workspaces. Opening retained history and Sleep. A real Claude send cleared Sleep, replied, retained the chat name and stayed visible under Hide sleeping for 20 seconds. Restart preserved Codex's original mark: a pre-document mutation observer plus 3,132 frames over 60 seconds recorded zero slept-row insertions or visible frames, including the first host answer at 5.2 seconds. Show sleeping revealed the retained row. The moon plus accessible label is the existing rendering; no visible tooltip is required. Existing Interrupted/Unread attention still takes precedence over Sleeping.

The QA lead verified cleanup of all recorded processes and listeners and removed its throwaway profiles. The report is /Users/m4air/orca-qa/pr-28457/final-cbb493e/REPORT.md; the lane owner accepted F1/F2 on this head. Earlier saved-profile upgrade/restart, two real replies per agent, queue/replay and running-Codex Sleep evidence is historical and is not relabelled as final-head execution.

Current-head captures:

Before Sleep, real Claude and Codex

After Sleep, moon and accessible Sleeping

After real send and reply

After restart, retained slept chat revealed

Testing

Full review path: saved lifecycle, process-stop receipts, startup ordering and optional mixed-version host data require full review and real QA.

Current head: cbb493eb24ba7bfd6c4409fbc090bf76f63f62c8, with merged-main parent f7c07409d6e8f453b4e8ae7459e0267ffa993ff4. Integration preserves main's chat naming/skill behavior and host-owned Sleep. Main's naming-only snapshot cannot resolve unanswered Sleep state; an actual-event regression failed before that correction and passed afterward. Before the final line-budget consolidation, 12 named suites passed 210 tests. The initial merged-head workflow failed because the new renderer regression imported host-only modules. Test-only follow-up cbb493e removes those imports, preserves the shared protocol regression and pins the actual publisher in its host suite; production is unchanged. The two affected suites passed all 16 tests, and normal commit hooks passed. Fresh independent final integration/reference/readiness review passed on this exact head with no open proven defect. The full PR workflow 39542491347 is green on this exact head (attempt 2), including Windows packaging job 119037527462 and aggregate “PR checks passed” job 119039534804. The first attempt timed out waiting for an unchanged Windows test fixture; the lane owner reran its failed jobs once, and they passed. No source change or additional retry was made. Owner-run exact-head QA passed as recorded above. Earlier broader QA remains explicitly historical.

The full loop corrected separate send/mark writes, a history-reopen race and failed first-contact handling. New sends clear Sleep inside the existing journal transaction; a host-memory admission count supersedes stale stop receipts; first contact remains unknown until the actual host answers. No send startup gate was added. Earlier architecture/correctness/presentation, security, performance and compatibility reviews are recorded in the loop; the final independent check verifies their integration on the new head.

Not exercised live; automated contracts and source review provide the remaining evidence:

Cases Automated evidence and limits
Stop proof, starting/acquiring agents, newer-send race, history reopen, rollback/replay, ordinary unmarked stop structured-agent-session-workspace-sleep-lifetime.test.ts and structured-agent-session-queued-action-receipts.test.ts; real remote/error timing is not certified.
Batch/multi-host stop, teardown refusal, failed member/one toast, twin/subtree targets sleep-worktree-flow.test.ts, sleep-twin-confirmation.test.ts, workspace-lineage-menu-actions.test.ts; individual dashboard/phone menu triggers were source-traced, not exercised live.
First contact, capability probing, cached answer/disconnect, unidentified owner structured-agent-session-status-feed.test.ts and structured-chat-sleep-startup.test.tsx; mocked transport, not a real old or disconnected remote host.
Hidden-workspace notifications and linked-review refresh hidden-workspace-notification-mute.test.ts covers existing filter/notification policy; workspace-reference-refresh-targets.test.ts covers the existing scheduler/owner selection. Applying these policies to a slept chat was source-traced, not exercised live or asserted by a new end-to-end test.
Phone/CLI/worker entry points, configured setup-script parity, remaining history/Vault consumers Shared host/window contracts and source tracing only; no claim that these individual UI or configured-script flows ran.

The lane owner's accepted QA scope distinguishes these from the live core path. An independent WebSocket client is transport coverage, not shipped phone UI or CLI coverage.

Review

The new admission-race thread was independently refuted and resolved: normal Send, Send-now and automatic queue drain all hold the same per-session queue through receipt commit, and the final Sleep operation holds that queue through its awaited store write. An earlier send invalidates the Sleep receipt; a later send clears the mark. No extra guard or production change was needed. The lane owner’s single failed-job rerun and final-head QA passed.

The earlier saved-window design was replaced with the execution host's persisted fact. The full review loop, independent final integration/reference check, full CI and owner-accepted real-agent QA are complete on the current head. The original status comment is updated in place with the exact-head marker; no new comment was created. No open proven defect or unresolved review thread remains. Unmeasured scale/performance concerns remain disclosed in the private source report; no benchmark or all-platform live guarantee is claimed.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied.

Notes

Intended existing policies now apply to slept chats: linked-review refresh can pause even while history is selected; shortcut/palette membership follows visible rows while typed search can reveal slept workspaces; disabling Notify About Hidden Workspaces can mute notifications for hidden slept chats. These policies and defaults are unchanged.

The existing whole-workspace twin model, terminal teardown-owner refusal and host-owned status rows remain. Folder workspaces and paired/SSH execution were source-reviewed; their individual remote UI flows were not all exercised live. No minimum server version is introduced.

Checklist

  • Problem, user-facing change, mechanism and alternatives explained
  • Automated behavior coverage added and consolidated
  • Final-head independent integration and reference review
  • Full PR workflow green on final head
  • Final-head real-agent QA and fresh visual evidence

@brennanb2025
brennanb2025 force-pushed the brennanb2025/sleep-stops-native-chat branch from 4f5bd1f to 9d4018c Compare October 14, 2026 07:42
@brennanb2025
brennanb2025 force-pushed the brennanb2025/slept-chat-workspace-hides branch from d4779c1 to 3f08225 Compare October 14, 2026 08:56
@brennanb2025

brennanb2025 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Sleep already stops native chat agents, but retained chat tabs keep the workspace looking awake and visible under “Hide sleeping workspaces.” This PR saves explicit Sleep on the execution host. Slept workspaces hide and stay asleep across restart; opening shows history, and an admitted new message wakes the chat through the existing send path.

Full review completed on cbb493eb24ba7bfd6c4409fbc090bf76f63f62c8. The loop fixed atomic send/Sleep-clear, stale stop receipts, unanswered-host startup and integration with naming-only status metadata. The final independent integration/reference/readiness check passed with no open proven defect. A new admission-race claim was refuted: all three submission paths and final Sleep share the same session queue through their commits; the thread is resolved without an extra guard. No open findings require deferral; unmeasured scale concerns remain limitations, not proven defects.

CI: full PR workflow 39542491347, attempt 2 passed on this exact head, including Windows packaging and aggregate PR checks passed. Named integration tests passed 210 tests; the test-only project-boundary correction passed 16 affected tests. The first corrected-head CI attempt timed out starting an unchanged Windows fixture; the owner's single failed-job rerun passed.

Final-head M4Air QA passed with real Claude and Codex: explicit Sleep stopped both, no failure toast, moon/accessibility Sleeping, hide in both styles, opening retained Sleep, and a real Claude wake/reply retained its name and visibility for 20 seconds. Restart observation recorded zero slept-row insertions/visible frames across 3,132 frames and continuous mutations for 60 seconds, through the first host answer at 5.2 seconds. Show sleeping restored Codex's original mark. The owner accepted these gates; the rig was cleaned. Prior saved-profile main-versus-branch upgrade/restart and two replies per agent remain historical coverage, not new-head claims.

Intended behavior: an identified unanswered host stays unknown; an unidentified legacy owner stays awake/visible; old hosts stop without marking; a prior confirmed Sleep survives a later failed Sleep. Existing Interrupted/Unread attention and whole-workspace teardown-owner refusal remain. Existing review-refresh, palette/shortcut and hidden-notification preferences now also apply to slept chats.

Not exercised live: all stop-failure/race/internal-move cases, multi-host/twin/subtree/phone/dashboard triggers, real old/disconnected hosts, configured setup scripts and every phone/CLI/worker/Vault route. The PR body maps these to named tests or source-only evidence. Notification and review-refresh tests cover their existing policies; their slept-chat combinations were source-traced. These limits follow the lane owner's QA scope disposition.

For Brennan's review

Historical main after Sleep with Hide sleeping:

Main retains slept native chats

Final-head before Sleep, sleeping presentation, wake/reply and restart reveal:

Before Sleep

Sleeping

After wake and reply

After restart reveal

Three judgment points: proved-stop marking, wake in the existing admission transaction, and naming metadata leaves unanswered Sleep unknown.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/sleep-stops-native-chat branch 4 times, most recently from 06217f7 to 1d79a56 Compare October 15, 2026 03:28
@brennanb2025
brennanb2025 force-pushed the brennanb2025/slept-chat-workspace-hides branch from 3f08225 to 786fb00 Compare October 15, 2026 07:19
@brennanb2025
brennanb2025 force-pushed the brennanb2025/sleep-stops-native-chat branch 2 times, most recently from 685ac16 to ba9385a Compare October 15, 2026 14:12
@brennanb2025
brennanb2025 force-pushed the brennanb2025/slept-chat-workspace-hides branch 12 times, most recently from 8166736 to e77be71 Compare October 19, 2026 06:21
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/sleep-stops-native-chat to main October 19, 2026 07:34
@brennanb2025
brennanb2025 marked this pull request as ready for review October 19, 2026 07:34
@brennanb2025
brennanb2025 force-pushed the brennanb2025/slept-chat-workspace-hides branch from e77be71 to f284818 Compare October 19, 2026 07:34
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7fa7a86e-c3bc-4ad6-9c4a-97f4ff9f5758
📥 Commits

Reviewing files that changed from the base of the PR and between 9ff4572 and 3963fbd.

📒 Files selected for processing: 9
  • src/main/runtime/agent-session-record-store.ts
  • src/main/runtime/rpc/methods/structured-agent-session.ts
  • src/renderer/src/components/native-chat/structured-chat-sleep-projection.ts
  • src/renderer/src/components/native-chat/structured-chat-sleep-startup.test.tsx
  • src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/structured-chat-slept-at.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/structured-agent-session-params.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.

📝 Walkthrough

The change adds persisted sleep timestamps to structured-chat records and status summaries. Workspace Sleep requests can mark eligible stopped chats, while admitted sends clear the mark. The renderer receives session sleep state through the status feed and stores it by pane. Sidebar visibility, worktree sleep state, and workspace activity calculations now use this data. The change also adds coverage for sleep marking, status updates, host capability handling, and worktree behavior.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 3963f

A chat could be shown as asleep without its host confirming a stop, and a failed restoration could block status updates. Resolve or explicitly accept these risks before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 92 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is detailed and covers the required user impact, implementation, rationale, testing, visual proof, review notes, compatibility considerations, and checklist. However, the Linked Issue … Add the actual issue reference in the required Fixes #... format. Add the AI Disclosure section with the model details if the author is an outside contributor; otherwise state that the internal-contributor exception applies if repository …
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: slept native-chat workspaces are recognized as asleep and hidden.
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.
Full details: Description check

Explanation

The description is detailed and covers the required user impact, implementation, rationale, testing, visual proof, review notes, compatibility considerations, and checklist. However, the Linked Issue section does not provide an actual issue or a Fixes #... reference; it references merged PR #28445 instead. The AI Disclosure section is also absent, unless the author is an internal maintainer covered by the template exception.

Resolution

Add the actual issue reference in the required Fixes #... format. Add the AI Disclosure section with the model details if the author is an outside contributor; otherwise state that the internal-contributor exception applies if repository policy requires explicit confirmation.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • 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: 1

🔇 Additional comments: 45
src/shared/workspace-chat-sleep-schema.ts: 1

1-14: LGTM!

src/shared/workspace-session-state-types.ts: 1

11-11: LGTM!

Also applies to: 136-137

src/shared/workspace-chat-sleep.ts: 1

1-131: LGTM!

src/shared/workspace-layout/workspace-layout-beside.ts: 1

46-46: LGTM!

src/shared/workspace-layout/workspace-layout-fact-locations.test.ts: 1

152-154: LGTM!

src/shared/workspace-layout/workspace-layout-round-trip.test.ts: 1

40-51: LGTM!

src/shared/workspace-session-host-field-ownership.ts: 1

54-54: LGTM!

Also applies to: 106-107

src/shared/workspace-session-schema-field-coverage.test.ts: 1

54-54: LGTM!

Also applies to: 108-121

src/shared/workspace-session-schema.ts: 1

36-36: LGTM!

Also applies to: 313-313

src/renderer/src/lib/workspace-session.ts: 1

62-62: LGTM!

Also applies to: 102-102, 269-269, 282-289, 336-338

src/renderer/src/lib/workspace-session-patch.ts: 1

195-197: LGTM!

src/renderer/src/lib/workspace-session-relevant-fields.test.ts: 1

38-38: LGTM!

src/renderer/src/lib/workspace-session-host-split.test.ts: 1

117-119: LGTM!

src/shared/wsl-move/wsl-move-dispositions.ts: 1

138-141: LGTM!

src/main/orca-profiles/profile-project-session-field-disposition.ts: 1

120-123: LGTM!

src/main/orca-profiles/profile-project-session-field-disposition.test.ts: 1

264-264: LGTM!

Also applies to: 279-279

src/main/orca-profiles/profile-project-session-state.test.ts: 1

9-9: LGTM!

Also applies to: 17-71

src/main/orca-profiles/profile-project-session-state.ts: 1

126-133: LGTM!

src/main/persistence/migrating-orcad-catalog/orcad-source-release-upgrade.test.ts: 1

238-240: LGTM!

Also applies to: 244-244

src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session.ts: 1

167-168: LGTM!

src/main/persistence/restoring-sessions/session-owner-fields.test.ts: 1

66-66: LGTM!

Also applies to: 68-69, 77-81, 91-93

src/main/persistence/restoring-sessions/session-owner-fields.ts: 1

10-15: LGTM!

Also applies to: 19-21, 25-27, 100-102, 104-105

src/main/persistence/restoring-sessions/session-worktree-ownership.ts: 1

53-54: LGTM!

src/main/persistence/tracking-repos/worktree-identity-migration-field-coverage.test.ts: 1

209-223: LGTM!

src/main/persistence/tracking-repos/worktree-identity-migration.ts: 1

12-12: LGTM!

Also applies to: 193-194

src/shared/workspace-chat-sleep.test.ts: 1

1-31: LGTM!

src/renderer/src/store/slices/worktree-helpers.ts: 1

47-50: LGTM!

Also applies to: 113-123

src/renderer/src/store/slices/worktrees/session/worktree-slice-initial-state.ts: 1

13-13: LGTM!

Also applies to: 36-36

src/renderer/src/store/slices/worktrees/session/workspace-chat-sleep.ts: 1

1-81: LGTM!

src/renderer/src/store/slices/worktrees.ts: 1

6-6: LGTM!

Also applies to: 74-74

src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts: 1

21-21: LGTM!

Also applies to: 120-123, 142-142, 168-171

src/renderer/src/store/slices/worktrees/session/worktree-identity-rename-state.ts: 1

10-10: LGTM!

Also applies to: 227-238

src/renderer/src/store/slices/tabs/tabs-close-actions.ts: 1

19-19: LGTM!

Also applies to: 111-129, 177-179

src/renderer/src/store/slices/tabs/tabs-session-actions.ts: 1

14-14: LGTM!

Also applies to: 97-103, 107-108, 113-136

src/renderer/src/store/slices/worktrees-workspace-selection-state.test.ts: 1

3-3: LGTM!

Also applies to: 60-97

src/renderer/src/store/slices/worktrees/teardown/remove-worktree-store-cleanup.ts: 1

10-10: LGTM!

Also applies to: 92-95

src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts: 1

14-14: LGTM!

Also applies to: 63-66, 160-163

src/renderer/src/store/slices/worktrees/teardown/purge-stale-runtime-host-state.ts: 1

2-2: LGTM!

Also applies to: 22-25, 220-220, 222-231, 276-276

src/renderer/src/store/slices/purge-stale-runtime-host-state.test.ts: 1

198-213: LGTM!

src/renderer/src/store/slices/worktrees/teardown/remove-worktree-map-identity.test.ts: 1

28-28: LGTM!

Also applies to: 69-69, 84-88, 97-99

src/renderer/src/store/terminals/workspace-terminal-hydration-patch.ts: 1

21-21: LGTM!

Also applies to: 169-170

src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts: 1

10-10: LGTM!

Also applies to: 94-98, 112-115

src/renderer/src/runtime/web-session-tabs-sync/state.ts: 1

243-243: LGTM!

src/renderer/src/store/terminals/workspace-terminal-hydration.ts: 1

171-172: 🗄️ Data Integrity & Integration

No production pull caller reaches this branch. The only production invocation of hydrateWorkspaceSession is startup hydration in src/renderer/src/app-shell/use-app-startup-hydration.ts:202, and it passes startup replacement options. The stale-map overwrite through an SSH pull is therefore not reachable from the inspected source, so no change is required here.

src/shared/tab-types.ts-73-73: 1

73-73: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Remove the orphaned JSDoc comment.

Line 73 describes a client-only field ("When Sleep stopped this chat's agent; activating its workspace clears it."). Tab does not declare that field. The Sleep state lives in explicitlySleptChatsByWorkspace instead. The comment now sits directly above the viewMode JSDoc. TypeScript tooling can attach both comments to viewMode, so hover text and generated docs describe viewMode incorrectly.

Proposed fix
   agentSessionAgent?: AgentType
-  /** When Sleep stopped this chat's agent; activating its workspace clears it. Client-only. */
   /** Why: per-tab rendering mode for coding-agent terminals. `'chat'` shows the

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 619eeaae-8a57-46dd-9419-2997b16710c0
📥 Commits

Reviewing files that changed from the base of the PR and between 5be871e and f284818.

📒 Files selected for processing: 64
  • src/main/orca-profiles/profile-project-session-field-disposition.test.ts
  • src/main/orca-profiles/profile-project-session-field-disposition.ts
  • src/main/orca-profiles/profile-project-session-state.test.ts
  • src/main/orca-profiles/profile-project-session-state.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-release-upgrade.test.ts
  • src/main/persistence/migrating-orcad-catalog/orcad-source-workspace-session.ts
  • src/main/persistence/restoring-sessions/session-owner-fields.test.ts
  • src/main/persistence/restoring-sessions/session-owner-fields.ts
  • src/main/persistence/restoring-sessions/session-worktree-ownership.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration-field-coverage.test.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration.ts
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/components/sidebar/sleep-worktree-flow.test.ts
  • src/renderer/src/components/sidebar/sleep-worktree-flow.ts
  • src/renderer/src/components/sidebar/use-visible-workspace-kanban-worktree-ids.ts
  • src/renderer/src/components/sidebar/use-worktree-context-menu-model.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.ts
  • src/renderer/src/components/sidebar/visible-worktree-activity-inputs.ts
  • src/renderer/src/components/sidebar/visible-worktree-options-from-state.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.test.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.ts
  • src/renderer/src/components/sidebar/worktree-context-menu-policy.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-filters.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.ts
  • src/renderer/src/components/use-worktree-jump-palette-store-state.ts
  • src/renderer/src/components/use-worktree-jump-palette-worktrees.ts
  • src/renderer/src/lib/workspace-session-host-split.test.ts
  • src/renderer/src/lib/workspace-session-patch.ts
  • src/renderer/src/lib/workspace-session-relevant-fields.test.ts
  • src/renderer/src/lib/workspace-session.ts
  • src/renderer/src/lib/worktree-activity-state.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state.ts
  • src/renderer/src/store/slices/agent-status-live-facts.ts
  • src/renderer/src/store/slices/purge-stale-runtime-host-state.test.ts
  • src/renderer/src/store/slices/tabs/tabs-close-actions.ts
  • src/renderer/src/store/slices/tabs/tabs-session-actions.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/renderer/src/store/slices/worktrees-workspace-selection-state.test.ts
  • src/renderer/src/store/slices/worktrees.ts
  • src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts
  • src/renderer/src/store/slices/worktrees/session/workspace-chat-sleep.ts
  • src/renderer/src/store/slices/worktrees/session/worktree-identity-rename-state.ts
  • src/renderer/src/store/slices/worktrees/session/worktree-slice-initial-state.ts
  • src/renderer/src/store/slices/worktrees/teardown/purge-stale-runtime-host-state.ts
  • src/renderer/src/store/slices/worktrees/teardown/remove-worktree-map-identity.test.ts
  • src/renderer/src/store/slices/worktrees/teardown/remove-worktree-store-cleanup.ts
  • src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts
  • src/renderer/src/store/terminals/workspace-terminal-hydration-patch.ts
  • src/renderer/src/store/terminals/workspace-terminal-hydration.ts
  • src/shared/tab-types.ts
  • src/shared/workspace-chat-sleep-schema.ts
  • src/shared/workspace-chat-sleep.test.ts
  • src/shared/workspace-chat-sleep.ts
  • src/shared/workspace-layout/workspace-layout-beside.ts
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/shared/workspace-layout/workspace-layout-round-trip.test.ts
  • src/shared/workspace-session-host-field-ownership.ts
  • src/shared/workspace-session-schema-field-coverage.test.ts
  • src/shared/workspace-session-schema.ts
  • src/shared/workspace-session-state-types.ts
  • src/shared/wsl-move/wsl-move-dispositions.ts

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

Comment thread src/renderer/src/components/sidebar/sleep-worktree-flow.ts Outdated
@brennanb2025
brennanb2025 marked this pull request as draft October 19, 2026 20:15
The fact "the user's Sleep put this chat to rest" now lives on the host
that runs the chat, on its session record, instead of in the window.

- New runtime capability agent-session.workspace-sleep-mark.v1 and an
  optional markAsleep on agentSession.sleepWorkspace (strict params, so
  only hosts advertising the capability are sent it).
- The Sleep close decides each chat's receipt inside the same per-session
  step that stopped it; with markAsleep it writes sleptAt in that step's
  record write, so a chat is marked exactly when it is in the receipt.
- The next send the host hands over clears sleptAt, whichever client sent
  it; the idle sweep and plain stops never mark.
- sleptAt rides the status summary (optional field), its equality, and
  the retained summary of a closed chat, so it survives restart through
  the persisted tab index.
…ow record

The window no longer keeps its own saved record of which chats Sleep
stopped (explicitlySleptChatsByWorkspace). That record had to mirror every
host event that should end it (sends, replaced conversations, renames,
profile and WSL moves, removal, wakes during teardown), and each missed
mirror was a bug. The host now owns the fact (previous commit).

- Delete the record, its schema, store slice, workspace-session field
  registrations, moves, renames, purges, migrations and hydration, and the
  renderer clearing hooks. Those files are back to main.
- Opening a workspace no longer wakes its slept chats (product ruling):
  drop the chat Sleep-attempt tokens and their set-active-worktree hook. A
  slept chat wakes only when a send reaches its host, from any client.
- The status bridge mirrors each chat tab's published sleptAt into a
  store map keyed by the chat's pane key, dropped when its projection
  unmounts and never saved; a chat whose host runs it again is not slept.
- The asleep derivation, hide filter, palette, board and context menu read
  that map. Explicit Sleep sends markAsleep only to the local host and to
  hosts last probed with the new capability; a project move never does.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 20, 2026 00:42

@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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3a377f6-e254-48b2-8ff1-92a3db3b6662
📥 Commits

Reviewing files that changed from the base of the PR and between f284818 and 2fac7c2.

📒 Files selected for processing: 43
  • docs/reference/agent-browser-focus-isolation.md
  • src/main/native-chat/agent-session-wire/structured-agent-session-client-delivery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-mutation-turn-context.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-conversation-name.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-summary-equality.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-summary.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turns.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep-lifetime.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep.ts
  • src/main/runtime/rpc/methods/structured-agent-session-workspace-sleep.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.ts
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/components/sidebar/sleep-workspace-chat-stop.ts
  • src/renderer/src/components/sidebar/sleep-worktree-flow.test.ts
  • src/renderer/src/components/sidebar/sleep-worktree-flow.ts
  • src/renderer/src/components/sidebar/use-visible-workspace-kanban-worktree-ids.ts
  • src/renderer/src/components/sidebar/use-worktree-context-menu-model.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.ts
  • src/renderer/src/components/sidebar/visible-worktree-activity-inputs.ts
  • src/renderer/src/components/sidebar/visible-worktree-options-from-state.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.test.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.ts
  • src/renderer/src/components/sidebar/worktree-context-menu-policy.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-filters.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.ts
  • src/renderer/src/components/use-worktree-jump-palette-store-state.ts
  • src/renderer/src/components/use-worktree-jump-palette-worktrees.ts
  • src/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/store-test-helpers.ts
  • src/renderer/src/store/slices/structured-chat-slept-at.ts
  • src/renderer/src/store/types.ts
  • src/shared/agent-session-record-stored-form.test.ts
  • src/shared/agent-session-record-stored-form.ts
  • src/shared/agent-session-record.ts
  • src/shared/agent-session-wire.ts
  • src/shared/agent-session-workspace-sleep.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/structured-agent-session-params.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.

@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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 934d7bf7-773f-477d-85fa-e4f3012d68be
📥 Commits

Reviewing files that changed from the base of the PR and between 2fac7c2 and aa0bd59.

📒 Files selected for processing: 19
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-messages.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-mutations.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-wiring.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep-lifetime.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep-queued.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep.ts
  • src/main/runtime/rpc/methods/structured-agent-session-status-stream.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-status-stream.ts
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/components/native-chat/structured-chat-sleep-projection.ts
  • src/renderer/src/components/native-chat/structured-chat-sleep-startup.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.ts
  • src/renderer/src/components/sidebar/visible-worktree-activity-inputs.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.test.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.test.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
  • src/renderer/src/store/slices/structured-chat-slept-at.ts

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

@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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab0669e8-4336-48ec-8f3a-8ab1a5ad5d7d
📥 Commits

Reviewing files that changed from the base of the PR and between aa0bd59 and 9ff4572.

📒 Files selected for processing: 17
  • src/main/native-chat/agent-session-wire/structured-agent-session-conversation-lifetime.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-messages.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-wiring.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep-lifetime.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep-stop.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep.ts
  • src/main/runtime/agent-session-operation-receipt.ts
  • src/main/runtime/agent-session-record-store.ts
  • src/main/runtime/agent-session-store-transactions.ts
  • src/renderer/src/components/native-chat/structured-chat-sleep-startup.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.structured-title.test.tsx
  • src/renderer/src/components/sidebar/use-visible-workspace-kanban-worktree-ids.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.test.tsx
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.test.ts
  • src/renderer/src/components/sidebar/workspace-lineage-menu-actions.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.test.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
💤 Files with no reviewable changes: 2
  • src/renderer/src/components/sidebar/use-worktree-sleep-state.test.tsx
  • src/renderer/src/runtime/structured-agent-session-status-feed.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.

@brennanb2025
brennanb2025 merged commit ae9bc8d into main Oct 21, 2026
77 of 79 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/slept-chat-workspace-hides branch October 21, 2026 05:45
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