Skip to content

fix(cli): Keep regex log queries intact in --query - #1407

Draft
JoshuaKGoldberg wants to merge 5 commits into
joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-asfrom
joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli
Draft

JoshuaKGoldberg wants to merge 5 commits into
joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-asfrom
joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

The CLI's query sanitizer now passes key://pattern// regex log filters through as written instead of rewriting inside the pattern.

Closes LOGS-1031

@linear-code

linear-code Bot commented Oct 5, 2026

Copy link
Copy Markdown

LOGS-1031

@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from c560771 to 61301cb Compare October 5, 2026 16:38
@JoshuaKGoldberg
JoshuaKGoldberg changed the base branch from main to joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as October 5, 2026 16:38
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from 7277c79 to 80ba22e Compare October 5, 2026 16:42
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch 2 times, most recently from b71ce0c to 12a56db Compare October 5, 2026 18:17
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from 80ba22e to d801aab Compare October 5, 2026 18:17
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from 12a56db to 5bbe572 Compare October 5, 2026 19:11
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch 2 times, most recently from 85f016a to d33ede4 Compare October 5, 2026 19:27
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from 5bbe572 to 2ea9342 Compare October 5, 2026 19:27
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from d33ede4 to d1be5cb Compare October 5, 2026 19:38
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from 2ea9342 to 0e13b15 Compare October 5, 2026 19:38
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from d1be5cb to a0082d7 Compare October 5, 2026 20:13
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from 0e13b15 to aced5d6 Compare October 5, 2026 20:13
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from a0082d7 to 863cfb1 Compare October 5, 2026 20:36
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from aced5d6 to 56664f6 Compare October 5, 2026 20:36
JoshuaKGoldberg and others added 5 commits October 5, 2026 17:03
Parse `key://pattern//` (and `!key://pattern//`) as a single opaque
filter, ending at the first `//` followed by whitespace, `)`, or end
of query, so sanitizeQuery no longer rewrites commas, brackets,
`OR`/`AND`, or repeated whitespace inside a pattern. Document regex
search in the syntax reference and the CLI skill docs for logs.

Refs LOGS-1031

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sentry accepts tags[k,string], tags[k:sub], flags[...], quoted, and [*]
keys before a regex value, so --query now preserves regexes on those keys
instead of normalizing or rewriting inside the pattern.

Refs LOGS-1031
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every regex test now includes something the old sanitizer rewrites, and
the comments the regex change made stale or redundant are gone.

Refs LOGS-1031
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream allows a filter to follow ) or a quote with no space, so the
preserved-segment check now accepts those too.

Refs LOGS-1031
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Array regex needs the tags[name,array][*] key form, so listing arrays
without it would point agents at a regex that silently matches nothing.

Refs LOGS-1031
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1031-keep-regex-log-queries-intact-in-the-sentry-cli branch from 56664f6 to 714c712 Compare October 5, 2026 21:04
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-1015-pass-regex-log-queries-through-sentry-mcps-search-tools-as branch from 863cfb1 to 62d3af8 Compare October 5, 2026 21:04
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
---
Adds a `--no-agent-skills` flag to `sentry cli upgrade`.

The `upgrade` command re-runs `cli setup` on the freshly downloaded
binary, which reinstalls agent skills every time. `setup` already
supports `--no-agent-skills`, but `upgrade` had no way to pass it
through. This wires a `--no-agent-skills` flag on `upgrade` that is
forwarded into the spawned `setup` args across all upgrade paths
(curl/install, package-manager in-place, and nightly standalone
migration).

```
sentry cli upgrade --no-agent-skills
```

## What changed
- new `--no-agent-skills` boolean flag on the `upgrade` command (default
`false`)
- threaded through `runSetupOnNewBinary`, `executeStandardUpgrade`, and
`migrateToStandaloneForNightly`; appends `--no-agent-skills` to the `cli
setup` args when set
- added an example to the command's help text
- tests: default upgrade does not pass `--no-agent-skills`;
`--no-agent-skills` is forwarded to setup

## Not included (needs a product decision)
The issue also asks to make skill installation **opt-in by default**.
That's a behavior change affecting the install script and default
`setup` flow, so it's out of scope for this flag-only change — flagged
for maintainers. The other points in the issue (skill content quality:
`issue view --json`, jq shapes, redacting request session data) are
about the generated skill content, not the upgrade command, and belong
in a separate change.

