Repository navigation
feat(cli): add workspace sleep and keep slept tabs on the desktop - #920
Merged
Merged
Conversation
# Conflicts: # lib/src/features/workbench/infra/terminal_host/terminal_host_protocol.dart # rust/alera-cli/src/terminal_host/protocol_capabilities.rs # test/unit/workbench_controller_test.dart
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the new alera workspace sleep command and the desktop fix that keeps a slept workspace's terminal tabs.
- CLI sleep:
alera workspace sleep --idsends the existingworkspace.sleepverb. It refuses the calling terminal, and unknown, removed, archived, and SSH-host workspaces. It records the sleep in the store only when no host is running, and fails instead when a live host does not answer. - Sleep removal cause: the host adds
reason: "workspaceSleep"and onesleepIdper sleep onterminalSessionRemovedbefore it answers the verb. Additive, no protocol bump. The desktop keeps that tab and releases the handle instead of treating the host's session end as a shell quit. - Reopen during a sleep: only the first removal of a
sleepIdcloses the workspace view. A reopen before the remaining removals arrive stays open, and an exited handle that is still on screen is released only after that workspace is left. - Older hosts: a removal without the reason still checks
workspace.sleptTabs, which the host records before it ends sessions, before the tab is closed.
grok-4.7 | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
alera workspace sleep --id <id>: the CLI form of the app's Sleep action. It sends the existingworkspace.sleephost verb: the workspace's terminal sessions stop, while tabs, layout, branch, and files stay and the workspace remains visible. Unlikearchiveit does not hide the workspace, and unlikeremove/unregisterit deletes nothing. It validates the workspace (unknown, removed, archived, or on an SSH host fail) and refuses the workspace of the calling terminal. Every host request has a deadline. When no host is running it records the sleep in the runtime store, and it fails instead when a host is alive but does not answer.--jsonreports the stopped terminal tab ids from the host's own record.terminalRuntimeExitCoordinatortreated each of those exits as a shell that quit and deleted the tab. This affected every Sleep, from the UI as well as the CLI.terminalSessionRemovednow carriesreason: "workspaceSleep"and onesleepIdper sleep (additive; no protocol bump). The desktop maps them toTerminalExitCauseand keeps the tab, releasing or keeping its exited handle depending on whether the workspace is on screen. It closes the workspace view only on the first removal of each sleep. Against an older host it falls back toworkspace.sleptTabs.skills/alera-cli/references/workspaces.mdanddocs/workspace-storage.md.Validation
flutter analyzeis clean, and the fullflutter testrun passes (4396).cargo clippy --workspace --all-targets -D warningsis clean,cargo test -p alera-cli --binspasses (1868), andterminal_host_sleep_conformancepasses. The conformance test runs the real CLI against a real host: it stops only the target workspace's sessions, keeps tabs and branch, leaves the workspace unarchived, and checks the removal reason andsleepId.terminal_host_conformancepasses too.workbench_controller_sleep_exit*_test_cases.dartwere each confirmed to fail with their fix reverted.Risks
workspace.sleptTabsfallback, which can still lose a tab if a sibling wakes the workspace mid-lookup.