Repository navigation
Open
Description
Goal
Complete the Gateway-owned, bounded RAG request workflow and prove it through executable acceptance before expanding source ingestion or adding client adapters.
Current implementation audit (revalidated against main, 2026-10-29)
The earlier audit below was stale and has been replaced with these findings:
Implemented on main
POST /api/v1/requestsis dispatched byruntime/server.pytoGatewayService.search.- Gateway resolves and pins the active Index generation/profile bundle.
- Intent classification and entity extraction run concurrently.
- Lexical and vector retrieval run concurrently through REST.
- Candidate source revisions are verified through Memory/Knowledge REST endpoints before Ranking.
- Ranking is invoked through REST; the Gateway returns provenance, freshness state, degradation metadata, and bounded context.
- Read-your-writes operation polling exists.
- Tests include mocked Gateway orchestration, an HTTP request-route test, and a durable SQLite-backed integration test that exercises real Knowledge, Index, retrieval, freshness, and Ranking handlers. The test suite is therefore not wholly mocked, but it does not yet prove the complete Graph/Reranking workflow.
Confirmed contract gaps
- Graph orchestration is absent from
GatewayService.search. The contract requires Graph traversal forrelationship_explorationand explicit relationship requests, concurrent with retrieval. Graph resolution evidence and edge supports must share the canonical verification budget with text candidates. No Graph request or Graph evidence is currently produced by this path. - Reranking is absent from
GatewayService.search. The contract requires preserving exact-match candidates in Ranking order, reranking only non-exact candidates (maximum 20), validating identity/provenance preservation, and falling back to Ranking order with explicit partial/degraded status on failure. - Stage budgets are not enforced. The inbound absolute deadline is propagated, but calls default to 30 seconds and the implementation does not enforce the contract's separate planning (100 ms), retrieval (350 ms), Graph (250 ms), freshness (250 ms), Ranking (150 ms), Reranking (250 ms), and assembly (100 ms) budgets. The hook's 1,500 ms total deadline is not enough by itself to prove those reserved ceilings.
- Context budgeting is not provider-token correct. Assembly estimates each candidate as
ceil(len(text)/4), ignores the requested model, and does not report a conservative estimate in the response metadata. The contract requires provider-model token counting when available and an explicitly identified conservative estimate otherwise. The current estimate also does not account for the source/provenance wrapper added to context. - Degradation semantics need tightening. In particular, a successful empty result must remain distinguishable from required retrieval/freshness failure; Ranking failure must not be represented as a successful empty Ranking result; and truncation/freshness filtering must be reflected consistently in status and response metadata.
- Executable acceptance is incomplete. The existing durable HTTP integration test proves a useful subset (Knowledge → Index → lexical/vector retrieval → canonical freshness → Ranking). It does not exercise Graph traversal/support verification, Reranking, per-stage deadlines/cancellation, required relationship intent, or the complete degradation matrix.
- Traceability currently maps Gateway acceptance IDs to specifications but does not identify the concrete executable test functions for the complete workflow. Update it as tests are added; do not label a specification as executed coverage.
Required sequence
- Implement the missing Graph and Reranking stages in Gateway using only logical service REST calls.
- Enforce one absolute request deadline plus non-borrowable per-stage ceilings and bounded cancellation behavior.
- Correct context budgeting: use a configured tokenizer for the named model when available; otherwise use a documented conservative estimator and expose that fact. Never claim a provider-token count when only an estimate exists.
- Correct degradation/status handling for retrieval, freshness, Ranking, Graph, Reranking, and assembly.
- Extend the durable REST-dispatcher integration test with Graph and Reranking services and durable source/index data. Include required relationship intent, Graph support freshness, reranker identity preservation, and service failures.
- Add executable cases for empty evidence, partial dependency failure, deadline exhaustion, scope isolation, provenance, deterministic ordering, and bounded context.
- Update
docs/TRACEABILITY.mdwith concrete test names and distinguish executed coverage from remaining release gates.
Constraints
- REST contracts remain canonical. No direct cross-service implementation calls or cross-owned storage access.
- Do not make RAG a separate deployable service yet; keep it a named, independently testable Gateway-owned capability.
- Do not couple RAG to MCP, Claude Code hooks, a particular model provider, or a particular editor.
- Do not use this issue to expand source format support.
- Keep existing fail-closed Index generation/cutover guarantees intact.
- Do not relax normative contract requirements merely to match current implementation.
- SonarCloud is deliberately excluded from this work.
Acceptance criteria
- Client requests traverse Gateway planning, lexical/vector retrieval, Graph when required, canonical evidence verification, Ranking, optional Reranking, and context assembly through REST contracts only.
- Graph entity-resolution evidence and edge supports are verified against canonical owners before any Graph path is returned.
- Exact-match candidates retain their required primary tier and are never silently dropped by Reranking or context assembly when they fit the budget.
- Every stage obeys its reserved deadline; no service extends the caller's absolute deadline.
- Context never exceeds the requested budget; token-count method/estimate is explicit.
- Integration tests exercise the actual REST dispatcher and durable data, proving success, empty evidence, partial dependency failure, timeout, scope isolation, and provenance.
- Missing/failed required dependencies cannot silently produce a false successful result.
- Traceability links acceptance cases to executable tests by name.
- CI passes, excluding the deliberately deferred SonarCloud check.
Deferred
- PR Add format-aware source ingestion adapters #31 (source-ingestion adapters) remains blocked until this issue's Gateway/RAG acceptance passes.
- PR Defer Index profile registry pending real integration #11 (Index profile registry) remains deferred; it is not required for the current single-instance workflow.
- MCP/client adapters and hook lifecycle integration remain later gates, after the Gateway request path is stable.
Metadata
Metadata
Assignees
Labels
No labels
Activity
sfloess commentedon Oct 28, 2026
Updated implementation constraint: CE is a disposable PoC and will be retired. Keep this work to the narrowest working Gateway-to-retrieval-to-context path that demonstrates the concept. Do not block on production-grade recovery, durable execution history, full Knowledge/Graph coverage, MCP/hooks, or release hardening. Preserve basic REST boundaries, scope safety, provenance, and honest failure behavior; defer the rest to the long-lived FlossWare foundation.
sfloess commentedon Oct 30, 2026
[Astra] Progress update from PR #48.
Implemented and pushed to
astra/issue-34-graph-reranking(current headcfaee7a):X-CE-Deadlinepropagation.GitHub Actions is still running for the latest changes. No test pass is claimed yet.
Remaining acceptance work: empty required-Graph evidence and scope-isolation cases through the durable dispatcher, bounded cancellation behavior, latency measurement against normative ceilings, and final CI/review. This issue remains open.