Repository navigation
Query Store clutter and oversized-plan backlog: MCP reading guidance moves off tools/list (#3898) - #4067
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M7r1CXmEcBmsrTV34CCLfF
erikdarlingdata
marked this pull request as ready for review
September 23, 2026 20:13
erikdarlingdata
enabled auto-merge (squash)
September 23, 2026 20:13
erikdarlingdata
added a commit
that referenced
this pull request
Sep 23, 2026
…ntries in their sections (#4080) Adds 42 entries and 42 link refs (#3992, #3995, #3996, #3998, #4001, #4002, #4003, #4007, #4010, #4011, #4013, #4015, #4020, #4022, #4025, #4029, #4030, #4031, #4036, #4038, #4039, #4040, #4044, #4047, #4048, #4049, #4050, #4051, #4055, #4061, #4063, #4064, #4065, #4066, #4067, #4068, #4069, #4070, #4071, #4073, #4074, #4078). Each PR's entry was buffered, and this lands every entry whose PR was merged on origin/dev when it ran. #3989 left 26 entries under bare 'Changed' and 'Fixed' lines above '### Added'. They move into '### Changed' and '### Fixed', below the new entries, and one blank line stays under [Unreleased]. Claude-Session: https://claude.ai/code/session_01Ua31ugERL5DmhFVRtf6keQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3898. Moves the reading guidance in two Darling-only MCP tools off
tools/listintoget_tool_guidetails:
get_query_store_clutterandget_oversized_plan_backlog.Neither tool has a Lite twin. Verified by
git grep -n 'Name = "<tool>"' -- Lite/Mcp: both already sit onCrossAppMcpToolInventoryPinTests' known-missing roster. So this PR makes no Lite changes.What changes
Both descriptions now carry
<<GUIDE>>. A short new head stays ontools/list. The full original prose(minus two D4 removals) becomes each tool's
get_tool_guidetail.get_query_store_clutterget_oversized_plan_backloginclude_fleet_median's parameter description was 322 characters. It is now a 190-character guardrail: whatthe flag does, that it defaults to false, and to see the reading guide. Its full original wording moves into
the tool's own tail, appended right after the tail's existing
fleet_median is opt-in (include_fleet_median): ...sentence.Corrections
None. Both tools' original prose was checked against the tool bodies while drafting the heads. No factual
errors turned up.
D4 removals
Two, both in
get_query_store_clutter's tail.get_oversized_plan_backlogcarried no issue references oranecdotes.
(#3796)issue reference in "null means the newest capture predates the V137 rung (query_store_health does not collect QUERY_CAPTURE_MODE or WAIT_STATS_CAPTURE_MODE — the one option that names a plan-churn factory is the one the health row omits #3796) that addedthe column." The reference is gone. The rule stays: "predates the V137 rung that added the column, which is
NEVER ASKED and never NONE."
#3502issue reference and its one-clause anecdote in "get_collection_health's fanout.dominance is slowest-vs-mean, not a concentration verdict — publish the slowest item's share of the pass directly #3502 verdict figure;the motivating case read 92-96%." Both are gone. The cross-tool naming fact stays:
"get_collection_health's verdict figure."
Verified with
dropcheck.py origin/dev HEAD get_query_store_clutter get_oversized_plan_backlog.get_oversized_plan_backlogshowsmissing=0.get_query_store_cluttershowsmissing=1: one long run-onchunk, because the splitter finds no sentence break between the
(a) read_costclause and the92-96%anecdote inside it. That one reported "sentence" folds both removals above, plus their surrounding unchanged
text, into a single line. Same shape as PR #4063's D4 report.
McpToolGuideHeads.SqlTail.cs'sQueryStoreClutter_D4Removals_DropTheIssueRefsAndAnecdote_KeepTheRulespins that both issue numbers and theanecdote are gone, and that both rules survive.
Re-pointed pins
One, mechanical.
Darling.Tests.QueryStoreClutterTests.Description_TeachesTheArms_TheReplicaRule_TheExclusions_CaptureMode_AndTheWindowFloorasserted the literal
"#3796"against the tool's full description text. D4 removes that issue number from thewire. So the pin now checks
"V137". That is the rung name that the same sentence still carries. The name ofthe test already promises to check it ("CaptureMode").
D9 traps (11)
Each is a question that a model can get wrong when it reads only the served heads.
get_query_store_clutterreturnsqs_overheadwith high QDS_* wait time. Which database caused it?Correct: none is namable. Overhead is per SERVER.
Prevents it: the head's "qs_overhead (waits/memory clerk) is per SERVER, never attributed to a
database."
read_cost/plan_churn/configare all null. Is that database's Query Store idle?Correct: clutter is per DATABASE. A null arm on one row says nothing about server overhead or any other
database.
Prevents it: the head's "Clutter (read_cost/plan_churn/config) is per DATABASE."
status: unavailable. Is Query Store just quiet this window?Correct: no. No rows in any of the three arms is reported as
unavailable, not a clean, quiet answer.Check the precondition ladder (engine capability, runtime precondition) before concluding nothing ran.
Prevents it: the head's "No rows answers unavailable, never a clean bill."
verdict: Unknown. Is its Query Store healthy?Correct: no. Unknown means unmeasured, never quietly Healthy.
Prevents it: the head's "Verdict Unknown means unmeasured, never quietly Healthy."
excluded: true,verdict: Unknown. Is that a misconfigurationto fix?
Correct: no. Query Store on a readable secondary is read-only by design. It is never a defect.
Prevents it: the head's "REPLICAS: excluded, verdict Unknown, never a defect."
query_capture_modeis null. Is the server's capture modeNONE?Correct: no. Null means the newest capture predates the column and was never asked. NONE is a real,
distinct mode the engine reports separately.
Prevents it: the head's "query_capture_mode null means never asked, never NONE."
window_truncated: true. Were rows paged away? Would a biggerlimitfix it?Correct: no to both. It is the plan-churn/wait arms' raw-tier retention floor, not a page cut. No
limitvalue changes it.Prevents it: the head's "window_truncated is a retention floor, not a page cut: no limit fixes it."
fleet_median. Does that mean no fleet data exists?Correct: no.
include_fleet_medianwas left at its default of false, so the field is not computed.Prevents it: the head's "fleet_median is null unless include_fleet_median=true."
get_oversized_plan_backlogshows onlypendingrows withlast_captured_at: null. Is that just anearly, quiet backlog?
Correct: no. It is the one signature that says the out-of-band sweep's fetch half has never once
succeeded on that server. It is indistinguishable from healthy on every other surface.
Prevents it: the head's "Read last_captured_at/last_expired_at FIRST" beside "No time window: a worklist
updated in place, not a series." There is no earlier or later row to compare against, so the stamp is the
only signal.
captured, butget_plan_xmlstill returns nothing for it. Is that a bug?Correct: no.
rows_with_contentis not the same claim ascaptured. A captured row can still carry nocontent, which is exactly the case the fallback read cannot serve yet.
Prevents it: the tail's "rows_with_content sits beside captured on purpose and is NOT redundant" (kept
off the head for space). The head's own partition fact, "pending+captured+expired=total_rows," at least
tells a reader the three verdicts are exhaustive and distinct.
server_nameand setsinclude_rows: true. It comes back with an error. Why not justreturn the fleet's rows?
Correct: the claim key means something only within one server. A fleet-wide listing is mostly
identifiers for servers that nobody asked about. So the tool refuses the call and does not widen it.
Prevents it: the head's "include_rows requires server_name (refused otherwise)."
Test plan
Darling/Darling.Tests/Darling.Tests.csprojbuilds with 0 Warning(s), 0 Error(s).McpToolGuide*,McpToolsListBudget*,McpPayloadContractCensus*,QueryStoreClutter*,OversizedPlanBacklog*,McpDescription*,McpZeroIsAMeasurement*,DarlingMcpConfigHistory*): 279 total, 0 failed, 9 skipped (live-PostgreSQL, no rig).McpToolGuideHeads.SqlTail.cshead-fact pin, watched it fail, restored it, watchedit pass again.
dropcheck.py origin/dev HEAD get_query_store_clutter get_oversized_plan_backlog:get_oversized_plan_backlog missing=0.get_query_store_clutter missing=1(the D4 removals above, listed).git merge origin/dev: already up to date, no conflicts.CrossAppMcpToolInventoryPinTests' known-missing roster and a directgit grepofLite/Mcp. This PRtouches no file under
PerformanceMonitor.Common, so Lite's build is unaffected.origin/dev(1dc11cf, with get_collection_log and get_query_store_top reading guides move off tools/list (#3898) #4065): dropcheck shows only the D4 unit listed above. D9: 11/11, with no misreading. The answers to Q2 and Q10 were hedged, and the model marked get_tool_guide as needed. FullDarling.Tests13,219 total, 0 failed. FullLite.Tests5,232 total, 0 failed.Handoff
Nothing deferred. Both assigned tools are fully converted, pinned and green. No new topic was added to
McpToolGuideTopics.SqlTail.cs. It stays the empty scaffold, because the two tools share no duplicated prosewith each other.
🤖 Generated with Claude Code
https://claude.ai/code/session_01M7r1CXmEcBmsrTV34CCLfF