@skyhook-io/radar-app 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/package.json +4 -4
  2. package/src/App.tsx +23 -9
  3. package/src/api/client.deleteResource.test.tsx +111 -0
  4. package/src/api/client.resourceAudit.test.tsx +57 -0
  5. package/src/api/client.resourcePath.test.ts +107 -0
  6. package/src/api/client.ts +136 -37
  7. package/src/api/diagnose.test.ts +33 -2
  8. package/src/api/diagnose.ts +93 -3
  9. package/src/api/radarFeatures.ts +1 -0
  10. package/src/components/capacity/CapacityDemand.tsx +6 -3
  11. package/src/components/capacity/CapacityOverview.tsx +14 -7
  12. package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
  13. package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
  14. package/src/components/capacity/shared.tsx +9 -5
  15. package/src/components/cnpg/CNPGOverview.tsx +4 -1
  16. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
  17. package/src/components/diagnose/AIMarkdown.tsx +1 -1
  18. package/src/components/diagnose/ActivityTurn.tsx +34 -14
  19. package/src/components/diagnose/AgentControls.tsx +53 -6
  20. package/src/components/diagnose/AgentSetupNotice.tsx +1 -1
  21. package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
  22. package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
  23. package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
  24. package/src/components/diagnose/AnalysisStory.tsx +17 -4
  25. package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
  26. package/src/components/diagnose/ApplyDialog.tsx +8 -1
  27. package/src/components/diagnose/AssessmentCard.tsx +99 -8
  28. package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
  29. package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
  30. package/src/components/diagnose/DiagnoseContext.tsx +205 -9
  31. package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
  32. package/src/components/diagnose/DiagnoseSurface.tsx +98 -21
  33. package/src/components/diagnose/EvidenceCard.tsx +67 -14
  34. package/src/components/diagnose/Home.test.tsx +182 -5
  35. package/src/components/diagnose/Home.tsx +168 -36
  36. package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
  37. package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
  38. package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
  39. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +119 -2
  40. package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
  41. package/src/components/diagnose/InvestigationEvidenceSections.tsx +11 -6
  42. package/src/components/diagnose/InvestigationView.tsx +203 -42
  43. package/src/components/diagnose/LocalDiagnoseAction.tsx +23 -16
  44. package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
  45. package/src/components/diagnose/QuestionComposer.tsx +487 -0
  46. package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
  47. package/src/components/diagnose/QuestionFocus.tsx +123 -0
  48. package/src/components/diagnose/ResourcePicker.tsx +206 -0
  49. package/src/components/diagnose/StoryExcerpt.tsx +12 -3
  50. package/src/components/diagnose/assessmentCopy.ts +16 -0
  51. package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
  52. package/src/components/diagnose/investigationCase.ts +33 -1
  53. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
  54. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
  55. package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
  56. package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
  57. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
  58. package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
  59. package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +42 -1
  60. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +29 -2
  61. package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
  62. package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
  63. package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
  64. package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
  65. package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
  66. package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
  67. package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
  68. package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
  69. package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
  70. package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
  71. package/src/components/diagnose/investigationEvidence/index.ts +1 -1
  72. package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
  73. package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
  74. package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
  75. package/src/components/diagnose/investigationEvidence/types.ts +2 -0
  76. package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
  77. package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
  78. package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
  79. package/src/components/diagnose/investigationFocus.test.ts +271 -0
  80. package/src/components/diagnose/investigationFocus.ts +132 -0
  81. package/src/components/diagnose/parts.test.tsx +20 -0
  82. package/src/components/diagnose/questionSuggestions.test.ts +111 -0
  83. package/src/components/diagnose/questionSuggestions.ts +150 -0
  84. package/src/components/diagnose/storyParts.test.tsx +66 -0
  85. package/src/components/diagnose/target.test.ts +143 -2
  86. package/src/components/diagnose/target.ts +109 -7
  87. package/src/components/diagnose/testdata/story-runs.json +474 -0
  88. package/src/components/diagnose/verdictText.test.tsx +87 -0
  89. package/src/components/diagnose/verdictText.ts +68 -0
  90. package/src/components/helm/ChartBrowser.tsx +4 -4
  91. package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
  92. package/src/components/helm/HelmView.tsx +34 -23
  93. package/src/components/helm/InstallWizard.tsx +6 -2
  94. package/src/components/helm/ValuesViewer.test.tsx +1 -0
  95. package/src/components/helm/ValuesViewer.tsx +4 -2
  96. package/src/components/home/ClusterHealthCard.tsx +40 -59
  97. package/src/components/home/HomeAgentBlock.test.tsx +113 -0
  98. package/src/components/home/HomeAgentBlock.tsx +94 -0
  99. package/src/components/home/HomeView.tsx +5 -6
  100. package/src/components/home/MCPSetupDialog.test.tsx +27 -2
  101. package/src/components/home/MCPSetupDialog.tsx +14 -2
  102. package/src/components/home/RadarVersionLine.test.tsx +0 -14
  103. package/src/components/home/RadarVersionLine.tsx +3 -28
  104. package/src/components/home/mcpToolCatalog.ts +29 -2
  105. package/src/components/issues/IssuesPane.render.test.tsx +5 -5
  106. package/src/components/nav/PrimaryNavRail.tsx +34 -2
  107. package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
  108. package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
  109. package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
  110. package/src/components/product-hunt/launchWindow.ts +78 -0
  111. package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
  112. package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
  113. package/src/components/resources/CompositeRenderer.tsx +4 -0
  114. package/src/components/resources/ResourcesView.tsx +1 -1
  115. package/src/components/settings/LocalConnectionSettings.tsx +1 -0
  116. package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
  117. package/src/components/ui/Omnibar.tsx +47 -3
  118. package/src/components/ui/RadarOmnibar.test.tsx +19 -0
  119. package/src/components/ui/RadarOmnibar.tsx +12 -0
  120. package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
  121. package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
  122. package/src/components/ui/UpdateNotification.test.tsx +2 -0
  123. package/src/components/ui/UpdateNotification.tsx +32 -5
  124. package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
  125. package/src/components/whats-new/WhatsNewDialog.test.tsx +3 -3
  126. package/src/components/whats-new/releaseNotes.ts +60 -1
  127. package/src/components/workload/WorkloadView.tsx +10 -4
  128. package/src/components/workspace/layout.tsx +2 -1
  129. package/src/contexts/CapabilitiesContext.tsx +1 -0
  130. package/src/hooks/useAgentSignin.test.tsx +190 -0
  131. package/src/hooks/useAgentSignin.ts +160 -0
  132. package/src/hooks/useApproveAfterSignin.test.tsx +108 -0
  133. package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
  134. package/src/hooks/useGitOpsWriteGuard.ts +25 -3
  135. package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
  136. package/src/index.css +85 -0
