harden remote daemon recovery and log draining - #269
Conversation
morgmart
left a comment
There was a problem hiding this comment.
🤖 Automated code review
REQUEST_CHANGES: the new Forget lifecycle can be undone by already-admitted frontend status work, allowing a forgotten host to reappear, and expected Forget refusals have no visible feedback. Supplied GitHub evidence is structurally available and all listed checks completed successfully, but required checks independently govern merge readiness.
Deterministic publication result: 1 blocking and 1 non-blocking finding(s) publishable; 0 duplicate(s) suppressed.
742fbb5 to
639e59e
Compare
morgmart
left a comment
There was a problem hiding this comment.
🤖 Automated code review
REQUEST_CHANGES: asynchronous disconnect and shutdown completions can still overwrite or act on a replacement host lifecycle, and the graphical Remote SSH hosts settings change has no screenshots or short recording. The supplied GitHub evidence is structurally available and all listed checks completed successfully; required checks independently govern merge readiness.
Deterministic publication result: 2 blocking and 0 non-blocking inline finding(s) publishable; 0 duplicate(s) suppressed; 1 blocking screenshot-evidence requirement(s) in this review body.
🤖 Blocking · Screenshots needed
This PR changes Berd’s graphical interface. Please add screenshots or a short screen recording so the visual result can be reviewed. Screenshots are review evidence; they do not replace accessibility, responsive, theme, localization, or behavior validation.
morgmart
left a comment
There was a problem hiding this comment.
🤖 Automated code review
REQUEST_CHANGES: shutdown failure can leave a killed tunnel displayed as ready, and a late Forget completion can erase a newer connection lifecycle. The graphical Remote SSH hosts settings change also lacks screenshots or a short recording. Supplied check evidence is structurally valid; Transcript virtualization is in progress, while the other listed checks succeeded. Required checks independently govern merge readiness.
Deterministic publication result: 2 blocking and 1 non-blocking inline finding(s) publishable; 0 duplicate(s) suppressed; 1 blocking screenshot-evidence requirement(s) in this review body.
🤖 Blocking · Screenshots needed
This PR changes Berd’s graphical interface. Please add screenshots or a short screen recording so the visual result can be reviewed. Screenshots are review evidence; they do not replace accessibility, responsive, theme, localization, or behavior validation.
morgmart
left a comment
There was a problem hiding this comment.
🤖 Automated code review
APPROVE: no new publishable findings remain in the exact PR comparison. The previously reported lifecycle, shutdown, Forget-scope, and pending-button issues are fixed or protected by resolved threads with substantive human replies. Visual evidence is present for the changed Remote SSH hosts settings surface. All supplied checks completed successfully; required checks independently govern merge readiness.
Deterministic publication result: 0 blocking and 0 non-blocking inline finding(s) publishable; 1 duplicate(s) suppressed; 0 blocking screenshot-evidence requirement(s) in this review body.
Pending checks: 1 check(s) are not complete.
This approval reflects the completed code review only; merge readiness remains governed by the repository's required checks.
**Category:** improvement **User Impact:** Users can add and select a new SSH environment directly from the chat composer. **Problem:** The environment picker only lists SSH hosts Berd already knows about, so adding a new host requires leaving the chat flow and finding the remote-host settings. **Solution:** Add a separated “Add SSH environment” action that opens an accessible connection dialog, accepts an SSH config alias or `user@host`, selects the environment after a successful connection, and keeps loading and error feedback in context. This PR is stacked on #269 and should merge after it. <details> <summary>File changes</summary> **src/features/chat/ui/AddRemoteHostDialog.tsx** Adds the focused connection dialog, including validation, pending-state protection, backend error feedback, and selection after a successful connection. **src/features/chat/ui/RemoteHostSelector.tsx** Adds the separated “Add SSH environment” menu action and preserves focus while transitioning from the environment menu into the dialog. **src/features/chat/ui/__tests__/RemoteHostSelector.test.tsx** Covers the empty-host menu, successful add-and-select flow, and retained dialog feedback when connection fails. **src/shared/i18n/locales/en/chat.json** Adds localized copy and accessible labels for the new environment action and dialog. </details>
Category: fix
User Impact: Remote SSH sessions recover reliably after interrupted cleanup, tolerate noisy startup logs, and let users remove broken ad-hoc hosts.
Problem: A crashed stale-lock reclaimer could block every future remote daemon operation, the chunked logger could backpressure Goose before it bound its port, and failed free-form hosts could become permanent settings rows. Solution: Reclaim lock generations atomically, drain startup logs through a native-speed bounded reader, and provide a terminal-state Forget operation that clears both backend and persisted UI state.
File changes
src-tauri/src/commands/remote_backend.rs
Exposes the inactive-host forget operation to the renderer.
src-tauri/src/lib.rs
Registers the new remote backend command.
src-tauri/src/services/remote_backend/daemon.rs
Adds deterministic kill-during-reclaim coverage and preserves the bounded-tail and 5 MiB pre-bind startup regressions.
src-tauri/src/services/remote_backend/mod.rs
Removes inactive host slots without allowing active connections to be orphaned, with focused registry tests.
src-tauri/src/services/remote_backend/remote_daemon.sh
Reclaims stale lock generations with one atomic rename and replaces the process-heavy chunk logger with a native-speed bounded FIFO reader.
src/features/remoteHosts/stores/remoteHostStore.test.ts
Covers complete cleanup of a broken host and preservation of local state when the backend rejects an active-host removal.
src/features/remoteHosts/stores/remoteHostStore.ts
Forgets backend state plus all persisted per-host metadata, including diagnostics, recent directories, and Goose overrides.
src/features/remoteHosts/ui/RemoteHostsSettings.tsx
Shows Forget for failed or disconnected ad-hoc hosts while leaving SSH-config hosts managed by SSH config.
src/features/remoteHosts/ui/tests/RemoteHostsSettings.test.tsx
Regresses the invalid free-form host case and verifies SSH-config hosts do not expose Forget.
src/shared/api/remoteHosts.ts
Adds the typed renderer wrapper for forgetting an inactive backend.