Skip to content

feat(scouts): cross-fleet scout findings page#2976

Closed
andrewm4894 wants to merge 3 commits into
mainfrom
scouts-findings-page
Closed

feat(scouts): cross-fleet scout findings page#2976
andrewm4894 wants to merge 3 commits into
mainfrom
scouts-findings-page

Conversation

@andrewm4894

@andrewm4894 andrewm4894 commented Jun 29, 2026

Copy link
Copy Markdown
Member

this is bringing code app scouts pages in line with the could inbox scouts pages where you have a place to see all recent scout signals

Problem

The Code app's scouts feature surfaces findings (emissions) only inline on a single scout's detail page and inside individual inbox reports. There's no way to see every finding the whole troop emitted recently in one place — which PostHog Cloud's inbox already offers via its FindingsPanel at /inbox/scouts/findings. This adds the equivalent cross-fleet findings surface to the Code app.

Changes

image

Adds a cross-fleet Scout findings page at /code/agents/scouts/findings, mirroring Cloud's FindingsPanel but built in the Code app's idioms (React Query hooks + TanStack file routes + Radix/Tailwind + pure @posthog/core helpers — not Kea).

  • packages/core/src/scouts/scoutFindings.ts — host-agnostic aggregation logic (the pure counterpart of Cloud's findingsLogic selectors): narrow the runs window to recent emitted runs, join each emission to its run + linked inbox report, derive the scout filter list, and search/filter/sort the flat row list. Fully unit-tested.
  • useScoutFindings.ts — fans out one emissions + one report-link query per emitted run via useQueries and flattens through the core helper. (The per-scout ScoutSignalsSection renders a child component per run, which can't produce one sortable list.) Distinguishes partial vs. total fetch failure so the page can warn when the list is incomplete.
  • ScoutFindingsView.tsx — the page: header, search box, scout/severity/sort selectors, and a list of ScoutEmissionCards with discuss/share/task-run actions and the linked-report chip.
  • FleetFindingsCallout.tsx — entry-point stat card on the fleet section (beside the existing scratchpad callout), reading the cheap emitted_count sum; renders nothing until the troop has emitted something.
  • ScoutEmissionCard.tsx — new optional showScout prop so cross-fleet cards title with the emitting scout instead of the generic "Finding".
  • Route registered and routeTree.gen.ts regenerated.

Read-only surface; acting on a finding still happens in its inbox report. No backend, host, or DI changes.

How did you test this?

  • pnpm --filter @posthog/core typecheck and pnpm --filter @posthog/ui typecheck — clean
  • pnpm --filter @posthog/core test scoutFindings — 19 unit tests pass (aggregation, filtering, sorting, edge cases)
  • biome check clean on all touched files; noRestrictedImports clean on core
  • Pre-commit hook re-ran Biome + full pnpm typecheck — passed
  • Not yet exercised in the running app (handed to the author to dogfood locally)

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@andrewm4894 andrewm4894 self-assigned this Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

React Doctor found 1 issue in 1 file · 1 warning.

1 warning

src/features/scouts/components/ScoutFindingsView.tsx

Reviewed by React Doctor for commit 2f5595c.

@andrewm4894 andrewm4894 requested a review from a team June 29, 2026 10:40
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(scouts): cross-fleet scout findings..." | Re-trigger Greptile

Comment thread packages/core/src/scouts/scoutFindings.ts
Comment thread packages/core/src/scouts/scoutFindings.ts Outdated
Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts
Comment thread packages/core/src/scouts/scoutFindings.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e46045d816

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts
Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts Outdated
Comment thread packages/ui/src/features/scouts/components/ScoutFindingsView.tsx
Comment thread packages/ui/src/features/scouts/components/ScoutFindingsView.tsx
Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts
- drop redundant .slice() before .sort() in scoutFindings helpers
- surface incomplete/truncated windows (failed + emitted-but-empty runs, capped/early-stopped run set) instead of implying completeness
- make emissions query key emitted_count-sensitive so in-progress runs refetch
- parameterise sort/filter tests with it.each
@andrewm4894

Copy link
Copy Markdown
Member Author

Re the React Doctor jsx-no-jsx-as-prop warning on ScoutFindingsView.tsx:328 (footerEnd={<ScoutTaskRunLink … />}): intentional and unchanged. ScoutEmissionCard exposes actions and footerEnd as ReactNode render slots, and the existing ScoutSignalsSection passes JSX to them the same way — this keeps the findings page consistent with that card's API. Inlining the link or restructuring to avoid the prop would only diverge from the established usage.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7369ba7cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ui/src/features/scouts/components/FleetFindingsCallout.tsx Outdated
Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts Outdated
Comment thread packages/ui/src/features/scouts/hooks/useScoutFindings.ts Outdated
Comment thread packages/core/src/scouts/scoutFindings.ts
- callout sums uncapped emitted runs (cap is only for the page fan-out)
- incompleteRuns flags partial responses (loaded < emitted_count), not just empty
- report-link query key includes emitted_count so chips refresh when a run emits more

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f5595c88b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<Box className="rounded-(--radius-2) border border-(--gray-6) border-dashed bg-gray-1 px-4 py-8 text-center text-[12.5px] text-gray-11">
{isFiltering
? "No findings match your search and filters."
: "Your scouts haven't emitted any findings yet. As they scan your project, what they surface shows up here."}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use incomplete-load copy when no promised rows arrive

When every emitted run returns an empty or partial emissions response, useScoutFindings now sets incompleteRuns > 0 but FindingsBody never receives that flag, so this empty branch still tells users the scouts haven't emitted anything. Fresh evidence after the prior fix is that the warning can render above this branch while rows.length === 0, leaving contradictory "couldn't be loaded" and "haven't emitted" states; pass the incomplete state into the body or render a missing-details empty state.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant