Skip to content

harden remote daemon recovery and log draining - #269

Open
damienrj wants to merge 5 commits into
mainfrom
codex/fix-remote-daemon-recovery
Open

harden remote daemon recovery and log draining#269
damienrj wants to merge 5 commits into
mainfrom
codex/fix-remote-daemon-recovery

Conversation

@damienrj

@damienrj damienrj commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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.

@damienrj
damienrj requested a review from a team September 1, 2026 18:44
Comment thread src-tauri/src/services/remote_backend/remote_daemon.sh Outdated
Comment thread src-tauri/src/services/remote_backend/remote_daemon.sh Outdated
Comment thread src-tauri/src/services/remote_backend/remote_daemon.sh Outdated
Comment thread src-tauri/src/services/remote_backend/remote_daemon.sh Outdated
Comment thread src-tauri/src/services/remote_backend/mod.rs Outdated
Comment thread src-tauri/src/services/remote_backend/remote_daemon.sh Outdated

@morgmart morgmart left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

Comment thread src/features/remoteHosts/stores/remoteHostStore.ts
Comment thread src/features/remoteHosts/ui/RemoteHostsSettings.tsx
@damienrj
damienrj force-pushed the codex/fix-remote-daemon-recovery branch from 742fbb5 to 639e59e Compare September 2, 2026 07:29
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.

3 participants