Skip to content

feat: local-mode WS terminal failure — pause after N reconnects, typed error (#22)#33

Merged
AndresL230 merged 12 commits into
mainfrom
feat/22-ws-terminal-failure
May 14, 2026
Merged

feat: local-mode WS terminal failure — pause after N reconnects, typed error (#22)#33
AndresL230 merged 12 commits into
mainfrom
feat/22-ws-terminal-failure

Conversation

@AndresL230
Copy link
Copy Markdown
Contributor

Summary

  • Adds RecostLocalUnreachableError to the public API; sibling to the RecostAuthError hierarchy added in PR feat: 401 auth-failure handling — suspend after N, typed errors (#16) #32.
  • Pauses the local WebSocket transport after maxConsecutiveReconnectFailures (default 20) consecutive failed reconnects. Recovery is restart-only.
  • One-time stderr warning at the threshold, regardless of debug flag.
  • Existing onError(err: Error) signature is unchanged — hosts narrow via instanceof.

Closes #22.

Wave 1 of the issue-waves roadmap (docs/superpowers/roadmap-2026-05-13-issue-waves.md); Sub-plan B for cross-SDK parity is tracked at recost-dev/middleware-python#32.

Branch contents

12 commits — 2 leading docs commits (roadmap + spec, then plan) ride at the head of the implementation branch by intent (combined PR rather than separate docs/impl PRs):

  • 856dce9 docs(roadmap): 6-wave issue plan + Wave 1 Sub-plan A spec
  • 1938601 docs(plan): WS terminal failure implementation plan
  • 3 setup feat commits (types, public-api export, ResolvedConfig wiring)
  • 1 bundled feat impl commit (TDD test + production code together)
  • 5 test commits (threshold trip, send-after-pause, counter reset, configurable threshold, cloud-mode-unaffected + idempotency)
  • 1 README docs commit

Test plan

  • npm run test — 235/235 green (228 baseline + 7 new cases)
  • npm run lint — clean
  • npm run build — clean dual ESM + CJS + DTS
  • Manually verify in a host process with no VS Code extension running: SDK stops spinning after the threshold, one stderr line is printed, one onError(RecostLocalUnreachableError) fires, CPU drops to zero.

AndresL230 added 12 commits May 13, 2026 18:44
- roadmap-2026-05-13-issue-waves.md: groups the 11 open issues into
  six 2-issue waves with theme, files, ordering rationale, and
  status placeholders. Tracking doc for the orchestrator.
- specs/2026-05-13-ws-terminal-failure-design.md: design for #22
  (WebSocket reconnect terminal failure mode). Mirrors the #16
  pattern shipped in PR #32: typed RecostLocalUnreachableError
  through onError, threshold counter (default 20, reuses existing
  _reconnectAttempts), one-shot stderr line, send() becomes
  silent no-op once paused, restart-only recovery.
…#22)

12-task plan for Wave 1 Sub-plan A. Mirrors PR #32's structure:
3 setup tasks (types, exports, ResolvedConfig wiring), 1 TDD-red
task, 1 implementation+green task with bundled commit, 5 test
tasks (threshold trip, send-after-pause no-op, counter reset on
successful connect, configurable threshold, cloud-mode-unaffected
+ idempotency), 1 README docs task, 1 final verification + PR
task. Each test is calibrated to keep wall-clock under vitest's
default per-test timeout.

Roadmap also updated to reference middleware-python#32 (Sub-plan
B follow-up issue, filed separately).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@AndresL230 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 5 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8744f10a-1a87-4263-b20e-b9fc0ea91cf9

📥 Commits

Reviewing files that changed from the base of the PR and between 3f28421 and d69cf4e.

📒 Files selected for processing (8)
  • README.md
  • docs/superpowers/plans/2026-05-13-ws-terminal-failure.md
  • docs/superpowers/roadmap-2026-05-13-issue-waves.md
  • docs/superpowers/specs/2026-05-13-ws-terminal-failure-design.md
  • src/core/transport.ts
  • src/core/types.ts
  • src/index.ts
  • tests/transport.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/22-ws-terminal-failure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AndresL230 AndresL230 merged commit c38595e into main May 14, 2026
1 check passed
@AndresL230 AndresL230 deleted the feat/22-ws-terminal-failure branch May 21, 2026 04:15
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.

WebSocket reconnect retries forever, no terminal failure mode

1 participant