Potential duplicate OWASP question classification in NestBot auto-reply flow
- Dominant language
- Python
- Stars
- 451
- Forks
- 707
- Avg merge
- 22h 59m
- Merged PRs (30d)
- 91
Description
## Description
While reviewing the NestBot auto-reply flow, I noticed that OWASP question classification appears to run twice for messages that eventually receive an automated response.
Current flow:
1. `MessagePosted.handle_event()` calls `QuestionDetector.is_owasp_question()`
2. If classified as OWASP-related, the delayed auto-reply job is scheduled
3. `generate_ai_reply_if_unanswered()` later calls `process_ai_query()`
4. `process_ai_query()` creates another `QuestionDetector` instance and performs classification again
Relevant references:
* `backend/apps/slack/events/message_posted.py`
* `backend/apps/slack/services/message_auto_reply.py`
* `backend/apps/slack/common/handlers/ai.py`
Since `QuestionDetector` performs retrieval and an OpenAI-based classification step, this may result in duplicate work for messages that have already been validated before being queued.
## Questions
* Is the second classification intentional ?
* Would it make sense to reuse the original classification result for the auto-reply path ?
* Could this reduce OpenAI usage and retrieval overhead without changing behavior ?
Happy to investigate further if maintainers think this is worth pursuing.
Contributor guide
Assessment
This issue has not been assessed yet.