Skip to content

Fix GitHub repo list failing to load on slow installations#4811

Merged
stuartc merged 1 commit into
mainfrom
4810-slow-github-responses-timeout
May 29, 2026
Merged

Fix GitHub repo list failing to load on slow installations#4811
stuartc merged 1 commit into
mainfrom
4810-slow-github-responses-timeout

Conversation

@midigofrank
Copy link
Copy Markdown
Collaborator

@midigofrank midigofrank commented May 29, 2026

Description

Fixes a captured error on /projects/:id/settings where the GitHub sync section fails to load repos list when one of a user's GitHub installations takes >5s to return its repos.

By default, Task.async_stream has a timeout of 5 secs, this PR bumps it up to 30 secs

Closes #4810

Validation steps

  1. Existing version-control test suite still passes:
    mix test test/lightning_web/live/project_live_test.exs:4132
  2. To reproduce the original bug locally, add a Process.sleep(5005) inside
    the Task.async_stream callback in
    lib/lightning_web/live/project_live/github_sync_component.ex on main
    and open the project settings page — the GitHub section shows the
    failure state. With this fix the section loads (slow installations are
    dropped).
  3. The existing Stream.filter(&match?({:ok, _}, &1)) was meant to drop failed tasks but only works under on_timeout: :kill_task. This PR sets that, plus a 30s per-task timeout, so slow installations are dropped and the rest of the user's installations and repos still render.

Additional notes for the reviewer

  1. No test was added for the timeout itself — exercising the new 30s threshold
    in a test would make it slow and flaky. The existing 30-test version-control
    suite covers the happy path.
  2. The inner pagination call (maybe_fetch_remaining_repos) already uses
    timeout: :infinity, so a single installation's full repo fetch can easily
    exceed 5s. 30s on the outer task is a generous but bounded upper limit.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@github-project-automation github-project-automation Bot moved this to New Issues in Core May 29, 2026
@midigofrank midigofrank marked this pull request as ready for review May 29, 2026 08:27
@midigofrank midigofrank self-assigned this May 29, 2026
@midigofrank midigofrank requested a review from stuartc May 29, 2026 08:28
@github-actions
Copy link
Copy Markdown

The change is a 6-line operational fix: adds timeout: 30_000 and on_timeout: :kill_task options to a Task.async_stream/2 call that fetches GitHub repos per installation, plus a CHANGELOG entry. No database queries, no new web events, no resource mutations.

Security Review ✅

  • S0 (project scoping): N/A, the change only adjusts Task.async_stream timeout options on an outbound GitHub API call; no project-scoped queries or params are touched.
  • S1 (authorization): N/A, no new LiveView events, controller actions, or policy decisions introduced.
  • S2 (audit trail): N/A, no config-resource writes — the diff is read-only repo-fetching plus a CHANGELOG entry.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.2%. Comparing base (4e910ec) to head (02da4c6).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4811     +/-   ##
=======================================
- Coverage   90.3%   90.2%   -0.1%     
=======================================
  Files        442     442             
  Lines      22543   22543             
=======================================
- Hits       20350   20337     -13     
- Misses      2193    2206     +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stuartc stuartc merged commit 6845844 into main May 29, 2026
9 checks passed
@stuartc stuartc deleted the 4810-slow-github-responses-timeout branch May 29, 2026 10:53
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Slow GitHub responses cause repo list to fail to load on project settings

2 participants