Phase 3.5 extraction & assembly

Replace applyDirectiveInjection with contextclient.Assemble in the proxy hot path, with IBEX_CONTEXT_ENABLED=false falling back to exact Phase 2 static-directive behavior.

Milestone 3.5.D.2 — Wire Assemble into dispatchProviderCompletion

Status: Completed Goal: Track D — Proxy Integration
Phase: 3.5 — Extraction & Context Assembly
Estimated effort: 2 days
Track: Track D — Proxy Integration
Depends on: Milestone 3.5.D.1 (Go gRPC context client)


Why This Milestone Exists

This is the exact seam where context assembly replaces/extends directive injection in the proxy hot path. h.contextClient == nil should be a legitimate, fully-supported runtime mode falling back to Phase 2 static-directive behavior — making Phase 3.5 additive, not a hard fork.


What shipped

  • IBEX_CONTEXT_ENABLED (default false) + nil ContextClient are independent gates to Phase 2 applyDirectiveInjection (no Assemble gRPC).
  • dispatchProviderCompletion calls applyContextOrDirectiveInjection before Complete; Assemble Fallback still applies Phase 2 directive injection.
  • X-IBEX-Skip-Memory skips Assemble entirely (directive injection still runs).
  • Response headers X-IBEX-Memories-Injected, X-IBEX-Context-Tokens, X-IBEX-Context-Fallback on non-stream and SSE paths when Assemble was attempted; omitted on Phase 2 (disabled/nil/Skip-Memory) for bit-identical headers.
  • Embedded ibex JSON / IBEX_CONTEXT_EMBED_METADATA remains 3.5.D.3.

Success signals

  • dispatchProviderCompletion wired with context assembly
  • IBEX_CONTEXT_ENABLED=false reproduces exact Phase 2 behavior (regression fixture)
  • X-IBEX-Skip-Memory header skips the gRPC call entirely (not just discards result)
  • Response headers X-IBEX-Memories-Injected, X-IBEX-Context-Tokens, X-IBEX-Context-Fallback set correctly (D.2 owns plain headers; D.3 owns embedded metadata)
  • Repo guards / CI checks still pass

Prerequisites

  • Milestone 3.5.D.1 (Go gRPC context client)
Edit on GitHub

Last updated on