Skip to content

refactor: unify AbortError detection with isAbortError utility#10551

Open
amabito wants to merge 1 commit intocontinuedev:mainfrom
amabito:refactor/isAbortError-utility
Open

refactor: unify AbortError detection with isAbortError utility#10551
amabito wants to merge 1 commit intocontinuedev:mainfrom
amabito:refactor/isAbortError-utility

Conversation

@amabito
Copy link

@amabito amabito commented Feb 16, 2026

Summary

  • Abort error detection was scattered across multiple files with inconsistent patterns (name.includes, name.startsWith, === "cancel", code === "ABORT_ERR")
  • Introduces a shared isAbortError(error) utility and replaces inline checks

Changes

  • core/util/isAbortError.ts (new) — unified abort detection covering all known patterns
  • core/util/isAbortError.test.ts (new) — 14 test cases (positive + negative)
  • core/llm/index.ts — replaced 2 inline abort checks with isAbortError()
  • core/llm/utils/retry.ts — replaced 1 inline abort check with isAbortError()

Semantics preserved

  • Uses includes("AbortError") to match the original behavior at all replacement sites
  • L506 replacement intentionally widens suppression to also cover "cancel" and code="ABORT_ERR" errors from console logging (these are all abort cases that should not pollute the console)
  • No functional behavior change for end users

Test plan

  • isAbortError.test.ts passes (14 cases)
  • Existing tests unaffected
  • core/llm/index.test.ts still passes

🤖 Generated with Claude Code


Continue Tasks: ✅ 1 no changes — View all


Summary by cubic

Unifies abort error detection with a shared isAbortError utility across LLM core to keep handling consistent and cut noisy abort logs. No behavior change for end users.

  • Refactors
    • Added core/util/isAbortError.ts; detects "cancel", DOMException AbortError, Error.name containing "AbortError", code "ABORT_ERR", and plain objects with name.
    • Replaced inline checks in core/llm/index.ts and core/llm/utils/retry.ts with isAbortError(); console debug suppression now skips all abort variants.
    • Added 14 vitest cases in core/util/isAbortError.vitest.ts.

Written for commit ab9267b. Summary will update on new commits.

@amabito amabito requested a review from a team as a code owner February 16, 2026 13:12
@amabito amabito requested review from Patrick-Erichsen and removed request for a team February 16, 2026 13:12
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 16, 2026
@github-actions
Copy link

github-actions bot commented Feb 16, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@amabito
Copy link
Author

amabito commented Feb 16, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

@amabito
Copy link
Author

amabito commented Feb 16, 2026

I have read the CLA Document and I hereby sign the CLA

@amabito
Copy link
Author

amabito commented Feb 16, 2026

recheck

AbortError detection was scattered across 3+ patterns (string
comparison, .name check, .code check). Consolidates into a single
isAbortError() utility that handles all known patterns: "cancel"
string, DOMException, Error.name variants, ABORT_ERR code, and
plain objects. Updates call sites in core/llm/index.ts and
core/llm/utils/retry.ts.
@amabito amabito force-pushed the refactor/isAbortError-utility branch from be768d5 to ab9267b Compare February 16, 2026 13:36
@amabito
Copy link
Author

amabito commented Feb 16, 2026

I have read the CLA Document and I hereby sign the CLA

@amabito
Copy link
Author

amabito commented Feb 16, 2026

Heads up: the only failure appears to be a flaky GUI e2e check (GUI.test.js e2e:ci:run-yaml) unrelated to this refactor. All other required checks are green.

A rerun of the failing job should unblock merge.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant