Repository navigation
Description
Bug Description
The AI helper treats a short follow-up answer such as “yes” as off-topic even after the assistant asks a question. The frontend sends only previous messages in history, ending with the assistant's model message. isContextualResponse() checks the second-to-last entry, which is the earlier user message, so the contextual answer is rejected before Gemini receives it.
Steps to Reproduce
-
In the AI helper, ask an on-topic question, such as “Can you help me prepare for coding interviews?”
-
After the assistant replies with a follow-up question, answer “yes”.
-
frontend/src/components/AIHepler.jsxbuildshistoryfrom the existingmessagesstate before the current prompt is added to the request. A completed exchange therefore sends roles[user, model]. -
On current
main(a8d14cf46d659f55efd7b79043f8caecc8eb6213), this focused reproduction printscontextual: falseanddomain: false:const { isContextualResponse, isPrepPilotDomain } = require('./backend/utils/domainClassifier'); const history = [ { role: 'user', text: 'Can you help me prepare for interviews?' }, { role: 'model', text: 'Yes. Shall we start with coding?' }, ]; console.log({ contextual: isContextualResponse('yes', history), domain: isPrepPilotDomain('yes') });
Expected Behavior
The answer should be recognized as a follow-up to the assistant's question and passed to the AI mentor with the preceding conversation.
Actual Behavior
isContextualResponse() returns false. The domain check also returns false for “yes”, so /api/generate returns its off-topic local-classifier response instead of continuing the conversation. The same result occurs after two or more completed exchanges.
Severity
Medium
Screenshots / Screen Recording
Not captured. The exact frontend history shape and backend helper were checked from source; the focused Node reproduction above was run. A full browser/server test was not run.
Browser
Not browser-specific.
Operating System
Not OS-specific.
Additional Context
The earlier completed #561 / #566 changed the index based on an assumption that history includes the current user prompt. The current AI helper request sends that prompt separately, so the actual contract differs. I found no open issue or PR for this current flow in targeted searches. If this is in scope, please assign it to shrinivas-sn; I can add a focused regression test and fix after confirmation. I would also appreciate confirmation of OSCI'26 eligibility.
Activity
github-actions commentedon Oct 12, 2026
Thanks for creating this issue!
If you'd like to work on it, simply comment:
The first person to claim the issue will be assigned automatically.
Happy contributing!
shrinivas-sn commentedon Oct 12, 2026
/claim
github-actions commentedon Oct 12, 2026
✅ @shrinivas-sn has successfully claimed this issue!
You've been assigned. Happy coding!
github-actions commentedon Oct 27, 2026
This issue has had no activity for 14 days and has been marked as
stale. If this is still relevant, please leave a comment or push an update within the next 7 days, otherwise it will be closed automatically to keep the tracker clean.shrinivas-sn commentedon Oct 31, 2026
PR #2366 has been submitted and is currently awaiting maintainer review.
fix(ai): allow contextual reply when history has single assistant mes…
github-actions commentedon Nov 15, 2026
This issue has had no activity for 14 days and has been marked as
stale. If this is still relevant, please leave a comment or push an update within the next 7 days, otherwise it will be closed automatically to keep the tracker clean.shrinivas-sn commentedon Nov 16, 2026
Still active and relevant! The fix is implemented, verified, and submitted in PR #2401 (#2401), currently awaiting maintainer review.