@@ -121,10 +121,12 @@ export function EmptyCollection({
121
121
  collecting,
122
122
  hasEarlierEvidence,
123
123
  onViewActivity,
124
+ withoutTarget = false,
124
125
  }: {
125
126
  collecting: boolean;
126
127
  hasEarlierEvidence: boolean;
127
128
  onViewActivity: () => void;
129
+ withoutTarget?: boolean;
128
130
  }) {
129
131
  return (
130
132
  <div className="rounded-lg border border-dashed border-theme-border px-4 py-5 text-center">
@@ -148,7 +150,9 @@ export function EmptyCollection({
148
150
  ? "The Activity pane remains the live record while the agent investigates."
149
151
  : hasEarlierEvidence
150
152
  ? "Earlier observations remain below. This does not prove that those conditions resolved."
151
- : "Investigation details are still available in Activity. This does not mean the resource is healthy."}
153
+ : withoutTarget
154
+ ? "Investigation details are still available in Activity. This does not mean nothing is wrong."
155
+ : "Investigation details are still available in Activity. This does not mean the resource is healthy."}
152
156
  </p>
153
157
  <button
154
158
  type="button"
@@ -271,8 +275,9 @@ export function CoverageStrip({
271
275
  onOpenChange: (open: boolean) => void;
272
276
  }) {
273
277
  const hasError = groups.some((group) => group.hasError);
274
- const historyOnly = groups.every((group) => group.historyOnly);
275
- const quiet = historyOnly;
278
+ // Sampling caps and history bounds read as routine, as in the assessment
279
+ // headline; any other gap keeps the alert treatment.
280
+ const quiet = groups.every((group) => group.routineOnly);
276
281
  const { elementRef, revealAfterToggle } =
277
282
  useDisclosureReveal<HTMLDivElement>();
278
283
  const regionId = "investigation-evidence-coverage";
@@ -314,11 +319,11 @@ export function CoverageStrip({
314
319
  : "font-semibold text-theme-text-primary",
315
320
  )}
316
321
  >
317
- {historyOnly
318
- ? "Change history is limited"
322
+ {quiet
323
+ ? `Radar's coverage · ${groups.length} routine ${groups.length === 1 ? "limit" : "limits"}`
319
324
  : "Evidence coverage is incomplete"}
320
325
  </span>
321
- {!historyOnly && !open && summary ? (
326
+ {!open && summary ? (
322
327
  <span className="line-clamp-2 text-xs text-theme-text-tertiary [overflow-wrap:anywhere]">
323
328
  {summary}
324
329
  </span>
@@ -60,7 +60,10 @@ import {
60
60
  } from "react";
61
61
  import { useQueryClient } from "@tanstack/react-query";
62
62
  import { useNavigate } from "react-router-dom";
63
- import { Badge, gitOpsRouteForOwner, type GitOpsWrite } from "@skyhook-io/k8s-ui";
63
+ import { Badge, gitOpsRouteForOwner, type GitOpsOwnerRef, type GitOpsWrite } from "@skyhook-io/k8s-ui";
64
+ import { useResource } from "../../api/client";
65
+ import { getApiBase } from "../../api/config";
66
+ import { kindToPluralWithGroup } from "../../utils/navigation";
64
67
  import { useGitOpsWriteGuard } from "../../hooks/useGitOpsWriteGuard";
65
68
  import {
66
69
  Send,
@@ -110,11 +113,20 @@ import {
110
113
  } from "./InvestigationEvidencePane";
111
114
  import { partitionInvestigationEvidence } from "./investigationEvidencePartition";
112
115
  import type { DiagnosisResourceRef } from "./diagnoseEvidenceTypes";
113
- import { formatInvestigationTarget } from "./target";
116
+ import { QuestionFocus } from "./QuestionFocus";
117
+ import { focusFromCase } from "./investigationFocus";
118
+ import {
119
+ formatInvestigationTarget,
120
+ formatInvestigationTitle,
121
+ isQuestionOnly,
122
+ questionAskedAt,
123
+ rerunOpening,
124
+ } from "./target";
114
125
  import { parseContextName } from "../../utils/context-name";
115
126
  import type { InvestigationSourceExcerpt } from "./investigationSourceFocus";
116
127
  import { diagnosisHasStoryShape } from "./investigationStory";
117
- import { groupEvidenceCoverage } from "./investigationEvidencePresentation";
128
+ import { assessmentStateLabel, verdictSentence } from "./verdictText";
129
+ import { assessmentLimitLines } from "./investigationEvidencePresentation";
118
130
 
119
131
  const RECHECK_QUESTION =
120
132
  "Did the fix resolve the issue? Re-check the resource's current status and health now, and say whether it's healthy.";
@@ -269,12 +281,54 @@ function captureEvidenceCardLayout(container: HTMLElement) {
269
281
 
270
282
  const APPLY_WRITES: GitOpsWrite[] = [{ scope: "spec", description: "The proposed change" }];
271
283
 
284
+ // The card that ends a finished turn in Activity says what was found, so the
285
+ // reader learns the answer before deciding to open Findings. It carries the
286
+ // same qualifications Findings puts beside the sentence (how sure, whether an
287
+ // apply or newer reads have overtaken it), so it never reads more settled
288
+ // than Findings does. A long verdict is cut at three lines; one with no
289
+ // sentence keeps the generic description.
290
+ function CompletionSummary({
291
+ label,
292
+ state,
293
+ sentence,
294
+ }: {
295
+ label: string;
296
+ state?: { text: string; warn: boolean };
297
+ sentence: string;
298
+ }) {
299
+ return (
300
+ <span className="min-w-0 flex-1">
301
+ <span className="block text-xs text-theme-text-tertiary">
302
+ {label}
303
+ {state ? (
304
+ <>
305
+ {" · "}
306
+ <span className={state.warn ? "text-warning-text" : undefined}>
307
+ {state.text}
308
+ </span>
309
+ </>
310
+ ) : null}
311
+ </span>
312
+ {sentence ? (
313
+ <span className="mt-0.5 line-clamp-3 text-sm font-medium leading-snug text-theme-text-primary [overflow-wrap:anywhere]">
314
+ {sentence}
315
+ </span>
316
+ ) : (
317
+ <span className="block text-xs text-theme-text-secondary">
318
+ Assessment, evidence and next steps
319
+ </span>
320
+ )}
321
+ </span>
322
+ );
323
+ }
324
+
272
325
  export function InvestigationView({
273
326
  run,
274
327
  agentLabel,
275
328
  maximized,
276
329
  onOpenResource,
277
330
  onOpenTimeline,
331
+ onRevealDestination,
278
332
  }: {
279
333
  run: RunSummary;
280
334
  agentLabel: string;
@@ -283,11 +337,14 @@ export function InvestigationView({
283
337
  onOpenResource?: (ref: DiagnosisResourceRef) => void;
284
338
  /** Opens Radar's Timeline filtered to the resource a changes card is about. */
285
339
  onOpenTimeline?: (scope: InvestigationTimelineScope) => void;
340
+ /** Makes a page this view navigates to visible: restores or closes the panel. */
341
+ onRevealDestination?: () => void;
286
342
  }) {
287
343
  const { kind, namespace, name } = run;
288
344
  const {
289
345
  refreshRuns,
290
346
  openInvestigation,
347
+ openQuestion,
291
348
  startError,
292
349
  startRefusal,
293
350
  dismissError,
@@ -297,25 +354,15 @@ export function InvestigationView({
297
354
  // the picker's: a reopened run keeps the backend it was made with.
298
355
  const runAgent = agents.find((agent) => agent.name === run.agent);
299
356
  const explanationEnabled = supportsAssessmentExplanation(runAgent);
300
- const canApply = runAgent?.apply === true;
357
+ // A question-only run has no resource to bind a confirmed fix to.
358
+ const canApply = runAgent?.apply === true && !isQuestionOnly(run);
301
359
  // Read through a ref by the stream callback, which lives as long as the
302
360
  // run and would otherwise keep the value from before the agents loaded.
303
361
  const verifiesAfterApplyRef = useRef(false);
304
362
  verifiesAfterApplyRef.current = runAgent?.verification === true;
305
- // Investigate again means look again, so it asks for a new session explicitly and only
306
- // carries the issue forward — being handed the previous answer is the one
307
- // thing someone clicking this doesn't want.
308
363
  const retryDiagnosis = useCallback(
309
- () =>
310
- openInvestigation({
311
- kind,
312
- group: run.group,
313
- namespace,
314
- name,
315
- issueId: run.issueId,
316
- fresh: true,
317
- }),
318
- [openInvestigation, kind, namespace, name, run.group, run.issueId],
364
+ () => openInvestigation(rerunOpening(run)),
365
+ [openInvestigation, run],
319
366
  );
320
367
  const queryClient = useQueryClient();
321
368
  const [turns, setTurns] = useState<Turn[]>([]);
@@ -963,12 +1010,29 @@ export function InvestigationView({
963
1010
  declaredManager: run.managedBy,
964
1011
  enabled: confirmApply,
965
1012
  });
1013
+ const applyTarget = useResource<unknown>(
1014
+ confirmApply ? kindToPluralWithGroup(kind, run.group) : "",
1015
+ namespace,
1016
+ name,
1017
+ run.group || undefined,
1018
+ { enabled: confirmApply, cacheScope: getApiBase() },
1019
+ );
966
1020
  const navigateRouter = useNavigate();
967
1021
  const {
968
1022
  owner: applyOwner,
969
1023
  ownerVerified: applyOwnerVerified,
970
1024
  helmOwner: applyHelmOwner,
971
1025
  } = applyOwnership;
1026
+ // A page opened from the Apply dialog replaces it, and the panel makes
1027
+ // room so the page isn't left underneath.
1028
+ const openFromApply = useCallback(
1029
+ (path: string) => {
1030
+ setConfirmApply(false);
1031
+ onRevealDestination?.();
1032
+ navigateRouter(path);
1033
+ },
1034
+ [navigateRouter, onRevealDestination],
1035
+ );
972
1036
  const openApplyOwner = useMemo(() => {
973
1037
  // A host without resource navigation (Radar Hub's fleet Diagnose panel)
974
1038
  // has no route for the owner either.
@@ -976,16 +1040,20 @@ export function InvestigationView({
976
1040
  const owner = applyOwner;
977
1041
  const helmOwner = applyHelmOwner;
978
1042
  if (owner && applyOwnerVerified) {
979
- return () => navigateRouter(gitOpsRouteForOwner(owner));
1043
+ return () => openFromApply(gitOpsRouteForOwner(owner));
980
1044
  }
981
1045
  if (helmOwner) {
982
1046
  return () =>
983
- navigateRouter(
1047
+ openFromApply(
984
1048
  `/helm?release=${encodeURIComponent(`${helmOwner.namespace}/${helmOwner.name}`)}`,
985
1049
  );
986
1050
  }
987
1051
  return undefined;
988
- }, [applyOwner, applyOwnerVerified, applyHelmOwner, navigateRouter, onOpenResource]);
1052
+ }, [applyOwner, applyOwnerVerified, applyHelmOwner, openFromApply, onOpenResource]);
1053
+ const openApplyManager = useMemo(
1054
+ () => (onOpenResource ? (owner: GitOpsOwnerRef) => openFromApply(gitOpsRouteForOwner(owner)) : undefined),
1055
+ [openFromApply, onOpenResource],
1056
+ );
989
1057
  const [pendingFix, setPendingFix] = useState("");
990
1058
  const requestApply = (fix: string) => {
991
1059
  if (interactionsBlocked) return;
@@ -1154,11 +1222,24 @@ export function InvestigationView({
1154
1222
  : undefined,
1155
1223
  [currentAssessment, currentAssessmentIdx, projection],
1156
1224
  );
1225
+ const questionOnly = isQuestionOnly(run);
1226
+ const questionFocus = useMemo(
1227
+ () => (questionOnly ? focusFromCase(investigationCase) : []),
1228
+ [questionOnly, investigationCase],
1229
+ );
1157
1230
  // Findings is the newest assessment and nothing else: its own citations,
1158
1231
  // its own case, its own story. Earlier assessments stay complete in
1159
1232
  // Activity; answers that did not revise the assessment stay there too.
1160
1233
  const paneResolution = rootCauseEvidenceResolution;
1161
1234
  const storyShape = diagnosisHasStoryShape(currentAssessment?.diagnosis);
1235
+ // A run that stopped without an assessment will never cite anything, so
1236
+ // what it collected is all there is to show.
1237
+ const assessmentPending = !currentAssessment?.diagnosis;
1238
+ const showUncited =
1239
+ assessmentPending &&
1240
+ !busy &&
1241
+ run.status !== "running" &&
1242
+ run.status !== "stopping";
1162
1243
  const visibleEvidenceGroupIds = useMemo(
1163
1244
  () =>
1164
1245
  new Set(
@@ -1167,9 +1248,16 @@ export function InvestigationView({
1167
1248
  paneResolution,
1168
1249
  investigationCase,
1169
1250
  storyShape,
1251
+ showUncited,
1170
1252
  ).collectionByGroup.keys(),
1171
1253
  ),
1172
- [projection.groups, paneResolution, investigationCase, storyShape],
1254
+ [
1255
+ projection.groups,
1256
+ paneResolution,
1257
+ investigationCase,
1258
+ storyShape,
1259
+ showUncited,
1260
+ ],
1173
1261
  );
1174
1262
  const evidenceStepIdsByTurn = useMemo(
1175
1263
  () =>
@@ -1502,12 +1590,10 @@ export function InvestigationView({
1502
1590
  currentAssessment?.diagnosis?.omittedEntries)
1503
1591
  ? assessmentSourcesNode
1504
1592
  : undefined;
1505
- const assessmentLimits = useMemo(() => {
1506
- const lines = groupEvidenceCoverage(currentAssessmentProjection.limitations)
1507
- // A capped preview or a history bound is bookkeeping for the record; Still
1508
- // open keeps the reads Radar could not complete.
1509
- .filter((group) => !group.historyOnly && !group.bookkeepingOnly)
1510
- .map((group) => `${group.label}: ${group.summary}`);
1593
+ const { assessmentLimits, assessmentRoutineLimits } = useMemo(() => {
1594
+ const { open: lines, routine } = assessmentLimitLines(
1595
+ currentAssessmentProjection.limitations,
1596
+ );
1511
1597
  // Two coverage gaps carry no limitation of their own; name the one that
1512
1598
  // applies.
1513
1599
  const gaps = investigationEvidenceCoverageGaps(
@@ -1520,7 +1606,7 @@ export function InvestigationView({
1520
1606
  lines.push(
1521
1607
  "Radar's full diagnose of this workload was not collected, so this check is partial",
1522
1608
  );
1523
- return lines;
1609
+ return { assessmentLimits: lines, assessmentRoutineLimits: routine };
1524
1610
  }, [currentAssessmentProjection, kind]);
1525
1611
  const healthSignals = useMemo(
1526
1612
  () =>
@@ -1591,7 +1677,8 @@ export function InvestigationView({
1591
1677
  .slice(0, 3);
1592
1678
  return {
1593
1679
  context: {
1594
- target: formatInvestigationTarget(run),
1680
+ target: formatInvestigationTitle(run),
1681
+ asked: isQuestionOnly(run) ? undefined : run.question,
1595
1682
  cluster: run.context,
1596
1683
  startedAt: run.createdAt,
1597
1684
  agent: agentLabel,
@@ -1836,7 +1923,9 @@ export function InvestigationView({
1836
1923
  ? assessmentNeedsCurrentStateVerification
1837
1924
  ? "Proposed before the apply attempt. Current state has not been verified."
1838
1925
  : "Proposed before the latest evidence. Reassess before applying."
1839
- : undefined
1926
+ : questionOnly
1927
+ ? "To apply a fix, investigate the resource it changes from Focused on above."
1928
+ : undefined
1840
1929
  }
1841
1930
  onApply={
1842
1931
  canOfferInvestigationApply({
@@ -2092,6 +2181,11 @@ export function InvestigationView({
2092
2181
  turn={turn}
2093
2182
  agentLabel={agentLabel}
2094
2183
  turnIndex={index}
2184
+ openingQuestion={
2185
+ index === 0 && !turn.question
2186
+ ? run.question
2187
+ : undefined
2188
+ }
2095
2189
  evidenceStepIds={evidenceStepIdsByTurn.get(index)}
2096
2190
  onViewEvidence={viewEvidenceSource}
2097
2191
  sourceRevealRequest={activityRevealRequest}
@@ -2202,16 +2296,35 @@ export function InvestigationView({
2202
2296
  <Files className="h-4 w-4" />
2203
2297
  )}
2204
2298
  </span>
2205
- <span className="min-w-0 flex-1">
2206
- <span className="block text-xs font-semibold text-theme-text-primary">
2207
- {turn.verify
2208
- ? "Verification complete"
2209
- : "Assessment ready"}
2210
- </span>
2211
- <span className="block text-[11px] text-theme-text-tertiary">
2212
- Assessment, evidence and next steps
2213
- </span>
2214
- </span>
2299
+ <CompletionSummary
2300
+ label={
2301
+ assessmentNeedsCurrentStateVerification
2302
+ ? "Assessment before apply"
2303
+ : hasEvidenceCollectedAfterAssessment
2304
+ ? "Earlier assessment"
2305
+ : turn.verify
2306
+ ? "Verification complete"
2307
+ : "Assessment ready"
2308
+ }
2309
+ state={
2310
+ assessmentNeedsCurrentStateVerification
2311
+ ? {
2312
+ text: "Current state unverified",
2313
+ warn: true,
2314
+ }
2315
+ : turn.diagnosis
2316
+ ? assessmentStateLabel(
2317
+ turn.diagnosis,
2318
+ currentAssessmentEvidenceConflict,
2319
+ )
2320
+ : undefined
2321
+ }
2322
+ sentence={
2323
+ turn.diagnosis
2324
+ ? verdictSentence(turn.diagnosis)
2325
+ : ""
2326
+ }
2327
+ />
2215
2328
  <span className="inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-text">
2216
2329
  View Findings
2217
2330
  <ArrowRight className="h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5" />
@@ -2354,9 +2467,11 @@ export function InvestigationView({
2354
2467
  className="investigation-assessment rounded-xl border p-3"
2355
2468
  >
2356
2469
  <div className="flex flex-wrap items-center gap-1.5">
2470
+ {/* A label for the block, not its headline: the
2471
+ verdict sentence below is what a reader looks for. */}
2357
2472
  <h2
2358
2473
  id={`${viewId}-assessment-heading`}
2359
- className="text-lg font-semibold text-theme-text-primary"
2474
+ className="text-sm font-medium text-theme-text-secondary"
2360
2475
  >
2361
2476
  {assessmentNeedsCurrentStateVerification
2362
2477
  ? "Assessment before apply"
@@ -2412,6 +2527,9 @@ export function InvestigationView({
2412
2527
  assessmentLimits={
2413
2528
  storyShape ? assessmentLimits : undefined
2414
2529
  }
2530
+ assessmentRoutineLimits={
2531
+ storyShape ? assessmentRoutineLimits : undefined
2532
+ }
2415
2533
  assessmentCopy={assessmentCopy}
2416
2534
  healthSignals={storyShape ? healthSignals : undefined}
2417
2535
  onRevealSource={viewEvidenceSource}
@@ -2508,6 +2626,40 @@ export function InvestigationView({
2508
2626
  ) : null}
2509
2627
  </section>
2510
2628
 
2629
+ {questionOnly && investigationCase ? (
2630
+ <QuestionFocus
2631
+ focus={questionFocus}
2632
+ stale={stale}
2633
+ onOpenResource={onOpenResource}
2634
+ // These start a new investigation, so a run that can
2635
+ // no longer take follow-ups doesn't block them.
2636
+ disabled={investigationInteractionsBlocked({
2637
+ streamReady,
2638
+ busy,
2639
+ requestPending,
2640
+ readOnly: false,
2641
+ verificationPending,
2642
+ })}
2643
+ onChooseResource={() =>
2644
+ openQuestion({
2645
+ text: run.question,
2646
+ namespaces: run.namespaces,
2647
+ lookBack: run.lookBack,
2648
+ askedAt: questionAskedAt(run),
2649
+ pickResource: true,
2650
+ })
2651
+ }
2652
+ onInvestigate={(resource) =>
2653
+ openInvestigation({
2654
+ ...resource,
2655
+ question: run.question,
2656
+ lookBack: run.lookBack,
2657
+ askedAt: questionAskedAt(run),
2658
+ })
2659
+ }
2660
+ />
2661
+ ) : null}
2662
+
2511
2663
  {hasMultipleAssessments ? (
2512
2664
  <button
2513
2665
  type="button"
@@ -2528,6 +2680,9 @@ export function InvestigationView({
2528
2680
 
2529
2681
  <InvestigationEvidencePane
2530
2682
  projection={projection}
2683
+ withoutTarget={questionOnly}
2684
+ assessmentPending={assessmentPending}
2685
+ showUncited={showUncited}
2531
2686
  rootCauseEvidence={paneResolution}
2532
2687
  investigationCase={investigationCase}
2533
2688
  story={
@@ -2540,7 +2695,11 @@ export function InvestigationView({
2540
2695
  : undefined
2541
2696
  }
2542
2697
  storyShell={storyShell}
2543
- summarizedLimits={storyShape ? assessmentLimits : undefined}
2698
+ summarizedLimits={
2699
+ storyShape
2700
+ ? [...assessmentLimits, ...assessmentRoutineLimits]
2701
+ : undefined
2702
+ }
2544
2703
  collecting={
2545
2704
  explanationRequest?.status !== "running" &&
2546
2705
  (requestPending ||
@@ -2583,8 +2742,10 @@ export function InvestigationView({
2583
2742
  ]?.precondition
2584
2743
  : undefined
2585
2744
  }
2745
+ resourceData={applyTarget.data}
2586
2746
  gitOpsGuard={applyGitOpsGuard}
2587
2747
  onOpenGitOpsOwner={openApplyOwner}
2748
+ onOpenGitOpsManager={openApplyManager}
2588
2749
  confidence={turns[lastRemediationIdx]?.diagnosis?.confidence}
2589
2750
  />
2590
2751
  </div>
@@ -4,7 +4,7 @@ import {
4
4
  useDiagnose,
5
5
  useDiagnoseLayout,
6
6
  } from "./DiagnoseContext";
7
- import { runTargetKey } from "./target";
7
+ import { canonicalKind, runTargetKey } from "./target";
8
8
  import { Tooltip } from "../ui/Tooltip";
9
9
  import type { RenderDiagnoseAction } from "../../context/DiagnoseCustomization";
10
10
 
@@ -34,15 +34,17 @@ function DiagnoseResourceButton({
34
34
  health?: "problem" | "healthy" | "unknown";
35
35
  }) {
36
36
  const d = useDiagnose();
37
- const { runningKeys } = useDiagnoseLayout();
37
+ const { runningRunIds } = useDiagnoseLayout();
38
38
  // Hidden only when the feature can't work here (auth/cloud/--no-mcp). When it's
39
39
  // supported but no agent is installed we KEEP the button — clicking opens the
40
40
  // setup notice so the feature is discoverable rather than silently absent.
41
41
  if (d.setupState === "off" || d.setupState === "unknown") return null;
42
42
  const ready = d.available;
43
43
  const problem = health === "problem";
44
- const running =
45
- ready && runningKeys.has(runTargetKey(kind, namespace, name, group ?? ""));
44
+ const runningRunId = ready
45
+ ? runningRunIds.get(runTargetKey(kind, namespace, name, group ?? ""))
46
+ : undefined;
47
+ const running = !!runningRunId;
46
48
  const tooltip = !ready
47
49
  ? notReadyTooltip(d)
48
50
  : running
@@ -53,23 +55,28 @@ function DiagnoseResourceButton({
53
55
  : `Ask ${d.agentLabel} about this resource — reads its spec, events & logs.`
54
56
  : problem
55
57
  ? `Investigate with your own ${d.agentLabel} — runs locally and reads this resource's spec, events & logs.`
56
- : `Ask your own ${d.agentLabel} about this resource — runs locally, reads its spec, events & logs.`;
58
+ : d.questions
59
+ ? `Ask your own ${d.agentLabel} a question about this resource — runs locally, reads its spec, events & logs.`
60
+ : `Ask your own ${d.agentLabel} about this resource — runs locally, reads its spec, events & logs.`;
57
61
  // While an investigation is live, the button advertises it (and clicking focuses
58
62
  // the existing run rather than starting a new one — openInvestigation dedups).
59
63
  const showLabel = problem || running;
64
+ const asks = d.questions && !problem && !running;
60
65
  return (
61
66
  <Tooltip content={tooltip} position="bottom">
62
67
  <button
63
- onClick={() =>
64
- ready
65
- ? d.openInvestigation({
66
- kind,
67
- group: group ?? "",
68
- namespace,
69
- name,
70
- })
71
- : d.openHome()
72
- }
68
+ onClick={() => {
69
+ const target = { kind, group: group ?? "", namespace, name };
70
+ if (!ready) d.openHome();
71
+ else if (runningRunId) d.openRun(runningRunId);
72
+ // Asking about a resource with no live problem means saying what
73
+ // to ask; a problem, or a run already live, opens straight away.
74
+ else if (asks)
75
+ d.openQuestion({
76
+ pin: { ...target, kind: canonicalKind(kind, group ?? "") },
77
+ });
78
+ else d.openInvestigation(target);
79
+ }}
73
80
  aria-label={
74
81
  !ready
75
82
  ? notReadyTooltip(d)
@@ -163,7 +170,7 @@ export function IssueDiagnoseButton({
163
170
 
164
171
  // The tooltip every AI entry point shows while investigations aren't runnable.
165
172
  // It gives the same reason as the setup notice the button opens.
166
- function notReadyTooltip(d: {
173
+ export function notReadyTooltip(d: {
167
174
  cliOverride: boolean;
168
175
  setupState: DiagnoseSetup;
169
176
  }): string {