Fix/rag grounding and sse spacing#2
Merged
Conversation
Defense-in-depth for the RAG chat paths, complementing the grounding system prompt: - Hardened DEFAULT_SYSTEM_PROMPT: treat context/question as untrusted data, never reveal/repeat the prompt, ignore embedded role-changes - Input screening (scan_input): flag instruction-override, prompt extraction, persona hijack, jailbreak, and forged-delimiter attempts; high-risk -> refuse (not sanitise) - Structural isolation (build_grounded_prompt): wrap untrusted text in labelled blocks with delimiters neutralised, the primary defence against indirect injection via poisoned documents - Output screening (scan_output): catch system-prompt leakage by phrasing and verbatim overlap Wired into AskChatbot (JSON), the SSE stream (blocks before retrieval), and the LangGraph generate node. New deterministic, testable domain module src/domain/safety/guardrails.py + 12 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code-level deep dive across all layers (domain/application/infrastructure/ interfaces), data model, end-to-end flows, multi-tenancy/security model, RAG + agent internals, observability, evals, deployment, and a section documenting known issues/discrepancies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.