T-7.5: Reconciliation at server startup#74
Merged
kirich1409 merged 1 commit intomainfrom Apr 13, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Implements a server-startup reconciliation pass in the runner to synchronize SQLite session state with Docker resources after unexpected restarts/crashes (issue #26).
Changes:
- Added
runner/src/reconciliation.rsimplementing a 3-step startup cleanup (dead sessions, orphan containers, orphan networks) with logging. - Extended
Storewithlist_active_sessions()andforce_stop_session()to support reconciliation without optimistic-concurrency retries. - Extended
DockerOrchestratorwith helpers to list managed containers/networks and remove networks safely; wired reconciliation intorun_server()whenrelay.dbexists.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| runner/src/store.rs | Adds DB helpers for reconciliation: list active sessions and force-stop them. |
| runner/src/reconciliation.rs | New reconciliation module + unit tests for the new Store methods. |
| runner/src/main.rs | Runs reconciliation during startup when relay.db is present. |
| runner/src/docker.rs | Adds Docker listing/removal helpers for managed resources used by reconciliation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sync SQLite state with live Docker state on runner start: - Dead sessions (Starting/Running with no container) -> Stopped - Orphan containers (relay.managed=true, no DB) -> removed - Orphan networks (relay.managed=true, unused) -> removed Closes #26 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
120b99b to
3f038f8
Compare
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
reconciliation.rs— three-step startup sync (dead sessions, orphan containers, orphan networks)store.rswithlist_active_sessions(),force_stop_session()docker.rswithlist_managed_containers(),list_managed_networks(),remove_network_if_exists()main.rsat startup when relay.db existsCloses #26
🤖 Generated with Claude Code