Commit Graph

4 Commits

Author SHA1 Message Date
HAL9000 9c3b0331a2 fix(a2a): align A2A endpoint with JSON-RPC 2.0 wire format changes
- Fix asgi_app.py: use a2a_request.method instead of a2a_request.operation
  (A2aRequest model was updated in master to use JSON-RPC 2.0 field names)
- Fix server_lifecycle_steps.py: send JSON-RPC 2.0 wire format with
  "method" field; check result.status instead of top-level status
- Fix server_lifecycle.feature: update step name to match new step
  definition (A2A response result status)
- Fix helper_server_lifecycle.py: use "method" field in JSON-RPC 2.0
  payload; check result.status in response
2026-06-11 20:00:04 -04:00
HAL9000 e4224eb8ec fix(a2a): resolve JSON-RPC protocol conformance and code quality issues
- Fix malformed JSON parse error: wrap request.json() in try/except,
  return -32700 Parse error instead of unhandled HTTP 500
- Fix JSON-RPC error responses: add required 'id' field to all error
  responses per JSON-RPC 2.0 Section 5
- Fix HTTP status codes: return HTTP 200 for all JSON-RPC responses
  (error codes expressed in JSON body per JSON-RPC 2.0 over HTTP)
- Fix error message leakage: return generic messages instead of raw
  Pydantic ValidationError internals (CWE-209)
- Add catch-all exception handler returning -32603 Internal error
- Fix Agent Card url field: use base server URL without /a2a suffix;
  interfaces[0].url correctly uses endpoint URL with /a2a suffix
- Fix 0.0.0.0 host: substitute 127.0.0.1 for Agent Card URL
- Fix context typing: replace context: Any with context: Context in
  all step files per project convention
- Fix inline imports: move all imports to top of step files
- Fix _COMMANDS typing: use dict[str, Callable[[], None]] to avoid
  type: ignore suppression in helper files
- Add BDD scenarios for entity-sync and namespace-mgmt skill enumeration
- Update server_lifecycle.feature: correct HTTP status assertions to 200

ISSUES CLOSED: #867
2026-06-11 19:58:52 -04:00
HAL9000 5ede1c018a fix(server,sync): use A2aRequest.method not .operation in tests and helpers
The new entity-sync feature introduced A2aRequest with a `method` field
(JSON-RPC 2.0 wire format), but several test/helper files used the wrong
field name `operation` when constructing requests or logging, and checked
non-existent `.status`/`.data` attributes on A2aResponse instead of
`.result`/`.error`.

Fixes:
- asgi_app.py: log `a2a_request.method`, not `.operation` (typecheck error)
- server_lifecycle_steps.py: send `method` key in JSON-RPC payload; look
  up status in `result` dict, not top-level response body
- server_lifecycle.feature: expect "healthy" (what the handler returns),
  not "ok"
- entity_sync_steps.py: construct A2aRequest(method=...) not (operation=...);
  assert on .result/.error instead of .status/.data
- robot/helper_entity_sync.py: same method= and result/error fixes across
  sync_pull, sync_push, sync_status, sync_facade_no_service helpers
- robot/helper_server_lifecycle.py: same method= and result path fixes

ISSUES CLOSED: #1125
2026-05-29 07:21:08 -04:00
freemo c6ccb85bb8 feat(server): ASGI endpoint via uvicorn
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-05-29 05:08:08 -04:00