Repository navigation
docs(ai-monitoring): Document the sort param on AI conversations - #130350
Merged
Merged
Conversation
The AI conversations list endpoint accepts a sort query parameter, validated against AI_CONVERSATIONS_FIELDS, with a default of -conversation.age. The OpenAPI docs didn't list it. Document it with an enum of the canonical sort fields, each with an optional - prefix. The legacy spellings the endpoint still accepts while the frontend and backend deploy independently stay undocumented. Refs getsentry/toolkit#2073 Co-Authored-By: BYK <[email protected]>
BYK
approved these changes
Nov 7, 2026
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Nov 7, 2026
Stacked on #2073. That PR moves the CLI onto the generated `@sentry/api` operations. This one fixes the cases where the CLI, not the API docs, was wrong. The full list is in getsentry/sentry#130351. Where the 1.44.0 operation now matches, the call moves onto it here too. Each fix was checked against the getsentry/sentry endpoint code. ### Moved onto generated operations | Area | Fix | Operation | | --- | --- | --- | | `alert issues list/view` | Filter workflows by `project` (the endpoint ignores `projectSlug`) and send `id` as a number | `listOrganizationWorkflows` (×2) | | `code-mappings upload` | Send the bulk body in snake_case: `default_branch`, `stack_root`, `source_root` | `bulkUpsertOrganizationCodeMappings` | | `explore`, `dashboard view` tables | Type `dataset` as a public Events dataset. Explore still falls back to `errors`, and unmapped widget types still render as unsupported | `listOrganizationEvents` (×2) | | `issue view` and other org-scoped issue lookups | Send only the `collapse` values the details endpoint reads (`release`, `stats`, `tags`). It ignored `lifetime`/`filtered`/`unhandled`, and the detail response keeps those fields either way. The short-ID endpoint still gets every value | `getOrganizationIssue` | | `issue view` replay lookup | Send `data_source=errors`. `events` isn't a value the endpoint accepts | `getOrganizationReplayCount` | | `issue explain/plan` | Drop `mode=explorer`, which the autofix endpoint never reads | `startOrganizationIssueAutofix` (×2), `getOrganizationIssueAutofixState` | ### Fixed, but still on the helper - **`issue merge`**: now sends `{merge: true}` with numeric IDs. `updateOrganizationIssues` marks every body field required until getsentry/sentry#130348 lands. - **`trace view`**: no longer sends `project` or `limit`, since the endpoint reads neither. It stays on the helper until getsentry/sentry#130349 documents `timestamp`. An unknown project in `trace view org/project/<id>` still fails as before. - **Dashboard and explore time series**: get the same typed `dataset`, but stay on the helper until #130349 fixes `yAxis`/`interval`. - **AI conversations list**: untouched, because it's waiting on getsentry/sentry#130350 (`sort`). ### Kept on purpose - **`replay list`** keeps requesting `info_ids` and `warning_ids`. The server computes them and `replay list --json` prints them, so dropping them would change the output. `fetchReplayPage` stays on the helper, and a comment says why. ### Behavior notes - On the moved calls, errors use the SDK wording already used by the moved calls in #2073 and by the metric alert path, e.g. `Failed to list issue alert rules: 403 Forbidden`. They no longer start with `API request failed:`, and they no longer have an `Endpoint:` line. Status codes and the 401/403 enrichment are unchanged. - Existing bug, not fixed here: `trace view org/project/<id>` prints "Filtered to project", but the trace endpoint has returned spans from every project since getsentry/sentry#87314. - Docs gap: with `returnIds=true`, the replay-count response maps each issue ID to a list of replay IDs. The documented schema describes counts. The CLI keeps validating that response with its own schema. ### Verification - `pnpm run tsc` and `pnpm run lint` pass. - CLI tests: 12884 pass and 5 fail. All 5 are the sandbox-only permission tests that fail on `main` too (`completions` ×2, `upgrade` acquireLock, `db/resilient` readonly, `dsn/code-scanner`). - Unit tests were updated or added for each changed request shape, including the new `test/lib/api/code-mappings.test.ts`. - API discovery no longer lists the moved call sites. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A80220b9d4c297e2a971f05dcb03af515 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
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.
GET /organizations/{org}/agents/conversations/(listOrganizationAIConversations) accepts asortquery param.OrganizationAIConversationsSerializervalidates it againstAI_CONVERSATIONS_FIELDS, and it defaults to-conversation.age, but the OpenAPI docs didn't list it. This adds the parameter with an enum of the canonical fields, each with an optional-prefix. Only this operation changes in the generated schema, and there's no runtime change.The enum comes from a new
AI_CONVERSATIONS_SORT_FIELDStuple. It takes the keys ofAI_CONVERSATIONS_FIELDSbefore the legacy spellings are added, somessages, the bare field names and the function aliases stay accepted but undocumented.The Sentry CLI's
agent-conversation list --sortneeds this to move onto the generated@sentry/apioperation (getsentry/toolkit#2073). The generated query type has nosorttoday.Checked locally with
make build-api-docs,pnpm run validate-api-examples,tests/sentry/api/endpoints/test_organization_ai_conversations.py,tests/apidocs, prek and mypy.via @BYK.
--
View Session [Sentry]