[P1] E02: Integrate the selected local runtime with verified session and KV-cache isolation #25

Open
opened 2026-10-21 20:29:29 +02:00 by amiryahaya · 0 comments
Owner

Backlog ID: E02 | Priority: P1 | Phase: M5 — Local inference and complete chat

Outcome and scope

Implement the selected embedding/reranking/generation runtime profiles and private Engine transport, model lifecycle, capability reporting and explicit per-session ownership/cleanup.

Dependencies and gates

Engineering prerequisites: #15 (E01), #4 (D03), #12 (F07)

Final runtime/hardware/profile selection follows D03 and authority-approved domain/transport requirements; process separation is not domain separation.

Starting points

crates/ai-engine/; crates/model-adapters/; tests/integration/runtime_isolation.rs; docs/runtime/

These are current files or proposed responsibility boundaries; finalize a focused implementation plan before coding. Existing local scaffolding is uncommitted and is not evidence of completion.

Acceptance criteria

  • Profiles are pinned and validated; model/embedding changes preserve compatibility metadata and trigger reindex where required.
  • Engine is private/authenticated and has no application DB/search credentials or external telemetry/egress.
  • Server-generated session handles isolate users/security scopes; no concurrent slot reuse, shared protected prefix cache or global prompt buffer.
  • Completion/cancel/timeout/logout/expiry invokes verified reset/eviction; uncertain cleanup retires the slot/worker, with bounded memory and safe diagnostics.
  • Engine liveness/readiness reflects process/model/runtime state; unsupported required isolation capabilities reject configuration.

Verification

Run E01 contract suite against the real adapter; concurrent sentinel tests and mid-stream failures verify cleanup, no session bleed and valid readiness transitions.

Behavior changes follow Red → Green → Refactor. Run affected Rust shared contract/unit tests and real PostgreSQL/Qdrant/runtime integration tests where applicable; frontend changes run typecheck/build and the relevant browser tests. Record exact commands/results in the implementation PR. Documentation/decision tasks use recorded review evidence.

Requirements and design

FR-RAG-003, FR-AUTH-010; FR-PRIV-001–005; NFR-ARCH-002–003; architecture §§4, 9.7

Sources: SRS, system design. Local planning context: docs/implementation-plan.md and docs/development-backlog.md (not published by this task).

Security impact: Use synthetic fixtures until approved for operational data. Preserve current authorization, markings, provenance and default-deny behavior; exclude protected payloads/secrets from operational telemetry. No classified-deployment or PQC-compliance claim is implied by closing this issue.

Parent roadmap: #1

**Backlog ID:** E02 | **Priority:** P1 | **Phase:** M5 — Local inference and complete chat ## Outcome and scope Implement the selected embedding/reranking/generation runtime profiles and private Engine transport, model lifecycle, capability reporting and explicit per-session ownership/cleanup. ## Dependencies and gates **Engineering prerequisites:** #15 (E01), #4 (D03), #12 (F07) Final runtime/hardware/profile selection follows D03 and authority-approved domain/transport requirements; process separation is not domain separation. ## Starting points crates/ai-engine/; crates/model-adapters/; tests/integration/runtime_isolation.rs; docs/runtime/ These are current files or proposed responsibility boundaries; finalize a focused implementation plan before coding. Existing local scaffolding is uncommitted and is not evidence of completion. ## Acceptance criteria - [ ] Profiles are pinned and validated; model/embedding changes preserve compatibility metadata and trigger reindex where required. - [ ] Engine is private/authenticated and has no application DB/search credentials or external telemetry/egress. - [ ] Server-generated session handles isolate users/security scopes; no concurrent slot reuse, shared protected prefix cache or global prompt buffer. - [ ] Completion/cancel/timeout/logout/expiry invokes verified reset/eviction; uncertain cleanup retires the slot/worker, with bounded memory and safe diagnostics. - [ ] Engine liveness/readiness reflects process/model/runtime state; unsupported required isolation capabilities reject configuration. ## Verification Run E01 contract suite against the real adapter; concurrent sentinel tests and mid-stream failures verify cleanup, no session bleed and valid readiness transitions. Behavior changes follow Red → Green → Refactor. Run affected Rust shared contract/unit tests and real PostgreSQL/Qdrant/runtime integration tests where applicable; frontend changes run typecheck/build and the relevant browser tests. Record exact commands/results in the implementation PR. Documentation/decision tasks use recorded review evidence. ## Requirements and design FR-RAG-003, FR-AUTH-010; FR-PRIV-001–005; NFR-ARCH-002–003; architecture §§4, 9.7 Sources: [SRS](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/SRS.md), [system design](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/architecture.md). Local planning context: `docs/implementation-plan.md` and `docs/development-backlog.md` (not published by this task). **Security impact:** Use synthetic fixtures until approved for operational data. Preserve current authorization, markings, provenance and default-deny behavior; exclude protected payloads/secrets from operational telemetry. No classified-deployment or PQC-compliance claim is implied by closing this issue. **Parent roadmap:** #1
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
primatekuntech/rag-rust#25
No description provided.