Skip to content

fix(bridge): give timeouts and extension errors a named code - #38

Open
amirhmoradi wants to merge 1 commit into
mainfrom
upstream-sync/2026-10-12-bridge-error-codes
Open

amirhmoradi wants to merge 1 commit into
mainfrom
upstream-sync/2026-10-12-bridge-error-codes

Conversation

@amirhmoradi

Copy link
Copy Markdown
Contributor

Summary

When the extension didn't answer before the per-request timeout, the bridge returned HTTP 500 with no code. The CLI and MCP clients fill a missing code from the status, so agents saw THUNDERBIRD_ERROR and treated "timed out, outcome unknown" as a real Thunderbird failure (or retried a send that may already have gone out).

bridge/bridge.js now always names the failure:

Case Before After
Extension didn't answer in time 500, no code 504 TIMEOUT
Extension not connected 503, no code (status picked by matching the message text) 503 EXTENSION_DISCONNECTED
Extension error without its own code 500, no code 500 THUNDERBIRD_ERROR
Extension error with a code (e.g. FORBIDDEN) kept kept (403)

No client change is needed: both clients already prefer the bridge's code. Also fixes the stale "30s" timeout in the SPEC.md and docs/COMMANDS.md error tables (the default is 120s).

Bridge-only. No change under extension/, to the access policy, or to command/tool counts.

Idea from vitalio-sh/thunderbird-cli#26 / dd95a6a, reimplemented (no code copied). Found by the weekly upstream scan, ODIAA-2491. Last week's ledger had parked this under ODIAA-2403 (extension batch), but it needs no add-on change, so it ships here.

Tests

  • New "Error codes" section in test/bridge-security.mjs (8 checks, using a fake extension that never answers and one that returns errors). 4 of them fail against main; all pass with the fix.
  • npm run test:all: exit 0, all suites 0 failed (bridge-security 41/41, was 33).
  • npm run test:pack-smoke: 10/10.

CHANGELOG entry under [Unreleased] → Fixed. If #37 merges first, this needs a trivial CHANGELOG rebase.

🤖 Generated with Claude Code

A bridge-side timeout came back as HTTP 500 with no code, so the CLI and
MCP clients reported it as THUNDERBIRD_ERROR. Timeouts now return 504
TIMEOUT, a missing extension 503 EXTENSION_DISCONNECTED, and uncoded
extension errors 500 THUNDERBIRD_ERROR. Extension-supplied codes such as
FORBIDDEN are kept.

Idea from vitalio-sh/thunderbird-cli#26 (dd95a6a), reimplemented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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