Skip to content

feat(compass-assistant): add follow-up question chips to assistant response COMPASS-10712#8163

Open
pavithrachidambaram-afk wants to merge 1 commit into
mainfrom
COMPASS-10712
Open

feat(compass-assistant): add follow-up question chips to assistant response COMPASS-10712#8163
pavithrachidambaram-afk wants to merge 1 commit into
mainfrom
COMPASS-10712

Conversation

@pavithrachidambaram-afk

@pavithrachidambaram-afk pavithrachidambaram-afk commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Description

Parses and renders follow-up question chips from AI assistant responses for the SearchActivationPhase2 experiment (COMPASS-10712).

When the enableSearchActivationProgramP2 experiment is active and the AI response includes a ### Follow-Up Questions section, the questions are extracted from the response text, stripped from the displayed message, and rendered as clickable chips below the last assistant message.

For last message:
The follow-up section is hidden from response as soon as the header appears (even mid-stream), but chips are only shown once the response is fully complete as we don't want to display incomplete question chips. By stripping the section from the rawText early (as the header appears), we prevent the raw ### Follow-Up Questions section from flashing during streaming.

For older messages (non-last message):
We strip the Follow-up section completely and do not display the chips as well

  • Clicking a chip sends that question to the assistant and hides all chips (enableHideOnSelect)
  • Chips only appear on the last assistant message. Once the user sends another message, chips from the previous response are gone — unanswered follow-ups disappear if the user types instead of clicking
  • isLastMessage and isResponseComplete are passed into parseFollowUpQuestions so all gating logic lives in the parser, not in JSX
  • The prompt (buildExplainPlanPrompt) is updated to specify an explicit numbered format (1., 2., 3.) for predictable parsing
  • Fallback: If not able to parse the questions in a last message that is complete (due to unexpected format), the full raw text renders as normal markdown — no content is lost
  • FOLLOW_UP_QUESTIONS_HEADER is exported from prompts.ts and used in both the prompt template and the parser — single source of truth
  • Gated behind the enableSearchActivationProgramP2 experiment variant
Screen.Recording.2026-06-19.at.1.29.24.PM.mov

(Note: For local testing, use the Feature Flag gate since it is not possible to turn ON the experiment directly)

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions Bot added the feat label Jun 19, 2026
@pavithrachidambaram-afk pavithrachidambaram-afk added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Jun 19, 2026
@pavithrachidambaram-afk pavithrachidambaram-afk requested review from a team and JimmyChoiMDB and removed request for a team June 19, 2026 17:12
@pavithrachidambaram-afk pavithrachidambaram-afk force-pushed the COMPASS-10712 branch 2 times, most recently from 73cbbfb to 1349dae Compare June 19, 2026 18:23
@pavithrachidambaram-afk pavithrachidambaram-afk marked this pull request as ready for review June 19, 2026 18:38
@pavithrachidambaram-afk pavithrachidambaram-afk requested a review from a team as a code owner June 19, 2026 18:38
@pavithrachidambaram-afk pavithrachidambaram-afk requested review from Anemy and johnjackweir and removed request for johnjackweir June 19, 2026 18:38
@pavithrachidambaram-afk pavithrachidambaram-afk force-pushed the COMPASS-10712 branch 3 times, most recently from 6a60f5f to 37fba16 Compare June 19, 2026 19:29
…sponse COMPASS-10712

- Parse the ### Follow-Up Questions section from AI responses, strip it from
  the displayed message text, and render the extracted questions as clickable
  chips below the last assistant message
- Clicking a chip sends that question and hides all chips (enableHideOnSelect)
- Chips are only shown for the last assistant message, after streaming completes,
  and when the SearchActivationProgramP2 experiment is enabled
- FOLLOW_UP_QUESTIONS_HEADER constant is shared between the prompt template and
  the parser as a single source of truth for the section marker
- Prompt format updated to specify explicit numbered output for predictable parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat feature flagged PRs labeled with this label will not be included in the release notes of the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant