feat(server): remote repo operations implementation #1122

Closed
freemo wants to merge 2 commits from feature/m9-remote-repos into master

2 Commits

Author SHA1 Message Date
freemo 5ce8bbd905 feat(server): remote repo operations implementation
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16m3s
CI / lint (pull_request) Successful in 19m32s
CI / typecheck (pull_request) Successful in 23m40s
CI / integration_tests (pull_request) Successful in 23m36s
CI / unit_tests (pull_request) Successful in 23m37s
CI / e2e_tests (pull_request) Successful in 25m9s
CI / quality (pull_request) Successful in 29m49s
CI / security (pull_request) Successful in 30m13s
CI / docker (pull_request) Successful in 1m10s
CI / coverage (pull_request) Successful in 11m16s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 59m57s
Implemented server-side remote repository operations allowing clients
to push/pull/fetch/status on server-managed repositories through the
A2A protocol without needing local clones.

Domain models:
- RepoRef, RepoOperationType, RepoSyncState, ConflictStrategy enums
- RepoStatusResult, RepoFetchResult, RepoPullResult, RepoPushResult,
  ConflictResolutionResult frozen dataclasses with to_dict() serialization

RemoteRepoService (application/services/remote_repo_service.py):
- status(): query sync state (ahead/behind/diverged/detached/no_remote)
- fetch(): fetch refs from remote with prune
- pull(): fetch + merge with conflict detection and auto-abort
- push(): push local commits with rejection detection
- resolve_conflicts(): abort/ours/theirs conflict resolution strategies
- Full argument validation, timeout handling, and structured error types

A2A facade wiring:
- Replaced _cleveragents/sync/* stubs with real repo operation handlers
- Added _cleveragents/repo/push, /pull, /fetch, /status endpoints
- Service-absent fallback returns backward-compatible stub responses
- Updated operation count from 42 to 46

Tests:
- Behave BDD: 39 scenarios covering domain models, service construction,
  type validation, real git operations, facade wiring, and ASGI dispatch
- Robot Framework: 7 integration tests exercising end-to-end import paths,
  real git subprocess operations, facade dispatch, and ASGI endpoint routing

ISSUES CLOSED: #864
2026-03-24 01:15:17 +00:00
freemo 5f0a545113 feat(server): ASGI endpoint via uvicorn
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 20s
CI / security (pull_request) Failing after 51s
CI / lint (pull_request) Successful in 3m39s
CI / quality (pull_request) Successful in 3m46s
CI / typecheck (pull_request) Successful in 3m56s
CI / e2e_tests (pull_request) Successful in 8m39s
CI / coverage (pull_request) Successful in 11m6s
CI / integration_tests (pull_request) Failing after 16m23s
CI / unit_tests (pull_request) Failing after 16m23s
CI / benchmark-regression (pull_request) Successful in 52m29s
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 1s
Implement FastAPI-based ASGI application served by uvicorn for
the CleverAgents server mode. Add health check endpoint, A2A
JSON-RPC routing, configurable host:port binding, and graceful
shutdown handling. Server launches via `agents server start`.

- Add FastAPI ASGI app factory at infrastructure/server/asgi_app.py
  with /.well-known/agent.json (Agent Card), /health (liveness),
  and /a2a (A2A JSON-RPC 2.0 dispatch via A2aLocalFacade)
- Add ServerLifecycle class at infrastructure/server/server_lifecycle.py
  wrapping uvicorn.Server with SIGTERM/SIGINT graceful shutdown
- Add `agents server start` CLI command with --host, --port, --log-level
  options, resolving defaults from Settings
- Add fastapi>=0.115.0 dependency to pyproject.toml (uvicorn already present)
- Add Behave BDD tests (features/server_lifecycle.feature, 20 scenarios)
- Add Robot Framework integration tests (robot/server_lifecycle.robot)
- Update CHANGELOG.md and vulture_whitelist.py

ISSUES CLOSED: #862
2026-03-22 23:50:04 +00:00