fix(jobs): keep a connection syncing when one of its accounts cannot be read
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Read src/lib/jobs/sync-connection.ts and its account loop, then trace the reconnect flow in src/lib/connections/connect.ts and the adapter errors named in the issue. The work spans account level persistence, several adapters, GitHub installation checks, the connection page, and unit and Playwright tests. Done means the listed acceptance criteria pass, including the specified typecheck, lint, database tests, and connections end to end spec.
Written by the indexing model from the issue text.
Description
Context
Do after #760: it changes the same loop in src/lib/jobs/sync-connection.ts.
Found by the Fable pre-production review on 2026-12-02 (main at cedc1914; every line reference below re-checked on main at cde5aa3b). Source: provider connect readiness report, N5.
One account that cannot be read stops every account on its connection:
- The account loop has no per-account handling (
src/lib/jobs/sync-connection.ts:206-288): any throw goes tohandleFailurefor the whole connection (:113-114). - A 404 is
invalid_response(src/lib/adapters/errors.ts:164), which a deleted Supabase project hits on its first request (src/lib/adapters/supabase/index.ts:826-834). - An account the credential no longer covers throws a plain
Error(src/lib/adapters/vercel/index.ts:1025,src/lib/adapters/stripe/index.ts:1096,src/lib/adapters/digitalocean/index.ts:1329), which counts asinternal_error(sync-connection.ts:386) and is retried every hour. - A reconnect upserts the accounts the new grant lists and never retires the rest (
src/lib/connections/connect.ts:184-196), so an account the grant dropped stays included. - GitHub's sync never checks that the account belongs to the installation it mints a token for (
src/lib/adapters/github/index.ts:475-495), so after a reconnect that grants another installation, the new account's figures can be stored under the old account.
Impact: one deleted Supabase project, an unshared Railway workspace, or a reconnect that grants another team stops the whole connection, with "did not answer" copy that points at the provider (sync-connection.ts:357). Every other account on it goes stale. #529 covers the simulated case only.
Plan
- Catch an account's failure inside the loop: record it on that account (a new
external_accountscolumn for the last error code and reference), log it with a reference, and continue with the next account. - Fail the connection only when every account failed, or when the error is connection wide (
auth_revoked,permission_missing, rate limit). - On reconnect, mark an included account the new grant no longer lists as not covered (skip it in sync, show it on the page) instead of leaving it included.
- Replace the plain
Errors for an uncovered account with a typed adapter error, so it is classified as "account not covered", notinternal_error. - GitHub: refuse an
externalAccountIdthat is not the installation's account before minting a token. - The connection page names a failing or uncovered account and what to do.
Acceptance criteria
- A failing account is named on the connection page with a reference, and the other accounts still sync (unit test).
- After a reconnect, an included account the grant no longer lists is skipped and marked on the page (unit test).
- GitHub refuses an account id that is not its installation's (unit test).
- The Vercel, Stripe, and DigitalOcean "not covered" errors are typed and not retried as
internal_error. - Playwright e2e covers the connection page notice, with an axe scan and a keyboard pass.
Files and areas
src/lib/jobs/sync-connection.ts, src/lib/connections/connect.ts, src/lib/adapters/errors.ts, the three adapters named above, src/lib/adapters/github/index.ts, a migration for the account level error, src/app/w/[workspace]/connections/[connectionId]/page.tsx, their tests.
Non-goals: the sync deadline (#{n4}), the connection level failure copy (separate issue), simulated reconnects (#529).
Verification
npm run typecheck, npm run lint, npx vitest run src/lib/jobs src/lib/connections src/lib/adapters, npm run test:db, the connections e2e spec.
Branch: <issue-number>-account-failure-isolation
Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 2
- Avg merge
- 5h 20m
- Merged PRs (30d)
- 287
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from eddiejaoude/StackDash
-
area: integrations documentation priority: P2 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eddiejaoude/StackDash#798 ·
Maintainers usually reply within 1 day
-
area: ops documentation priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eddiejaoude/StackDash#796 ·
Maintainers usually reply within 1 day
-
area: docs documentation impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eddiejaoude/StackDash#790 ·
Maintainers usually reply within 1 day
-
area: ops bug impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eddiejaoude/StackDash#785 ·
Maintainers usually reply within 1 day
-
area: connections enhancement impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
eddiejaoude/StackDash#768 ·
Maintainers usually reply within 1 day
All issues in eddiejaoude/StackDash
Similar issues
-
bot:ai-assisted component:midnight-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midnightntwrk/midnight-js#1790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
effort/l priority/p1 risk/high triage/core
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
iflytek/skillhub#1188 · 1 comment ·
Maintainers usually reply within 1 day