Skip to content

fix(backend): add prompt guardrails from feedback#144

Merged
alexinthesky merged 2 commits into
mainfrom
fix/feedback-prompt-guardrails
Jun 9, 2026
Merged

fix(backend): add prompt guardrails from feedback#144
alexinthesky merged 2 commits into
mainfrom
fix/feedback-prompt-guardrails

Conversation

@alexinthesky

@alexinthesky alexinthesky commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Tightens the default system prompt to fix three recurring complaints from the internal Ask O11y feedback round. All changes are in DefaultSystemPrompt; /api/prompt-defaults returns this constant directly, so the config UI stays in sync (no route/OpenAPI change). Provisioned custom prompts intentionally don't inherit these.

  • No unprompted writes — default to read-only investigation; propose and confirm before creating/modifying/deleting any resource (alerts, dashboards, silences, rules, annotations).
  • Capability honesty — only claim capabilities backed by an available tool; say so plainly when something is unsupported instead of inventing a workflow.
  • Honor user-specified time ranges — use exactly the range the user names, no silent fallback to a default window.

Testing

  • go test ./pkg/... ✅ (extended prompts_test.go to assert all three guardrails appear in the assembled prompt)

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to default prompt text, a unit test, and CI action SHA pins; no auth, data paths, or API contract changes.

Overview
Strengthens the default Ask O11y system prompt (DefaultSystemPrompt) to address recurring feedback: mutating Grafana resources only when the user explicitly asks (otherwise propose and confirm), a new capability honesty rule in the anti-hallucination contract, and strict use of user-specified time ranges without silent defaults.

Adds TestBuildSystemPrompt_FeedbackGuardrailsPresent so the assembled prompt always includes those three snippets. Custom provisioned prompts still override via settings and do not pick up these defaults automatically; /api/prompt-defaults continues to serve the updated constant.

CI pins grafana/plugin-actions wait-for-grafana and is-compatible to commit 2ecc2ba… instead of @main.

Reviewed by Cursor Bugbot for commit 243444e. Bugbot is set up for automated code reviews on this repo. Configure here.

Address three recurring complaints from the internal Ask O11y feedback
round by tightening the default system prompt:

- No unprompted writes: default to read-only investigation; propose and
  confirm before creating/modifying/deleting any resource.
- Capability honesty: only claim capabilities backed by an available
  tool; say so plainly when something is unsupported instead of inventing
  a workflow.
- Honor user-specified time ranges exactly rather than drifting to a
  default window.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Org policy requires all GitHub Actions pinned to a full-length commit SHA.
Pin wait-for-grafana (e2e) and is-compatible (compatibilitycheck) to the
current plugin-actions main SHA to unblock required checks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexinthesky
alexinthesky merged commit a6f0aaa into main Jun 9, 2026
14 checks passed
@alexinthesky
alexinthesky deleted the fix/feedback-prompt-guardrails branch June 9, 2026 08:37
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.

1 participant