Skip to content

T-7.5: Reconciliation at server startup#74

Merged
kirich1409 merged 1 commit intomainfrom
feature/t75-reconciliation
Apr 13, 2026
Merged

T-7.5: Reconciliation at server startup#74
kirich1409 merged 1 commit intomainfrom
feature/t75-reconciliation

Conversation

@kirich1409
Copy link
Copy Markdown
Contributor

Summary

  • New reconciliation.rs — three-step startup sync (dead sessions, orphan containers, orphan networks)
  • Extended store.rs with list_active_sessions(), force_stop_session()
  • Extended docker.rs with list_managed_containers(), list_managed_networks(), remove_network_if_exists()
  • Wired into main.rs at startup when relay.db exists

Closes #26

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 13, 2026 20:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.rs implementing a 3-step startup cleanup (dead sessions, orphan containers, orphan networks) with logging.
  • Extended Store with list_active_sessions() and force_stop_session() to support reconciliation without optimistic-concurrency retries.
  • Extended DockerOrchestrator with helpers to list managed containers/networks and remove networks safely; wired reconciliation into run_server() when relay.db exists.

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.

Comment thread runner/src/reconciliation.rs
Comment thread runner/src/reconciliation.rs
Comment thread runner/src/reconciliation.rs
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>
@kirich1409 kirich1409 force-pushed the feature/t75-reconciliation branch from 120b99b to 3f038f8 Compare April 13, 2026 20:46
@kirich1409 kirich1409 merged commit 4df99c9 into main Apr 13, 2026
10 checks passed
@kirich1409 kirich1409 deleted the feature/t75-reconciliation branch April 13, 2026 20:51
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.

T-7.5: Reconciliation при старте сервера

2 participants