Skip to content

feat(alerting): add configurable PM results list for alerting agent + enable UX#1219

Open
aaight wants to merge 2 commits intodevfrom
feature/alerting-results-container-id
Open

feat(alerting): add configurable PM results list for alerting agent + enable UX#1219
aaight wants to merge 2 commits intodevfrom
feature/alerting-results-container-id

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 27, 2026

Summary

  • Add resultsContainerId field to SentryIntegrationConfig so users can configure where the alerting agent creates investigation work items
  • Wire resultsContainerId into buildPromptContext as a fallback backlogListId for alerting agent runs
  • Add PM container picker dropdown to the Alerting tab UI (with pm.discovery.discover containers capability)
  • Add info box in the Alerting tab reminding users to enable the alerting agent type in the Agents tab
  • Improve alerting prompt to add a comment fallback when no backlogListId is configured

Card: https://trello.com/c/69ef4314a22c9eeae8cfb486

Changes

Backend

  • src/sentry/integration.ts: Extended SentryIntegrationConfig with optional resultsContainerId?: string; updated getSentryIntegrationConfig to extract it from config JSONB
  • src/agents/shared/promptContext.ts: Added alertingResultsContainerId optional param; used as fallback backlogListId when no PM backlog is configured
  • src/backends/secretOrchestrator.ts: For alerting agent runs, look up Sentry config and pass resultsContainerId to buildPromptContext
  • src/agents/definitions/alerting.yaml: Improved step 4 wording; added comment fallback when backlogListId is unset but a triggering workItemId is available

Frontend

  • web/src/components/projects/integration-alerting-tab.tsx: Added pmProvider prop; new PMContainerPicker sub-component using pm.discovery.discover({capability: 'containers'}); added agent enablement info box; saves resultsContainerId in config
  • web/src/components/projects/integration-form.tsx: Pass pmProvider prop to AlertingTab

Tests

  • tests/unit/sentry/integration.test.ts: 3 new tests for resultsContainerId extraction (present, absent, non-string)
  • tests/unit/agents/shared/promptContext.test.ts: 4 new tests for alertingResultsContainerId fallback behaviour

Test plan

  • All 469 unit test files pass
  • TypeScript type check passes (zero errors)
  • Lint passes (zero errors/warnings)
  • resultsContainerId is extracted from config when present
  • buildPromptContext uses PM backlog first; Sentry container as fallback only
  • Alerting tab saves resultsContainerId alongside organizationSlug

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 58.82353% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/backends/secretOrchestrator.ts 36.36% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

Summary

The backend changes (config extraction, prompt context fallback, alerting prompt improvement) are clean and correct. However, the frontend PMContainerPicker component calls pm.discovery.discover with capability: 'containers', which no production PM provider declares — meaning the "Fetch Lists" button will always fail with a NOT_IMPLEMENTED error for every provider.

Architecture & Design

  • [SHOULD_FIX] Pattern mismatch with existing wizard container-pick: The shared container-pick wizard step (at web/src/components/projects/pm-providers/steps/container-pick.tsx) receives pre-fetched options as a prop — the caller is responsible for using the correct provider-specific capability (boards for Trello, projects for JIRA, teams for Linear). The new PMContainerPicker bypasses this pattern and calls the discovery endpoint directly with a generic containers capability that no provider supports.

Code Issues

Blocking

  • web/src/components/projects/integration-alerting-tab.tsx:30capability: 'containers' is not declared by any production PM provider. Trello declares boards, JIRA declares projects, Linear declares teams — none declares containers. The Trello manifest explicitly documents this: "containers isn't declared because in Trello's model it would be redundant with boards". Clicking "Fetch Lists" will always return a NOT_IMPLEMENTED tRPC error. The manual text input fallback works, so configuration is possible, but the picker UX is non-functional.

    Options to fix: (a) map the capability per provider (e.g. Trello→boards, JIRA→projects/states, Linear→teams), (b) add a containers capability to each provider that returns the appropriate container list, or (c) drop the picker and only show the manual text input until containers support is added.

Observations (not blocking)

  • The ternary alertingResultsContainerId ? alertingResultsContainerId : undefined at promptContext.ts:79 could be simplified to just alertingResultsContainerId (since undefined is already the falsy case), but this is cosmetic — the logic is correct.

🕵️ claude-code · claude-opus-4-6 · run details

mutationFn: async () => {
return (await trpcClient.pm.discovery.discover.mutate({
providerId: pmProvider,
capability: 'containers',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

BLOCKING: capability: 'containers' is not declared by any of the three production PM providers:

  • Trello: declares boards, labels, customFields, currentUser — manifest comment says "containers isn't declared because in Trello's model it would be redundant with boards"
  • JIRA: declares projects, states, labels, customFields, currentUser
  • Linear: declares teams, states, labels, projects, currentUser

The pm.discovery.discover endpoint checks manifest.discoveryCapabilities?.[input.capability] and throws NOT_IMPLEMENTED when the capability isn't declared. This means the "Fetch Lists" button will error for every provider.

The manual text input fallback works, so users can configure this field — but the picker dropdown is non-functional.

Consider either: (a) mapping per provider to the right capability, (b) adding containers support to each provider manifest, or (c) removing the picker until the capability exists.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed! Added a containerCapabilityForProvider helper that maps each PM provider slug to its actual discovery capability: Trello→boards, JIRA→projects, Linear→teams. The PMContainerPicker now uses the mapped capability, so "Fetch Lists" will call the right endpoint for each provider. The Fetch button is also disabled (with an explanatory tooltip) for any unrecognised provider slug as a safety net.

…tainer picker

Replace the non-existent `containers` capability (which caused NOT_IMPLEMENTED
errors for every provider) with provider-specific mappings: Trello→`boards`,
JIRA→`projects`, Linear→`teams`. Disable the Fetch button with an explanatory
tooltip for unknown providers.

Also simplify the `alertingResultsContainerId ?? undefined` ternary to a plain
`??` expression in promptContext.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants