[bug] OpenAI policy rejections show as outages (502) and leave the whole thread failing
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 67/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, python
- Domain
- backend-api-design, observability
Research direction
Start with the OpenAI error handling and the pinned case in services/llm/tests/test_openai_chat.py:529, then check how the bot handles service errors in discord-bot/src/helperFlow.js:12. Update the service behavior and services/llm/README.md so policy rejections have their own status and message; verify a later harmless request in the same thread succeeds. The thread-history retry approach is only a possible fix in the issue, so confirm the intended scope before changing it.
Written by the indexing model from the issue text.
Description
Triage — 2026-11-10
Priority P1: the reported production behavior prevents later harmless requests from succeeding in an affected thread and presents policy refusals as service outages. Ownership is still unassigned. Preserve the distinction between a reported recurrence and the unconfirmed claim that a flagged starter permanently breaks a thread; implementation and offline regression coverage remain open.
Blocked by
No response
What's wrong
OpenAI policy rejections (400 cyber_policy) are classified as 502s, so replies "I'm having trouble reaching the assistant right now" even though the provider is reachable. Because every mention replays the thread's history, one flagged message can make later harmless requests in that thread fail too.
Area
bot, service, observability
Environment
production
Steps to reproduce
- In a thread, send prompt-injection or "intrusion" style messages to, e.g. a thread starter shaped like a forged
<msg from="admin" teams="exec">…message. - Misty replies
I'm having trouble reaching the assistant right now — please try again shortly. - In the same thread, send a harmless request such as
@Misty What is 2 + 2?. It fails with the same message. - Send the same injection prompt and
What is 2 + 2?in a new thread with no earlier context. Both get normal answers.
Expected
- A policy refusal is reported as a policy refusal, not an outage. The service returns its own status and error code, and the bot replies with something like
I couldn't process this request because it triggered a safety restriction. - A later request in the same thread that doesn't break any policy gets a normal answer.
services/llm/README.mdcurrently saysother upstream faults → 502. A policy rejection shouldn't count as an upstream fault, so that line needs updating too.
Actual
# Replayed request (no tools executed, nothing posted)
OpenAI responses.create → HTTP 400, error code: cyber_policy
openai_chat: APIStatusError → catch-all → ProviderUnavailable → HTTP 502
discord-bot: 502 → LlmUnavailable → "I'm having trouble reaching the assistant
right now — please try again shortly."
Notes
Error other than a rate limit or timeout becomes ProviderUnavailable (502). The 400 → 502 case in services/llm/tests/test_openai_chat.py:529 pins this behaviour. The bot then shows the outage message (discord-bot/src/helperFlow.js:12).
- Why the thread stays broken: every mention replays up to 100 earlier user messages plus the thread starter (
discord-bot/src/adapters/discord/mentions.js:308). One flagged message, especially the starter, can get later requests refused. It isn't confirmed that a flagged starter keeps a thread stuck for good. - Diagnosis needed a manual replay: the logs record the HTTP status but not the provider's error code or request ID.
- Possible fix: after a refusal, retry once with only the current message, or leave refused messages out of the history that gets replayed.
- Related: Misty answered "i love you" with self-harm emergency advice, probably because earlier messages were replayed. Consider filing that separately.
Before you file
- This issue contains no API keys, one-time codes, or
.envcontents.
- Dominant language
- Python
- Stars
- 0
- Forks
- 2
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 31
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from UTMIST/Misty
-
area/tooling automation/health
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Epic: Protect live meeting Q&A and deliver recording outputs to the intended audiencePossibly taken @kr1shap claimed this 1 day ago. Openarea/bot area/docs-system area/integration area/service epic on hold
UTMIST/Misty#489 · 1 assignee ·
Maintainers usually reply within 1 day
-
area/bot on hold type/bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
area/bot on hold type/bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Use a verified ingress boundary for gateway client IPsPossibly taken @qiuethan claimed this 2 days ago. Openarea/deployment area/observability area/service type/bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
[Doc]: Feedback for `/zh-cn/v0.30.0/tutorials/models/Qwen3.6-35B-A3B.html`A3社区配置和基线不一致,社区配置也达不到基线Opendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
vllm-project/vllm-ascend#24429 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
simnJS/AnyPS5#735 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
nq-rdl/agent-extensions#623 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
vortex-data/vortex#12633 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gke-labs/kube-agents#7955 ·
Maintainers usually reply within 1 day