Repository navigation
Sign-in redirects at once: GitHub's repository listing moves to a queued job on its own queue (callback 6.3 s → under 1 s) - #175
Merged
Conversation
VisualCIdocspring/visualci · build #458 · 400 unchanged · no changes This PR vs base: 6 changed, 8 added since #407, across 3 builds docspring/visualci · journeys · build #454 · 1 changed, 5 added, 29 unchanged · approved by visualci features agent for Nathan Broadbent
This PR vs base: nothing since #405, across 3 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
… GitHub calls) and a queued job on the sign-in queue lists their installations and repositories The callback took 6.3 s for Nathan on 4 Dec 2026, listing every installation's repositories one page at a time before it redirected. Now: - the callback reads the verified addresses only for a GitHub account no user has yet, signs them in and redirects (budget 1 counted call, plus the code exchange and /user); it logs 'sign-in callback' with elapsed_ms and github_calls - SyncGithubAccess (queue sign-in, which workers take first and one worker takes alone) lists with the token kept from the sign-in, records installations and repositories in one statement each, and fires SignedIn for memberships - users.github_sync_* says how it's going: the picker and checklist show the last sign-in's repositories while it loads, a failure or a listing over 90 s says so with Try again (POST /api/ui/github/sync, or Sign in with GitHub again when the token expired), and /github/setup waits on a self-reloading page until the listing has the installation - /status reports oldest_sign_in_sync_seconds - tests: the callback under 1 s with slow repository pages and at most 1 counted call; the listing's caps; a failed listing keeps the last one; a journey times the callback (< 1 s, <= 3 GitHub calls) and covers the failed listing and Try again
- The job has a 60 s timeout and gives up its listing after 45 s, recording a failure, so a killed run can't leave the person waiting; /status counts only listings asked for in the last 15 minutes, so one lost job doesn't alert for good - Two listings for one person serialise: the writes, the listing counts and the done mark happen in one transaction under the person's advisory lock, and only when no newer listing has finished; SignedIn follows only the latest - A token GitHub refuses (401) is forgotten and reads as sign_in_again, so the picker offers a new sign-in, not a Try again that can't work - The checklist shows a failed listing with Try again too, and a failed retry says why (one GithubSyncNotice for both) - The waiting-listings index covers only the waiting rows; docs/deploy.md names both worker commands - The journey allows 1.5 s in the browser with the listing slowed to 8 s
ndbroadbent
force-pushed
the
signin-async-sync
branch
from
December 4, 2026 06:26
313816c to
7e07ef2
Compare
This was referenced Dec 4, 2026
ndbroadbent
added a commit
that referenced
this pull request
Dec 4, 2026
…ete (#172) * Repository picker: the pick stays as it was, with the button on Adding…, until the importer shows * App logo: back to the app's home, and from the app's home on to the site * Organization settings page; setup steps can be shown again once complete * MCP goldens show the checklist's shown state; a too-long name is the refused one * Settings: no sideways scroll on a phone; the getting started box follows the click * Journey: the Projects heading by its exact name * Org page: members live in Settings, no Show setup steps link, the gear alone on a phone; Leave's reason on its own line * Settings: an installation's kind and repositories under its account, so the table fits a phone * MCP goldens after rebasing onto #175: github_sync beside the checklist's shown state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nathan's sign-in on 4 Dec 2026 took about 20 s before app.visualci.com loaded. In the cluster (Envoy's access log, via talira infra),
GET /auth/github/callbackalone took 6,316 ms: it listed every installation's repositories one page at a time (Nathan can reach about 650), rewroteuser_repositoriesa row at a time, and applied memberships, all before redirecting.What changes
/user/emailsonly for a GitHub account no user has yet, so it makes at most 3 GitHub calls (the code exchange,/user, and that). Its counted budget drops from 22 to 1. It logssign-in callbackwithelapsed_msandgithub_calls.SyncGithubAccess(new,forge/sign_in_sync.rs) runs on thesign-inqueue:jsonb_to_recordsetupserts instead of about 650 INSERTs).SignedInso memberships follow.queue:work --queue=sign-in,defaultfor the 3 workers, and a dedicatedworker-sign-inrunning--queue=sign-in(infra cfb7b5f), so a backlog of builds can't hold a sign-in up. The journeys, CI's visual job and the self-hosting docs use the same arguments.users.github_sync_requested_at,github_synced_atandgithub_sync_error.sign_in_sync::statereads them asdone,syncing,failedorsign_in_again; a listing still unfinished after 90 s counts as failed.syncin its JSON):POST /api/ui/github/sync, 6 a minute);github_syncshows "Looking for your GitHub installations…", and the org query polls while syncing./github/setup?refreshed=1(the App-install round trip) shows "Finding your GitHub repositories…" with<meta refresh>until the listing has the installation, or an error with Try again./statusreportsoldest_sign_in_sync_seconds.Tests
github_calls.rs:/user/emails(none when signing in again), and queues one job;1 + SIGN_IN_SYNC_BUDGETcalls, the per-installation counts, statedone;failedand keeps the last one;sign_in_againwithout a token.sign-in-redirects-at-once-and-lists-after:/user/installationsslowed by 3 s, the callback takes under 1 s and makes at most 3 GitHub calls, timed against the stub's new request log;Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.