Repository navigation
Commit e0f6d8d
authored
Findings: a card for every tool result, and citations that reach them (#1802)
## Summary
Every tool result the agent can cite now has a card in the Findings
pane, and the card carries what the citation is about. Before this, a
Helm release rendered without its hooks, history or values; a
permissions check without its rules; and `top_resources`,
`get_cluster_audit`, `get_cluster_upgrade_readiness`,
`list_helm_releases`, `list_packages`, `search` and `discover_metrics`
had no card at all, so a claim about them sat under "Notes without a
card". Live runs also showed the agent citing the new kinds with the one
word the prompt gives it, `resource`, and the resolver rejecting it;
those claims never reached their cards either.
## What changed
**Cards for the remaining tools** (`investigationEvidence/adapters/`)
- `ranking`: `top_resources` rows with cpu and memory against limits,
sorted as the tool sorted them, the target's rows marked;
`metricsAvailable: false` becomes a limit rather than a card.
- `posture`: `get_cluster_audit` and `get_cluster_upgrade_readiness`
keep only findings about the target or objects it manages (`managedBy`),
rendered as configuration checks with severity, check and remediation,
never as an outage; a scan with nothing about the target files a receipt
carrying the verdict.
- Inventory reuse: `list_helm_releases` (release, status, chart, health
issue), `list_packages` (version, sources), `search` (the matched field
and snippet on the row). A listing's identity now includes the tool, so
a cluster-wide Helm list and a cluster-wide package list are two cards,
not one with a revision.
- `discover_metrics`: a receipt naming what was searched and how much
came back in the last hour; truncation becomes a limit.
- Helm card: hooks (kind, name, event), revision history (newest first,
ten), values set by the user. `get_helm_release` now returns `history`
beside the detail it already loaded. Permissions card: effective rules
under the bindings, up to the tool's cap.
**Placement** (`investigationCase.ts`, prompt in
`internal/ai/diagnoser.go`, `docs/mcp.md`)
- `observation: "resource"` names every resource-shaped kind (resource,
listing, ranking, posture, Helm release, permissions, neighborhood, dns,
network). The stream-shaped kinds keep their own word so one word still
picks one observation of a diagnose bundle.
- A call that yielded a single observation is not held to the word at
all; what the subject names still has to match. This is what places a
receipt the agent called `metrics` or `resource`.
- A listing binds when the subject names an entry it holds even if the
kinds differ: a package row carries Radar's own kind and the agent names
the object that declares it (a Flux HelmRelease in flux-system), so
packages are matched by name.
**The excerpt slot** (`investigationEvidence/excerpt.ts`,
`StoryExcerpt.tsx`)
- What a placed story card shows inline (log lines, the named inventory
rows, a ranking's target rows, posture findings about the target, the
metrics chart on cause and symptom cards) is one decision in one place.
Behaviour-preserving for the kinds that had inline content.
- On Captured results cards, the rows a listing's citations name lead
the list with a faint highlight, so the entry a claim is about is in
view without scrolling a long inventory.
**Running label** is a pure function with tests
(`investigationRunningLabel`).
## Testing
- `make tsc`, eslint on the diagnose tree, `npm test` (vitest over
`src`, 1365 tests), `go test ./internal/ai ./internal/mcp`, `go build
./...`, web build.
- New tests: adapters for every new card, the excerpt slot, resolver
placement for resource-shaped citations and the sole-observation rule,
listing identity per tool, package rows named by the declaring kind,
cited rows leading the inventory body.
- Visual test: ran. Before/after captures of every changed card type on
three saved runs (podinfo and crashloop on the kind gitops demo, a live
crash loop on the GKE nonprod cluster for ranking, upgrade readiness,
Helm listing and metric discovery), baseline built from
`refactor/findings-structure`. Review packet linked from the PR
conversation.
- Not verified live: posture findings that name the workload, and a
ranking with the target's row marked (neither cluster produced one);
both unit-tested.
## Follow-ups
- A cause claim on a `get_pod_logs` read that names the container stays
unplaced when the read was made without a container argument (identity
container undefined). Pre-existing.
- The focus contract (PR 3 of the coverage plan) is untouched; it needs
the mockup approval.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes investigation evidence projection, story placement, and agent
verdict contracts; incorrect binding could misplace cards but does not
touch auth or cluster mutation paths.
>
> **Overview**
> **Findings now turns almost every citable MCP read into a real card**,
with citations that can reach them via `observation: "resource"`
(listings, rankings, posture, Helm, permissions, neighborhood, etc.)
instead of leaving those claims under “Notes without a card.”
>
> New **evidence adapters** add **ranking** (`top_resources`),
**posture** (cluster audit / upgrade readiness filtered to the
workload), **inventory-style** cards for Helm releases, packages, and
search hits, plus **metric-discovery receipts**; **Helm** and
**permissions** cards gain hooks, revision history (newest ten), user
values, and effective RBAC rules. **`get_helm_release`** now includes a
capped **`history`** in the default MCP response (full history still via
`include=history`).
>
> **Citation placement** in `investigationCase` treats resource-shaped
observations broadly, skips the observation word for sole **receipt**
results, and improves **package/listing** subject matching
(declaring-object kinds, namespace rules). **Story placement** moves
inline slices (log lines, cited inventory rows, target ranking/posture
rows, cause/symptom charts) into **`storyExcerpt`** /
**`StoryExcerpt`**, with cited rows leading long inventory lists in
Captured results.
>
> **Docs** (`docs/mcp.md`) and the **diagnoser prompt**
(`verdictContract` / `storyGuidance`) are updated so agents know which
tools are placeable and how to cite them.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
67da046. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 8fba01a commit e0f6d8d
35 files changed
Lines changed: 3137 additions & 179 deletions
File tree
- docs
- internal
- ai
- mcp
- web/src/components/diagnose
- investigationEvidence
- adapters
- bodies
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
879 | | - | |
| 879 | + | |
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
887 | | - | |
| 887 | + | |
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
333 | 337 | | |
334 | 338 | | |
335 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
336 | 355 | | |
337 | 356 | | |
338 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 15 | + | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
| |||
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
44 | | - | |
45 | 40 | | |
46 | | - | |
47 | 41 | | |
48 | 42 | | |
49 | 43 | | |
50 | | - | |
51 | 44 | | |
52 | 45 | | |
53 | 46 | | |
| |||
187 | 180 | | |
188 | 181 | | |
189 | 182 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
216 | 191 | | |
217 | 192 | | |
218 | 193 | | |
219 | 194 | | |
220 | | - | |
221 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
222 | 202 | | |
223 | 203 | | |
224 | | - | |
| 204 | + | |
225 | 205 | | |
226 | 206 | | |
227 | 207 | | |
| |||
434 | 414 | | |
435 | 415 | | |
436 | 416 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
511 | 428 | | |
512 | 429 | | |
513 | 430 | | |
| |||
550 | 467 | | |
551 | 468 | | |
552 | 469 | | |
| 470 | + | |
553 | 471 | | |
554 | 472 | | |
555 | 473 | | |
| |||
0 commit comments