feat: Add agent sync#146
Merged
Merged
Conversation
alex289
reviewed
May 7, 2026
timokoessler
reviewed
May 8, 2026
timokoessler
reviewed
May 8, 2026
818964a to
e21bad4
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an initial “agent sync/deploy” flow: the Hub can request an Agent deployment over WebSocket, the Agent writes the compose file to a deployments directory and runs docker compose up, and the Hub updates application sync/health status; the UI gets a manual trigger.
Changes:
- Add protobuf messages + Hub WebSocket plumbing to start a deploy request and correlate an async deploy result.
- Add Hub-side deploy manager + application route (
POST /applications/:id/deploy) and integrate deployment into the sync worker. - Add Agent-side deploy execution that writes compose files into a configured deployments directory and runs Docker Compose, plus docker-compose volume/env wiring and frontend trigger.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/routes/_authenticated/applications/$id.index.tsx | Replace fake “sync” delay with a real deploy call and UI disabled/loading state. |
| frontend/src/lib/applications.ts | Add deployApplication() API client for /applications/:id/deploy. |
| frontend/messages/en.json | Add deploy-related i18n strings. |
| frontend/messages/de.json | Add deploy-related i18n strings (German). |
| docker-compose.yml | Mount agent deployments volume into the container. |
| docker-compose.dev.yml | Mount deployments volume and set DEPLOYMENTS_DIR for dev agent. |
| backend/internal/proto/messages.proto | Add DeployRequest/DeployResult messages in WS protocol. |
| backend/internal/hub/websocket/hub.go | Track pending deploys; start deploy requests; resolve results; fail pending on disconnect. |
| backend/internal/hub/websocket/hub_test.go | Add tests for deploy request lifecycle and disconnect/unavailable scenarios. |
| backend/internal/hub/websocket/handler.go | Handle inbound DeployResult messages and resolve pending deploys. |
| backend/internal/hub/websocket/handler_test.go | Update tests for new handler signature and behavior. |
| backend/internal/hub/routes/applications.go | Add DeployApplicationHandler HTTP endpoint to trigger agent deployment and mark app syncing. |
| backend/internal/hub/routes/applications_test.go | Add route tests for deploy success and agent-unavailable behavior. |
| backend/internal/hub/handlers.go | Register deploy route and initialize the default deployer with the WS hub. |
| backend/internal/hub/applications/sync.go | Replace placeholder deployment logic with DeployAndWait and status updates based on result. |
| backend/internal/hub/applications/deploy.go | New Hub-side deploy manager: start deploys, await/track manual deploys, and update statuses + SSE. |
| backend/internal/hub/applications/applications_test.go | Update sync/queue tests to stub deployer and allow new deployment behavior. |
| backend/internal/agent/websocket.go | Handle DeployRequest server messages; execute deployment; send DeployResult; serialize outbound writes. |
| backend/internal/agent/websocket_test.go | Add tests for deploy request handling and deploy result sending. |
| backend/internal/agent/docker/docker.go | Add deploymentsDir to docker client and update constructor signature. |
| backend/internal/agent/docker/docker_test.go | Update docker client tests for new constructor signature. |
| backend/internal/agent/docker/deploy.go | New agent deploy implementation: write compose file to deployments dir and run compose up with wait. |
| backend/internal/agent/docker/deploy_test.go | Add tests for deploy writing/compose invocation and (intended) unsafe id rejection. |
| backend/internal/agent/agent.go | Wire DEPLOYMENTS_DIR into docker client and pass sender/deployer into WS handler. |
| backend/internal/agent/agent_config_test.go | Add tests for default and overridden DEPLOYMENTS_DIR. |
| .env.example | Document DEPLOYMENTS_DIR env var for the agent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alex289
reviewed
May 11, 2026
e09f8a0 to
c50e224
Compare
BREAKING CHANGE: the deployments dir is now hardcode to /deployments
66399ab to
4c994d3
Compare
Co-authored-by: Timo Kössler <info@timokoessler.de>
Co-authored-by: Timo Kössler <info@timokoessler.de>
a111808 to
0199182
Compare
alex289
approved these changes
May 26, 2026
alex289
approved these changes
May 26, 2026
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.
Type of change
Description
Fixes #33
This PR introduces the initial implementation of the agent sync. It copies docker-compose.yml into the agent volume, and sets the application status accordingly.