docs(project): plan doc-query scoped MCP integration on the KB control plane#5168
docs(project): plan doc-query scoped MCP integration on the KB control plane#5168rschlaefli wants to merge 1 commit into
Conversation
…l plane Klicker-side child plan of the producer-neutral runtime-config umbrella (deployment repo). Builds on PR #5078 (KB management control plane): Scope Token (ES256, kb_id claim) via a new scope_token MCP auth type, follow-up migration for version/digest fences, ingestion API client replacing fire-and-forget webhooks, Source Gateway, upload SAS flow, and KB manager wiring. All open questions ruled 2026-07-12 (documents mode, opaque sub, v3-ai base, client digest, SNIPPET-as-blob).
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| - Calls (producer-neutral contract from the umbrella plan): create/update → | ||
| `POST /v1/resources` with `{project_id: "klicker-course-materials", producer: "klicker", | ||
| external_resource_id: <KBResource.id>, resource_version, scope: {kb_id: <KB.id>}, | ||
| source: {kind, url: <gateway version URL or public URL>, mime_type, display_name}, |
There was a problem hiding this comment.
Website Fetches Lack Guardrails
WEBSITE resources submit a lecturer-provided public URL for ingestion to fetch, but the plan only defines the SSRF restriction for blob sources. A URL like an internal service, link-local address, or redirect to a cluster-local host can be fetched by ingestion unless URL sources also have a mandatory default-deny policy.
Context Used: CLAUDE.md (source)
| - State-machine hardening: duplicate/out-of-order events must not regress terminal state; only | ||
| a `resource_version` ≥ the current `activeResourceVersion` may advance serving state | ||
| (`activeResourceVersion`/`activeContentSha256` set on `resource.processing_succeeded`). |
There was a problem hiding this comment.
The out-of-order guard only compares resource_version with activeResourceVersion. If version 2 is still running, version 3 is submitted, and the version 2 success arrives late, 2 >= 1 can still mark stale content active even though it is no longer the desired operation.
Context Used: CLAUDE.md (source)
| - Behavior: stream the exact immutable blob for that resource version (`KBResource.storagePath`) | ||
| from Azure Blob using the server-side credential (never expose SAS); set `Content-Type`, | ||
| `Content-Length`, and `ETag: "<contentSha256>"`; 404/410 for unknown, soft-deleted (`deletedAt`), | ||
| or fenced resources; enforce size cap on read. |
There was a problem hiding this comment.
Version Route Reads Moving Pointer
The gateway URL includes :version, but the described read uses KBResource.storagePath, a single current pointer. After a replace, a retry for an older /versions/1 URL can stream the newer blob path and let ingestion process the wrong bytes for that operation.
Context Used: CLAUDE.md (source)
What
Planning-only doc (no code, no migration, no seed change):
project/plans_future/PLAN-doc-query-scoped-mcp-integration.md.Documents how Klicker chatbots will query one shared, deployment-configured doc-query MCP endpoint through a single stable
doc_querytool, with tenant isolation carried by a short-lived signed Scope Token (ES256 JWT,kb_idclaim) minted per chat request. doc-query verifies the token and injects a mandatorykb_idretrieval filter server-side. The scope unit is the Knowledge Base from PR #5078 (KB/KBResource/KBChatbot), not the chatbot, so re-linking a KB to a different chatbot never triggers re-ingestion.Why draft
codex/kb-management-ui→v3-ai, still open) — the KB control plane this plan depends on. Implementation happens offv3-aiafter feat(kb): add knowledge base management control plane #5078 merges.dev; data-ingestion resource API; deployment dynamic workload).v3as a clean single-file planning artifact for review; not for merge until the dependency chain lands.Scope
v3. Full dependency/sequencing, current-state file:line audit, and open questions are in the doc.Verification
None required — no code. Rendered-markdown review only.