Skip to content

[Bug]: Jira integration dies on network change ("fetch failed"), only recovers on full app restart #5593

Closed

Description

@JoaoMorais03

Operating system

macOS

Orca version

v1.4.75

Details

Summary

Orca's Jira task-provider stops working after a network path change (e.g. a daily corporate-VPN reconnect) and shows fetch failed. It does not self-heal — the only recovery is fully quitting and reopening Orca. The stored credential is valid the entire time; this is a transport/connection-pool bug, not an auth or credential issue.

Environment

  • Orca desktop (macOS, Apple Silicon), app at ~/Applications/Orca.app.
  • Jira Cloud site over HTTP Basic auth (email + Atlassian API token).
  • Corporate VPN that reconnects ~once per day (overnight / on sleep-wake).

Symptom / repro

  1. Configure (connect) Jira while the VPN is freshly up → works.
  2. ~A day later (after the VPN reconnects) the Jira panel fails with fetch failed.
  3. Re-entering the token does not reliably help; fully quitting and reopening Orca restores it (a fresh process = a fresh undici connection pool).
  4. Repeats on the next VPN reconnect.

Root cause (from reading the bundled out/main/index.js)

Jira requests use the bare global fetch() (undici) with a long-lived keep-alive pool and no Electron proxy/network integration:

  • requestWithCredentials → fetch(...) at index.js:75804
  • jiraRequest → fetch(...) at index.js:75836

Every other network integration routes through electron.net.fetch after calling ensureElectronProxyFromEnvironment(...) — e.g. the Claude OAuth refresh at index.js:130105 / 130113 and index.js:131742. The Jira path does neither, so it:

  1. ignores the macOS system proxy (undici only reads HTTP(S)_PROXY env, which a GUI-launched app doesn't have), and
  2. reuses dead keep-alive sockets after the network path changes (VPN reconnect) instead of re-establishing connections.

When the path changes, undici keeps trying the stale sockets and throws TypeError: fetch failed. Because token clearing is gated on isAuthError (status 401/403 only) at index.js:75973–75974, a transport error correctly does not delete the token — but there is also no retry/connection-reset/proxy-reprobe, so the integration stays broken until the process restarts and builds a new pool.

Secondary: testConnection (index.js:75945–75966) swallows errors without auth-aware handling, and Jira errors are written to console.warn/error (stderr) only — they never reach the structured trace log (main.trace.ndjson), so failures are invisible unless the app is launched from a terminal (which itself triggers the restart that masks the bug).

Suggested fix

  1. Route Jira requests through electron.net.fetch and call ensureElectronProxyFromEnvironment({ proxySession: session.defaultSession, probeUrl }) before each request, mirroring the existing Claude OAuth path (index.js:130105). This gives Jira Chromium's proxy handling and graceful behavior across network changes.
    • Alternatively, if staying on undici: use a dedicated Agent/dispatcher with a short keepAliveTimeout, retry once on UND_ERR_SOCKET / ECONNRESET / ETIMEDOUT, and recycle the dispatcher on a powerMonitor resume event.
  2. Add the full error (error.name, error.cause, resolved siteUrl) to the structured trace log, not just stderr, so transport failures are diagnosable without a terminal launch.
  3. Give testConnection the same auth-aware handling as the query functions — but only clear the token on a genuine 401/403, never on a transport error.

Impact

Every Orca user on a VPN/proxy that reconnects periodically loses Jira ~daily and must restart the app. The fix is low-risk (one network helper already exists in-tree and is used by other integrations).

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

Metadata

Metadata

Assignees

Labels

bugos:macos

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions