Skip to content

fix(cli): preserve cancellation through the API transport - #1506

Closed
betegon wants to merge 1 commit into
mainfrom
bt/cli-api-cancellation
Closed

betegon wants to merge 1 commit into
mainfrom
bt/cli-api-cancellation

Conversation

@betegon

@betegon betegon commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Preserve per-request cancellation through the CLI's authenticated fetch. SDK operations pass a Request; the adapter previously lost its signal, replaced custom abort reasons, and kept waiting or retrying after cancellation.

const controller = new AbortController();
const pending = listOrganizations({
  ...getSdkConfig(baseUrl),
  signal: controller.signal,
});

controller.abort(new Error("Command cancelled"));
// Stops this request and retry waits; concurrent requests keep running.

Both fetch forms follow native signal precedence, including an explicit override:

const fetch = getSdkConfig(baseUrl).fetch;
await fetch(new Request(url, { signal })); // inherits Request.signal
await fetch(new Request(url, { signal }), { signal: null }); // detaches it

Cancellation stays connected after headers, stops subsequent redirect/retry dispatches, and releases a caller waiting for OAuth refresh without cancelling the shared refresh. Successful mutations still invalidate cache. Existing retry eligibility, timeouts and credential policy are preserved, including Node 20.0–20.2 support.

Validation

No SDK upgrade is required. This fixes connected adapter paths; it does not add a signal to every CLI command or interrupt arbitrary upload-stream producers while they are being buffered. No production OAuth testing.

Part of sentry-api-schema#95.

This cancellation fix is independent of the adoption stack: SDK upgrade #1507 → client reuse #1502 → SDK pagination #1508. It can merge separately and be kept when reverting the adoption steps.

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 15, 2026 4:20pm UTC

Request Review

@betegon
betegon marked this pull request as ready for review October 15, 2026 18:25
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 15, 2026
@betegon betegon closed this in b4cd64d Oct 15, 2026
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…try (getsentry#1507)

---
## What

Fixes the dashboard graphics pipeline silently falling back to ASCII on
kitty-capable terminals.

The dashboard rasterizes the whole grid into one image and encodes it as
kitty or sixel (`renderCompleteDashboardAsSixel`). That path required
the terminal's character-cell geometry (reported via `CSI 16 t`). Many
kitty terminals answer the graphics capability query but never report
cell size, so `terminalPixelWidth`/`terminalPixelHeight` returned
`undefined` and the dashboard dropped to ASCII — even though the
terminal fully supports kitty graphics.

## Changes

- `sixel.ts`: add `selectGraphicsFormat()` centralizing the
most-capable-first priority (kitty > sixel > ascii; kitty wins when both
are advertised, since it transmits full RGBA without palette
quantization), and `graphicsCellSize()` which returns the reported cell
size or falls back to `DEFAULT_CELL_WIDTH`/`DEFAULT_CELL_HEIGHT` (10×20)
when the terminal advertises graphics but reports no geometry.
- `dashboard.ts`: `renderCompleteDashboardAsSixel` now selects the
format via `selectGraphicsFormat()` and uses `graphicsCellSize()` for
geometry. It preserves the terminal's reported pixel width when known
and otherwise derives it from the cell width, so a graphics-capable
terminal always renders graphics instead of ASCII. The all-or-nothing
fallback invariant is preserved: with no graphics format available it
still returns `undefined` and the caller renders the full character
dashboard.

## Tests

- New unit tests for `selectGraphicsFormat` and `graphicsCellSize` in
`sixel.test.ts`.
- Integration tests updated to mock the new entrypoints; added a
regression test that a kitty terminal with no reported geometry renders
kitty graphics (not ASCII), and kept the ASCII fallback test for the
no-graphics case.
- `vitest run test/lib/formatters test/lib/sixel*.test.ts
test/lib/kitty-image.test.ts` — 1066 passing.

## Scope note

The issue also mentions a heatmap widget (from getsentry#1395) with a custom
ASCII renderer. That code is **not present on `main`** in this repo (no
`heatmap` references anywhere in the tree), so there was nothing to
unify for it here. Once the heatmap widget lands it should render
through the shared `chart-core` rasterizer / `sixel-dashboard`
compositor like the other widget types, which the compositor already
supports. Flagging for a follow-up.

Closes getsentry#1506
---

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…try (getsentry#1507)

---
## What

Fixes the dashboard graphics pipeline silently falling back to ASCII on
kitty-capable terminals.

The dashboard rasterizes the whole grid into one image and encodes it as
kitty or sixel (`renderCompleteDashboardAsSixel`). That path required
the terminal's character-cell geometry (reported via `CSI 16 t`). Many
kitty terminals answer the graphics capability query but never report
cell size, so `terminalPixelWidth`/`terminalPixelHeight` returned
`undefined` and the dashboard dropped to ASCII — even though the
terminal fully supports kitty graphics.

## Changes

- `sixel.ts`: add `selectGraphicsFormat()` centralizing the
most-capable-first priority (kitty > sixel > ascii; kitty wins when both
are advertised, since it transmits full RGBA without palette
quantization), and `graphicsCellSize()` which returns the reported cell
size or falls back to `DEFAULT_CELL_WIDTH`/`DEFAULT_CELL_HEIGHT` (10×20)
when the terminal advertises graphics but reports no geometry.
- `dashboard.ts`: `renderCompleteDashboardAsSixel` now selects the
format via `selectGraphicsFormat()` and uses `graphicsCellSize()` for
geometry. It preserves the terminal's reported pixel width when known
and otherwise derives it from the cell width, so a graphics-capable
terminal always renders graphics instead of ASCII. The all-or-nothing
fallback invariant is preserved: with no graphics format available it
still returns `undefined` and the caller renders the full character
dashboard.

## Tests

- New unit tests for `selectGraphicsFormat` and `graphicsCellSize` in
`sixel.test.ts`.
- Integration tests updated to mock the new entrypoints; added a
regression test that a kitty terminal with no reported geometry renders
kitty graphics (not ASCII), and kept the ASCII fallback test for the
no-graphics case.
- `vitest run test/lib/formatters test/lib/sixel*.test.ts
test/lib/kitty-image.test.ts` — 1066 passing.

## Scope note

The issue also mentions a heatmap widget (from getsentry#1395) with a custom
ASCII renderer. That code is **not present on `main`** in this repo (no
`heatmap` references anywhere in the tree), so there was nothing to
unify for it here. Once the heatmap widget lands it should render
through the shared `chart-core` rasterizer / `sixel-dashboard`
compositor like the other widget types, which the compositor already
supports. Flagging for a follow-up.

Closes getsentry#1506
---

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…try (getsentry#1507)

---
## What

Fixes the dashboard graphics pipeline silently falling back to ASCII on
kitty-capable terminals.

The dashboard rasterizes the whole grid into one image and encodes it as
kitty or sixel (`renderCompleteDashboardAsSixel`). That path required
the terminal's character-cell geometry (reported via `CSI 16 t`). Many
kitty terminals answer the graphics capability query but never report
cell size, so `terminalPixelWidth`/`terminalPixelHeight` returned
`undefined` and the dashboard dropped to ASCII — even though the
terminal fully supports kitty graphics.

## Changes

- `sixel.ts`: add `selectGraphicsFormat()` centralizing the
most-capable-first priority (kitty > sixel > ascii; kitty wins when both
are advertised, since it transmits full RGBA without palette
quantization), and `graphicsCellSize()` which returns the reported cell
size or falls back to `DEFAULT_CELL_WIDTH`/`DEFAULT_CELL_HEIGHT` (10×20)
when the terminal advertises graphics but reports no geometry.
- `dashboard.ts`: `renderCompleteDashboardAsSixel` now selects the
format via `selectGraphicsFormat()` and uses `graphicsCellSize()` for
geometry. It preserves the terminal's reported pixel width when known
and otherwise derives it from the cell width, so a graphics-capable
terminal always renders graphics instead of ASCII. The all-or-nothing
fallback invariant is preserved: with no graphics format available it
still returns `undefined` and the caller renders the full character
dashboard.

## Tests

- New unit tests for `selectGraphicsFormat` and `graphicsCellSize` in
`sixel.test.ts`.
- Integration tests updated to mock the new entrypoints; added a
regression test that a kitty terminal with no reported geometry renders
kitty graphics (not ASCII), and kept the ASCII fallback test for the
no-graphics case.
- `vitest run test/lib/formatters test/lib/sixel*.test.ts
test/lib/kitty-image.test.ts` — 1066 passing.

## Scope note

The issue also mentions a heatmap widget (from getsentry#1395) with a custom
ASCII renderer. That code is **not present on `main`** in this repo (no
`heatmap` references anywhere in the tree), so there was nothing to
unify for it here. Once the heatmap widget lands it should render
through the shared `chart-core` rasterizer / `sixel-dashboard`
compositor like the other widget types, which the compositor already
supports. Flagging for a follow-up.

Closes getsentry#1506
---

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

This branch was previously deployed

1 inactive deployment
Preview — 722106c5 Deployed Oct 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant