ContextAssemblyService gRPC AssembleContext orchestrator with L0–L2 degradation (logs + response shape), IBEX_CONTEXT_DEADLINE_MS 40ms retrieval wall, and L3 DEADLINE_EXCEEDED for proxy fail-open (ADR-0071).
Milestone 3.5.C.6 — gRPC Service Skeleton and Degradation Contract
Status: Completed
Goal: Track C — Context Assembly Engine
Phase: 3.5 — Extraction & Context Assembly
Estimated effort: 3 days
Track: Track C — Context Assembly Engine
Depends on: 3.5.C.5 (context formatter)
ADR: ADR-0071
Why This Milestone Exists
Wraps Track C’s budget/retrieval/scorer/packer/formatter into ContextAssemblyService.AssembleContext and locks operational degradation (L0–L2 in-service; L3 as proxy fail-open on DEADLINE_EXCEEDED).
Non-Goals
- Proto message field adds (
fallback,was_truncated, …) - Go proxy client /
X-IBEX-Context-Fallback— 3.5.D.1 - Changing
packages/proto/**/buf.gen.yaml
File layout (as shipped)
services/context/app/assemble.py # ContextAssembler, L0–L2 classification
services/context/app/server.py # grpc.aio AssembleContext + UNIMPLEMENTED stubs
services/context/app/__main__.py # python -m app
services/context/app/config.py # IBEX_CONTEXT_DEADLINE_MS, IBEX_CONTEXT_GRPC_ADDR
services/context/tests/test_assemble.py
services/context/tests/test_server.py
benchmarks/context/assemble_load.py # stub + live gRPC load harness
infra/scripts/context-proto-gen.sh # buf generate for context_pb2 in CISettings / env:
IBEX_CONTEXT_DEADLINE_MS(default40) — retrieval wall; effective waitmin(timeout_ms, deadline_ms)IBEX_CONTEXT_GRPC_ADDR(default127.0.0.1:9092) — bind address
Degradation Ladder (as shipped)
| Level | Trigger | Behavior | Signal |
|---|---|---|---|
| L0 — Full | Hot + cold usable (or intentional skips) | Full pack/format | degradation_level=L0 (debug); memories from both |
| L1 — Cold degraded | Cold timeout/error | Hot (+ directive) only | INFO log; hot-only candidates_evaluated |
| L2 — Memory degraded | Hot and cold both fail | Directive + history only | INFO log; memories_included==0 |
| L3 — Full degraded | Caller cancel / deadline | No partial invent | gRPC DEADLINE_EXCEEDED → proxy fail-open (3.5.D.1) |
No new proto response fields — observability via AssemblyMetrics + structured logs (ADR-0071).
Success signals
- Dedicated unit tests for L0 / L1 / L2 / L3 (
DEADLINE_EXCEEDED) with stubbed dependencies -
AssemblyMetricspopulated at every level (stage timings +candidates_evaluated) - Server enforces
IBEX_CONTEXT_DEADLINE_MS(40) independently of the proxy’s 45ms client timeout - Stub load harness: 500 RPS
AssembleContext, p99 < 50ms (benchmarks/context/assemble_load.py); live 100K procedure documented - ADR-0071 accepted;
context-testCI green
Last updated on