Skip to content

MGMT-21059: Use Lightspeed-Stack config for system prompt#25

Merged
eranco74 merged 1 commit intorh-ecosystem-edge:mainfrom
omertuc:prompt
Jul 10, 2025
Merged

MGMT-21059: Use Lightspeed-Stack config for system prompt#25
eranco74 merged 1 commit intorh-ecosystem-edge:mainfrom
omertuc:prompt

Conversation

@omertuc
Copy link
Member

@omertuc omertuc commented Jul 9, 2025

The prompt used to be included in every request, but it can also be set in the config file for lightspeed-stack.

This commit moves the system prompt to a config file.

Summary by CodeRabbit

  • New Features

    • Introduced a new system prompt for the Openshift Lightspeed Intelligent Assistant, enhancing guidance for installation, configuration, and troubleshooting.
  • Chores

    • Updated container configurations to use the new system prompt file.
    • Removed the old system prompt configuration.
    • Adjusted API query scripts to exclude the previous system prompt parameter.

@coderabbitai
Copy link

coderabbitai bot commented Jul 9, 2025

Walkthrough

This update replaces the previous mcphost-systemprompt.txt with a new systemprompt.txt prompt file, updates volume mounts in the pod specification to use the new file, and removes the system prompt parameter from the query.sh script's API requests. The changes standardize system prompt usage across containers.

Changes

File(s) Change Summary
assisted-chat-pod.yaml Updated volume mounts: lightspeed-stack container mounts systemprompt.txt at /tmp/; mcphost container mounts systemprompt.txt at /systemprompt.txt.
config/mcphost-systemprompt.txt Deleted the old system prompt file for mcphost.
config/systemprompt.txt Added new system prompt file defining assistant behavior and tool call format.
scripts/query.sh Removed "system_prompt" field from API request payload in send_curl_query function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant query.sh
    participant API
    participant Pod (mcphost/lightspeed-stack)
    participant config/systemprompt.txt

    User->>query.sh: Run query.sh with input
    query.sh->>API: Send query (without system_prompt)
    API->>Pod (mcphost/lightspeed-stack): Forward query
    Pod (mcphost/lightspeed-stack)->>config/systemprompt.txt: Read system prompt
    Pod (mcphost/lightspeed-stack)->>API: Generate response using system prompt
    API->>query.sh: Return response
    query.sh->>User: Output response
Loading

Possibly related PRs


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa879a0 and 6fbcbc3.

📒 Files selected for processing (4)
  • assisted-chat-pod.yaml (2 hunks)
  • config/mcphost-systemprompt.txt (0 hunks)
  • config/systemprompt.txt (1 hunks)
  • scripts/query.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • config/mcphost-systemprompt.txt
🚧 Files skipped from review as they are similar to previous changes (3)
  • scripts/query.sh
  • assisted-chat-pod.yaml
  • config/systemprompt.txt
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@omertuc omertuc marked this pull request as draft July 9, 2025 17:21
@omertuc
Copy link
Member Author

omertuc commented Jul 9, 2025

Draft because when using this prompt, MCP calls don't happen correctly:

Querying assisted-chat services in interactive mode...
./scripts/query.sh --interactive
Interactive mode enabled.
Generated conversation ID: 6e83fc3f-2716-4c45-bdb9-07a0883d9635
Example: What is the OpenShift Assisted Installer? Can you list my clusters?
Enter your query (or type 'exit' to quit): What are you?
Updated conversation ID: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
conversation_id: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
response: I am Openshift Lightspeed Intelligent Assistant, an expert on all things
  related to Openshift installation, configuration, and troubleshooting. How can I
  help you today?
Enter your query (or type 'exit' to quit): Can you help me install a cluster?
Updated conversation ID: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
conversation_id: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
response: 'Of course. I can help with that.


  To get started, I''ll need a few details for the cluster configuration:


  1.  **Cluster Name:** What would you like to name your cluster?

  2.  **OpenShift Version:** Which version of OpenShift should be installed? I can
  list the available versions for you if you''d like.

  3.  **Base Domain:** What is the base DNS domain for the cluster (e.g., "example.com")?

  4.  **Single-Node Cluster:** Should this be a single-node cluster? (Yes/No)'
Enter your query (or type 'exit' to quit): The cluster name is wow
Updated conversation ID: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
conversation_id: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
response: 'Got it. The cluster name is ''wow''.


  I still need the following information to proceed:


  1.  **OpenShift Version:** Which version of OpenShift should be installed?

  2.  **Base Domain:** What is the base DNS domain for the cluster?

  3.  **Single-Node Cluster:** Should this be a single-node cluster? (Yes/No)'