## Testing
- `vitest run test/commands/cli/upgrade.test.ts` — 32 passed (incl. 2
new)
- `tsc --noEmit` clean
- `biome check` clean on changed files

Note: generated skill/doc files are gitignored and regenerated by CI, so
they're intentionally not in this diff.

Closes getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
---
Adds a `--no-agent-skills` flag to `sentry cli upgrade`.

The `upgrade` command re-runs `cli setup` on the freshly downloaded
binary, which reinstalls agent skills every time. `setup` already
supports `--no-agent-skills`, but `upgrade` had no way to pass it
through. This wires a `--no-agent-skills` flag on `upgrade` that is
forwarded into the spawned `setup` args across all upgrade paths
(curl/install, package-manager in-place, and nightly standalone
migration).

```
sentry cli upgrade --no-agent-skills
```

## What changed
- new `--no-agent-skills` boolean flag on the `upgrade` command (default
`false`)
- threaded through `runSetupOnNewBinary`, `executeStandardUpgrade`, and
`migrateToStandaloneForNightly`; appends `--no-agent-skills` to the `cli
setup` args when set
- added an example to the command's help text
- tests: default upgrade does not pass `--no-agent-skills`;
`--no-agent-skills` is forwarded to setup

## Not included (needs a product decision)
The issue also asks to make skill installation **opt-in by default**.
That's a behavior change affecting the install script and default
`setup` flow, so it's out of scope for this flag-only change — flagged
for maintainers. The other points in the issue (skill content quality:
`issue view --json`, jq shapes, redacting request session data) are
about the generated skill content, not the upgrade command, and belong
in a separate change.

## Testing
- `vitest run test/commands/cli/upgrade.test.ts` — 32 passed (incl. 2
new)
- `tsc --noEmit` clean
- `biome check` clean on changed files

Note: generated skill/doc files are gitignored and regenerated by CI, so
they're intentionally not in this diff.

Closes getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
---
Adds a `--no-agent-skills` flag to `sentry cli upgrade`.

The `upgrade` command re-runs `cli setup` on the freshly downloaded
binary, which reinstalls agent skills every time. `setup` already
supports `--no-agent-skills`, but `upgrade` had no way to pass it
through. This wires a `--no-agent-skills` flag on `upgrade` that is
forwarded into the spawned `setup` args across all upgrade paths
(curl/install, package-manager in-place, and nightly standalone
migration).

```
sentry cli upgrade --no-agent-skills
```

## What changed
- new `--no-agent-skills` boolean flag on the `upgrade` command (default
`false`)
- threaded through `runSetupOnNewBinary`, `executeStandardUpgrade`, and
`migrateToStandaloneForNightly`; appends `--no-agent-skills` to the `cli
setup` args when set
- added an example to the command's help text
- tests: default upgrade does not pass `--no-agent-skills`;
`--no-agent-skills` is forwarded to setup

## Not included (needs a product decision)
The issue also asks to make skill installation **opt-in by default**.
That's a behavior change affecting the install script and default
`setup` flow, so it's out of scope for this flag-only change — flagged
for maintainers. The other points in the issue (skill content quality:
`issue view --json`, jq shapes, redacting request session data) are
about the generated skill content, not the upgrade command, and belong
in a separate change.

## Testing
- `vitest run test/commands/cli/upgrade.test.ts` — 32 passed (incl. 2
new)
- `tsc --noEmit` clean
- `biome check` clean on changed files

Note: generated skill/doc files are gitignored and regenerated by CI, so
they're intentionally not in this diff.

Closes getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
…tsentry#1408)

---
Two follow-ups to getsentry#1407 (requested by @BYK on getsentry#1403). Skills stay
opt-out by default per the maintainers' product decision — this does
**not** flip that default.

## 1. Persist the `--no-agent-skills` preference
Passing `--no-agent-skills` once now sticks. `cli setup` records
`defaults.agent-skills=off` in the metadata KV store, and subsequent
runs skip skill installation even without the flag — so a bare `sentry
cli upgrade` (which re-runs `cli setup`) no longer reinstalls skills the
user opted out of.

