Skip to content

Refactor packages/opencode/src/session/retry.ts retryable error handling - #31

Open
faboueln wants to merge 1 commit into
CMU-17313Q:mainfrom
faboueln:p1b-retryable-refactor
Open

Refactor packages/opencode/src/session/retry.ts retryable error handling#31
faboueln wants to merge 1 commit into
CMU-17313Q:mainfrom
faboueln:p1b-retryable-refactor

Conversation

@faboueln

@faboueln faboueln commented Sep 2, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #30

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • This PR updates the retryable() function in packages/opencode/src/session/retry.ts after Qlty flagged it for having too many return statements. I broke the function into smaller helper functions so each part handles a specific type of error. This keeps the same behavior, but makes the code easier to follow and removes the Qlty warning about having too many returns.

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

  • I tested the changes by running bun test test/session/retry.test.ts, and all 52 tests passed with no failures. I also checked the coverage using bun test test/session/retry.test.ts --coverage --coverage-dir=./coverage, and retry.ts had 100% function coverage and 97.65% line coverage. After that, I ran Qlty again to make sure the issue was actually fixed, and the original “Function with many returns” warning for retryable() was no longer showing.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

lint screenshot:

lint_screenshot bun-lint-passing

coverage screenshot:

coverage_screenshot

local tests screenshot:

localTests_screenshot

after qlty screenshot:

afterQLTY

before qlty screenshot:

beforeQLTY

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@faboueln
faboueln force-pushed the p1b-retryable-refactor branch from 1352eef to ad52079 Compare September 2, 2026 09:52
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.

P1B: Refactor (packages/opencode/src/session/retry.ts:77): Function with many returns (count = 14)

1 participant