Move RCA behavioral prompts to system prompt - #445
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
More reviews will be available in 24 minutes and 39 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughConsolidates RCA behavioral guidance into ordered system-prompt markdown sections and updates background RCA assembly to load them. Removes legacy segment helpers and stops appending investigation guidance into the user message; builder now formats alert + context only. ChangesRCA Prompt Architecture Restructuring
Sequence DiagramsequenceDiagram
participant Composer
participant RCAPrompt
participant RCABuilder
Composer->>RCAPrompt: _build_rca_system_prompt() reads ordered sections
RCAPrompt-->>Composer: concatenated RCA system prompt
Composer->>RCABuilder: build_system_invariant() returns system prompt
RCABuilder->>RCABuilder: build_rca_prompt() formats alert + context (user message)
RCABuilder-->>RCAPrompt: final RCA prompt (system prompt + user message)
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
This reverts commit 6382d08.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/chat/backend/agent/prompt/composer.py`:
- Around line 41-47: The _build_rca_system_prompt function currently opens files
from _RCA_SECTIONS_DIR based on _RCA_SECTION_ORDER without guarding against
missing/unreadable files; update it to check existence (os.path.exists or
os.path.isfile) for each path before opening, wrap the open/read in a try/except
OSError block, log the error via the app logger or module logger (e.g.
app.logger.error or logging.getLogger(__name__).error) including the path and
exception, skip the missing/unreadable section and continue assembling parts,
and ensure the function returns a safe fallback (empty string or partial
assembled prompt) instead of letting the exception bubble up to Flask error
handlers.
In `@server/chat/backend/agent/prompt/rca_sections/identity.md`:
- Line 1: Add a top-level H1 heading at the start of identity.md (line 1) to
satisfy MD041 and match other RCA sections; prepend a descriptive H1 such as "#
Identity" (or "# Aurora" if you prefer agent-centric title) so the file begins
with an H1 instead of plain text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b5209aa5-9cbe-434e-b114-95f5e18aea58
📒 Files selected for processing (16)
docs/RCA_QUALITY_ROADMAP.mdserver/chat/backend/agent/prompt/composer.pyserver/chat/backend/agent/prompt/rca_sections/conclusion_gate.mdserver/chat/backend/agent/prompt/rca_sections/context_mgmt.mdserver/chat/backend/agent/prompt/rca_sections/error_recovery.mdserver/chat/backend/agent/prompt/rca_sections/evidence_standard.mdserver/chat/backend/agent/prompt/rca_sections/identity.mdserver/chat/backend/agent/prompt/rca_sections/investigation.mdserver/chat/backend/agent/skills/rca/segments/critical_requirements_header.mdserver/chat/backend/agent/skills/rca/segments/error_resilience_infra.mdserver/chat/backend/agent/skills/rca/segments/error_resilience_intro.mdserver/chat/backend/agent/skills/rca/segments/error_resilience_outro.mdserver/chat/backend/agent/skills/rca/segments/output_requirements.mdserver/chat/backend/agent/skills/rca/segments/persistence_and_immediate_action.mdserver/chat/backend/agent/skills/rca/segments/what_to_investigate.mdserver/chat/background/rca_prompt_builder.py
💤 Files with no reviewable changes (7)
- server/chat/backend/agent/skills/rca/segments/critical_requirements_header.md
- server/chat/backend/agent/skills/rca/segments/error_resilience_outro.md
- server/chat/backend/agent/skills/rca/segments/error_resilience_infra.md
- server/chat/backend/agent/skills/rca/segments/what_to_investigate.md
- server/chat/backend/agent/skills/rca/segments/error_resilience_intro.md
- server/chat/backend/agent/skills/rca/segments/output_requirements.md
- server/chat/backend/agent/skills/rca/segments/persistence_and_immediate_action.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|



Moves all investigation guidance out of the user message and into dedicated system prompt sections.
Why: The user message was ~130 lines of behavioral instructions mixed in with the actual alert data. The model treats system prompt as authoritative and non-truncatable, so methodology belongs there. The user message should just be the facts.
What changed:
rca_sections/directory with 6 focused prompt files (identity, investigation, context_mgmt, error_recovery, evidence_standard, conclusion_gate)composer.pyloads these for background RCA via_build_rca_system_prompt()rca_prompt_builder.pynow returns only alert data + providers + Aurora Learn context — no inline instructionsskills/rca/segments/files that were being appended to the user messageSummary by CodeRabbit
New Features
Refactor