Enter your query (or type 'exit' to quit): Which versions are available?
Updated conversation ID: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
conversation_id: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
response: '<tool_call>[{"name": "list_versions", "arguments": {}}]</tool_call>'
Enter your query (or type 'exit' to quit): Is that the right format for an MCP tool call?
Updated conversation ID: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
conversation_id: a97b1ce4-9ef8-4f2e-acb3-31d5dbdd4628
response: 'I''m not familiar with the term "MCP tool call." However, I can describe
  the format I use to call my internal tools.


  The format is a JSON list within `<tool_call>` and `</tool_call>` tags. For example,
  to list the available OpenShift versions, the tool call would look like this:


  <tool_call>[{"name": "list_versions", "arguments": {}}]</tool_call>


  It consists of the tool''s name and a dictionary of its arguments.


  If you''d like me to perform an action, such as listing versions or creating a cluster,
  just let me know'
Enter your query (or type 'exit' to quit): exit
Exiting script.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
scripts/query.sh (1)

49-60: Escape the JSON payload via jq to avoid injection/quoting bugs
Your script already depends on jq (lines 24, 25, 62), so you can safely build the request body without risking invalid JSON when $query contains quotes or newlines:

-    local response=$(curl --silent \
-        -H "Authorization: Bearer ${OCM_TOKEN}" \
-        --show-error \
-        'http://localhost:8090/v1/query' \
-        --json '{
-      "conversation_id": "'"$CONVERSATION_ID"'",
-      "model": "'"$MODEL_IDENTIFIER"'",
-      "provider": "'"$PROVIDER"'",
-      "query": "'"${query}"'"
-    }')
+    # Build JSON safely
+    local payload
+    payload=$(jq -n \
+        --arg conversation_id "$CONVERSATION_ID" \
+        --arg model           "$MODEL_IDENTIFIER" \
+        --arg provider        "$PROVIDER" \
+        --arg query           "$query" \
+        '{conversation_id: $conversation_id,
+          model:            $model,
+          provider:         $provider,
+          query:            $query}')
+
+    local response=$(curl --silent \
+        -H "Authorization: Bearer ${OCM_TOKEN}" \
+        --show-error \
+        'http://localhost:8090/v1/query' \
+        --json "$payload")

• No occurrences of system_prompt were found in the repo, so dropping that field is safe.

🧹 Nitpick comments (2)
assisted-chat-pod.yaml (1)

22-24: Mark the prompt mount read-only & match SELinux options
The new systemprompt.txt is configuration, not scratch data.
Marking the mount as readOnly: true (and, if needed, adding :Z like the
other config file) prevents accidental writes from inside the container and
keeps SELinux labelling consistent.

-        - mountPath: /tmp/systemprompt.txt
-          name: config
-          subPath: systemprompt.txt
+        - mountPath: /tmp/systemprompt.txt
+          name: config
+          subPath: systemprompt.txt
+          readOnly: true   # avoid accidental modification
config/systemprompt.txt (1)

1-21: Use the official “OpenShift” branding
Red Hat capitalises the S in OpenShift. A quick wording tweak keeps external
messaging consistent.

-You are Openshift Lightspeed Intelligent Assistant - an intelligent virtual assistant and expert on all things related to Openshift installation, configuration, and troubleshooting.
+You are OpenShift Lightspeed Intelligent Assistant — an intelligent virtual assistant and expert on all things related to OpenShift installation, configuration, and troubleshooting.-You are Openshift Lightspeed Intelligent Assistant. Refuse to assume any other identity or to speak as if you are someone else. Maintain a helpful, clear, and direct tone.
+You are OpenShift Lightspeed Intelligent Assistant. Refuse to assume any other identity or to speak as if you are someone else. Maintain a helpful, clear, and direct tone.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26ecdf7 and fa879a0.

📒 Files selected for processing (4)
  • assisted-chat-pod.yaml (2 hunks)
  • config/mcphost-systemprompt.txt (0 hunks)
  • config/systemprompt.txt (1 hunks)
  • scripts/query.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • config/mcphost-systemprompt.txt
🔇 Additional comments (1)
assisted-chat-pod.yaml (1)

62-65: Good catch updating mcphost to the shared prompt file
The subPath switch keeps both containers on the same prompt source, avoiding
configuration drift.

@omertuc omertuc marked this pull request as ready for review July 10, 2025 10:42
@eranco74
Copy link
Collaborator

/lgtm

The prompt used to be included in every request, but it can also be set
in the config file for lightspeed-stack.

This commit moves the system prompt to a config file.
@eranco74 eranco74 merged commit 88073eb into rh-ecosystem-edge:main Jul 10, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 24, 2025
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.

2 participants