- new `defaults.agent-skills` metadata key + `getAgentSkillsPreference`
/ `setAgentSkillsPreference` (mirrors the existing `telemetry`
preference)
- `cli setup` persists an explicit `--no-agent-skills` opt-out and
honors a stored opt-out when the flag is absent
- `sentry cli defaults agent-skills on|off` to view/change it; shows up
in `sentry cli defaults`
- re-enable anytime with `sentry cli defaults agent-skills on`

## 2. Skill content quality (issue points 1–3)
Source docs feed the generated skill (`agent-guidance.md`, the `issue`
command fragment, and the `event` field description):
- **points at `sentry issue view <SHORT-ID> --json`** as the fastest way
to get an agent up to speed, in both the workflow example and the field
docs
- **documents the jq shapes** — event data lives under `event.entries[]`
tagged by `type`, not top-level `event.request` (the "first guess that
doesn't match"); added correct recipes for request URL/method and
exception type/value
- **steers away from dumping request/session data** — recommends
`--fields event.id,...` and named-field jq extraction instead of the
whole `event` object, since the `request` entry can carry live
cookies/headers/body

Regenerated `SKILL.md` + `references/issue.md` are included (CI checks
these are in sync).

## Testing
- `vitest run test/commands/cli/defaults.test.ts` — 40 passed (incl. new
agent-skills storage + shape tests)
- `vitest run test/commands/cli/setup.test.ts` — new persistence tests
pass (persists opt-out; honors stored opt-out without the flag). Note: 3
pre-existing agent-skill install tests fail in the sandbox because they
need a live skill fetch/generation that isn't available locally — they
fail identically on clean `main` here and are unrelated to this change.
- `tsc --noEmit` clean
- `biome check` clean on changed files

Refs getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
…tsentry#1408)

---
Two follow-ups to getsentry#1407 (requested by @BYK on getsentry#1403). Skills stay
opt-out by default per the maintainers' product decision — this does
**not** flip that default.

## 1. Persist the `--no-agent-skills` preference
Passing `--no-agent-skills` once now sticks. `cli setup` records
`defaults.agent-skills=off` in the metadata KV store, and subsequent
runs skip skill installation even without the flag — so a bare `sentry
cli upgrade` (which re-runs `cli setup`) no longer reinstalls skills the
user opted out of.

- new `defaults.agent-skills` metadata key + `getAgentSkillsPreference`
/ `setAgentSkillsPreference` (mirrors the existing `telemetry`
preference)
- `cli setup` persists an explicit `--no-agent-skills` opt-out and
honors a stored opt-out when the flag is absent
- `sentry cli defaults agent-skills on|off` to view/change it; shows up
in `sentry cli defaults`
- re-enable anytime with `sentry cli defaults agent-skills on`

## 2. Skill content quality (issue points 1–3)
Source docs feed the generated skill (`agent-guidance.md`, the `issue`
command fragment, and the `event` field description):
- **points at `sentry issue view <SHORT-ID> --json`** as the fastest way
to get an agent up to speed, in both the workflow example and the field
docs
- **documents the jq shapes** — event data lives under `event.entries[]`
tagged by `type`, not top-level `event.request` (the "first guess that
doesn't match"); added correct recipes for request URL/method and
exception type/value
- **steers away from dumping request/session data** — recommends
`--fields event.id,...` and named-field jq extraction instead of the
whole `event` object, since the `request` entry can carry live
cookies/headers/body

Regenerated `SKILL.md` + `references/issue.md` are included (CI checks
these are in sync).

## Testing
- `vitest run test/commands/cli/defaults.test.ts` — 40 passed (incl. new
agent-skills storage + shape tests)
- `vitest run test/commands/cli/setup.test.ts` — new persistence tests
pass (persists opt-out; honors stored opt-out without the flag). Note: 3
pre-existing agent-skill install tests fail in the sandbox because they
need a live skill fetch/generation that isn't available locally — they
fail identically on clean `main` here and are unrelated to this change.
- `tsc --noEmit` clean
- `biome check` clean on changed files

Refs getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
…tsentry#1408)

---
Two follow-ups to getsentry#1407 (requested by @BYK on getsentry#1403). Skills stay
opt-out by default per the maintainers' product decision — this does
**not** flip that default.

## 1. Persist the `--no-agent-skills` preference
Passing `--no-agent-skills` once now sticks. `cli setup` records
`defaults.agent-skills=off` in the metadata KV store, and subsequent
runs skip skill installation even without the flag — so a bare `sentry
cli upgrade` (which re-runs `cli setup`) no longer reinstalls skills the
user opted out of.

- new `defaults.agent-skills` metadata key + `getAgentSkillsPreference`
/ `setAgentSkillsPreference` (mirrors the existing `telemetry`
preference)
- `cli setup` persists an explicit `--no-agent-skills` opt-out and
honors a stored opt-out when the flag is absent
- `sentry cli defaults agent-skills on|off` to view/change it; shows up
in `sentry cli defaults`
- re-enable anytime with `sentry cli defaults agent-skills on`

## 2. Skill content quality (issue points 1–3)
Source docs feed the generated skill (`agent-guidance.md`, the `issue`
command fragment, and the `event` field description):
- **points at `sentry issue view <SHORT-ID> --json`** as the fastest way
to get an agent up to speed, in both the workflow example and the field
docs
- **documents the jq shapes** — event data lives under `event.entries[]`
tagged by `type`, not top-level `event.request` (the "first guess that
doesn't match"); added correct recipes for request URL/method and
exception type/value
- **steers away from dumping request/session data** — recommends
`--fields event.id,...` and named-field jq extraction instead of the
whole `event` object, since the `request` entry can carry live
cookies/headers/body

Regenerated `SKILL.md` + `references/issue.md` are included (CI checks
these are in sync).

## Testing
- `vitest run test/commands/cli/defaults.test.ts` — 40 passed (incl. new
agent-skills storage + shape tests)
- `vitest run test/commands/cli/setup.test.ts` — new persistence tests
pass (persists opt-out; honors stored opt-out without the flag). Note: 3
pre-existing agent-skill install tests fail in the sandbox because they
need a live skill fetch/generation that isn't available locally — they
fail identically on clean `main` here and are unrelated to this change.
- `tsc --noEmit` clean
- `biome check` clean on changed files

Refs getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
…tsentry#1408)

---
Two follow-ups to getsentry#1407 (requested by @BYK on getsentry#1403). Skills stay
opt-out by default per the maintainers' product decision — this does
**not** flip that default.

## 1. Persist the `--no-agent-skills` preference
Passing `--no-agent-skills` once now sticks. `cli setup` records
`defaults.agent-skills=off` in the metadata KV store, and subsequent
runs skip skill installation even without the flag — so a bare `sentry
cli upgrade` (which re-runs `cli setup`) no longer reinstalls skills the
user opted out of.

- new `defaults.agent-skills` metadata key + `getAgentSkillsPreference`
/ `setAgentSkillsPreference` (mirrors the existing `telemetry`
preference)
- `cli setup` persists an explicit `--no-agent-skills` opt-out and
honors a stored opt-out when the flag is absent
- `sentry cli defaults agent-skills on|off` to view/change it; shows up
in `sentry cli defaults`
- re-enable anytime with `sentry cli defaults agent-skills on`

## 2. Skill content quality (issue points 1–3)
Source docs feed the generated skill (`agent-guidance.md`, the `issue`
command fragment, and the `event` field description):
- **points at `sentry issue view <SHORT-ID> --json`** as the fastest way
to get an agent up to speed, in both the workflow example and the field
docs
- **documents the jq shapes** — event data lives under `event.entries[]`
tagged by `type`, not top-level `event.request` (the "first guess that
doesn't match"); added correct recipes for request URL/method and
exception type/value
- **steers away from dumping request/session data** — recommends
`--fields event.id,...` and named-field jq extraction instead of the
whole `event` object, since the `request` entry can carry live
cookies/headers/body

Regenerated `SKILL.md` + `references/issue.md` are included (CI checks
these are in sync).

## Testing
- `vitest run test/commands/cli/defaults.test.ts` — 40 passed (incl. new
agent-skills storage + shape tests)
- `vitest run test/commands/cli/setup.test.ts` — new persistence tests
pass (persists opt-out; honors stored opt-out without the flag). Note: 3
pre-existing agent-skill install tests fail in the sandbox because they
need a live skill fetch/generation that isn't available locally — they
fail identically on clean `main` here and are unrelated to this change.
- `tsc --noEmit` clean
- `biome check` clean on changed files

Refs getsentry#1403
---

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active (outdated) deployment
Actions — 61301cb7 Deployed Oct 5, 2026 by JoshuaKGoldberg via eval #1188
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