Skip to content

ROB-2197 Allow passing custom sys prompt param in Holmes chat endpoint - #1006

Merged
Avi-Robusta merged 14 commits into
masterfrom
ROB-2197-allow-passing-custom-sys-prompt-param-in-ask-holmes
Sep 29, 2025
Merged

Avi-Robusta merged 14 commits into
masterfrom
ROB-2197-allow-passing-custom-sys-prompt-param-in-ask-holmes

Conversation

@mershal

@mershal mershal commented Sep 28, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Sep 28, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Threads an optional additional_system_prompt from the API model through server.py into build_chat_messages and add_or_update_system_prompt; when provided it is appended to the constructed system prompt for new and existing conversations and integrated into message history.

Changes

Cohort / File(s) Summary
Core conversation prompt handling
holmes/core/conversations.py
Added additional_system_prompt: Optional[str] = None parameter to add_or_update_system_prompt and build_chat_messages; forwards and appends the provided string into system prompt construction and when integrating system prompts into conversation history (affects context-window/tool-path logic).
API model update
holmes/core/models.py
Added additional_system_prompt: Optional[str] = None field to ChatRequestBaseModel.
Server integration
server.py
Forwards chat_request.additional_system_prompt into build_chat_messages in chat(); no other control-flow changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant Server
  participant Builder as build_chat_messages
  participant SysUpd as add_or_update_system_prompt
  participant LLM

  Client->>Server: POST /chat (ChatRequest incl. additional_system_prompt)
  Server->>Builder: build_chat_messages(ask, history, ai, config, global_instructions, additional_system_prompt)
  Builder->>SysUpd: add_or_update_system_prompt(history, ai, config, additional_system_prompt)
  Note over SysUpd: If provided, append additional_system_prompt to the system prompt text
  SysUpd-->>Builder: updated conversation messages (with system prompt)
  Builder-->>Server: final messages
  Server->>LLM: invoke LLM with messages/tools
  LLM-->>Server: response
  Server-->>Client: chat reply
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • mainred

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is empty and does not convey any information about the changeset, so it fails to describe even a part of the modifications introduced. Please add a brief description summarizing the objectives and key changes of this pull request to help reviewers understand its purpose and scope.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title clearly and concisely highlights the primary change by stating that a custom system prompt parameter is now accepted by the Holmes chat endpoint, and including the ticket identifier adds useful context without unnecessary detail.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ROB-2197-allow-passing-custom-sys-prompt-param-in-ask-holmes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

aantn
aantn previously approved these changes Sep 28, 2025
Comment thread holmes/core/conversations.py Outdated
Comment thread holmes/core/models.py Outdated
Comment thread server.py Outdated
mershal and others added 4 commits September 29, 2025 10:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server.py (1)

329-336: Add missing additional_system_prompt parameter to build_chat_messages signature

The build_chat_messages function currently doesn’t accept additional_system_prompt, causing a mismatch when it’s forwarded from server.py. Update its definition (and similarly add_or_update_system_prompt and the ChatRequest model) to include:

def build_chat_messages(..., additional_system_prompt: Optional[str] = None):
    ...
🧹 Nitpick comments (1)
server.py (1)

254-276: Parity: add additional_system_prompt to workload_health_chat

If product scope allows, pass the field into build_workload_health_chat_messages so health checks support the same customization.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a21e9b3 and 9884890.

📒 Files selected for processing (1)
  • server.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Pre-commit checks
  • GitHub Check: llm_evals
🔇 Additional comments (1)
server.py (1)

144-153: Extend support to RCA and follow‑ups for parity

Consider threading additional_system_prompt through:

  • investigate_issues (/api/investigate)
  • stream_investigate_issues (/api/stream/investigate)
  • issue_conversation (/api/issue_chat)

This keeps behavior consistent across RCA and follow‑up flows.

Also applies to: 164-189, 285-312

@Avi-Robusta
Avi-Robusta enabled auto-merge (squash) September 29, 2025 11:26
@Avi-Robusta
Avi-Robusta merged commit 8309520 into master Sep 29, 2025
7 checks passed
@Avi-Robusta
Avi-Robusta deleted the ROB-2197-allow-passing-custom-sys-prompt-param-in-ask-holmes branch September 29, 2025 11:31
@github-actions

Copy link
Copy Markdown
Contributor

Results of HolmesGPT evals

  • ask_holmes: 34/36 test cases were successful, 1 regressions, 1 setup failures
Test suite Test case Status
ask 01_how_many_pods ✅
ask 02_what_is_wrong_with_pod ✅
ask 04_related_k8s_events ✅
ask 05_image_version ✅
ask 09_crashpod ✅
ask 10_image_pull_backoff ✅
ask 110_k8s_events_image_pull ✅
ask 11_init_containers ✅
ask 13a_pending_node_selector_basic ✅
ask 14_pending_resources ✅
ask 15_failed_readiness_probe ✅
ask 17_oom_kill ✅
ask 19_detect_missing_app_details ✅
ask 20_long_log_file_search ✅
ask 24_misconfigured_pvc ✅
ask 24a_misconfigured_pvc_basic ✅
ask 28_permissions_error 🚧
ask 33_cpu_metrics_discovery ❌
ask 39_failed_toolset ✅
ask 41_setup_argo ✅
ask 42_dns_issues_steps_new_tools ✅
ask 43_current_datetime_from_prompt ✅
ask 45_fetch_deployment_logs_simple ✅
ask 51_logs_summarize_errors ✅
ask 53_logs_find_term ✅
ask 54_not_truncated_when_getting_pods ✅
ask 59_label_based_counting ✅
ask 60_count_less_than ✅
ask 61_exact_match_counting ✅
ask 63_fetch_error_logs_no_errors ✅
ask 79_configmap_mount_issue ✅
ask 83_secret_not_found ✅
ask 86_configmap_like_but_secret ✅
ask 93_calling_datadog[0] ✅
ask 93_calling_datadog[1] ✅
ask 93_calling_datadog[2] ✅

Legend

  • ✅ the test was successful
  • :minus: the test was skipped
  • ⚠️ the test failed but is known to be flaky or known to fail
  • 🚧 the test had a setup failure (not a code regression)
  • 🔧 the test failed due to mock data issues (not a code regression)
  • 🚫 the test was throttled by API rate limits/overload
  • ❌ the test failed and should be fixed before merging the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants