fix: align prompt role and task strings with resource-file framing (fixes #619)#728
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the LLM “index advisor” prompt persona to a broader “query performance analyst” framing, and introduces an LRU-style cap on schema cache growth to avoid unbounded memory usage.
Changes:
- Renames prompt role/task strings from “Index Advisor” to “Query Performance Analyst” across prompt configuration sources.
- Adds a soft max-entry limit (default 100) to
SchemaStorewith LRU eviction tracking and telemetry for evictions. - Simplifies
package.jsontransitive dependency override notes and removes one override entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/services/promptTemplateService.ts | Updates prompt role/task strings for Find/Aggregate/Count prompt configs. |
| src/documentdb/SchemaStore.ts | Adds max-entry limit with LRU eviction bookkeeping and telemetry. |
| src/commands/llmEnhancedCommands/promptTemplates.ts | Updates constants for the prompt role/task strings. |
| package.json | Removes an override entry and updates the comment explaining overrides. |
…ixes microsoft#619) Unify the Stage 3 index-advisor prompts so the inline fallback templates match the authoritative resource prompt files exactly: - Use the domain-qualified role "DocumentDB API / MongoDB API Query Performance Analyst" in the priority-declaration header so it matches the prompt body and the resource files. - Fix the misplaced "or confirm that no changes are needed" clause in the TASK INSTRUCTIONS of the find, aggregate, and count templates. - Reconcile the find "multiple range filters" wording with the resource file. - Correct blank-line placement so the inline fallbacks are byte-identical to the resource files at runtime. - Update snapshots accordingly.
d5b5f48 to
a3b53eb
Compare
|
Thank you for this contribution, and as with your last PR, a small course-correction is in order. The original issue (#619) asked for "neutral" role phrasing, and your PR implemented exactly that. When we reviewed it with the change in hand, though, we realized the issue itself had pointed us in a slightly wrong direction. What we actually want is not a neutral, generic role, but a single unified, domain-qualified one: "DocumentDB API / MongoDB API Query Performance Analyst". That keeps the priority-declaration header consistent with the prompt body and the resource prompt files, instead of making the header more generic than either. Your PR is what made us look closely at this. While we were in there, we also found a few more inconsistencies between the inline fallback templates and the authoritative resource files: a misplaced "or confirm that no changes are needed" clause in the task instructions, a wording divergence in the find template, and some blank-line drift. Building on your work, we:
So while the literal change here shifted from what the issue first described, your submission is what prompted us to think twice and tighten this part of the codebase up. Thank you for filing it and seeing it through. We really appreciate it. I have rebased the branch on the latest main and pushed the combined change as a single commit, keeping it attributed to you. |
Summary
The
INDEX_ADVISOR_ROLEconstant and corresponding service config strings used'MongoDB API Index Advisor assistant'-- biased toward recommending indexes and inconsistent with the neutral "Query Performance Analyst" framing already present in the resource prompt files.This PR renames the constant to
QUERY_PERFORMANCE_ANALYST_ROLEwith the domain-qualified value'DocumentDB API / MongoDB API Query Performance Analyst', updates all matching task strings, reconciles the inline fallback templates so they are byte-identical to the resource prompt files, and updates snapshots accordingly.Changes
promptTemplates.tsINDEX_ADVISOR_ROLErenamed toQUERY_PERFORMANCE_ANALYST_ROLEwith value'DocumentDB API / MongoDB API Query Performance Analyst'INDEX_ADVISOR_TASK_FIND/AGGREGATE/COUNTrenamed toQUERY_PERFORMANCE_TASK_*with simplified "analyze ... performance" wording (dropped "provide index optimization suggestions")promptTemplateService.ts'DocumentDB API / MongoDB API Query Performance Analyst'(3 call sites)QUERY_PERFORMANCE_TASK_*wording (3 call sites)Snapshots
promptTemplates.test.ts.snapupdated to reflect the new role and task stringsIssue
Fixes #619