GitHub¶
Connect a GitHub App installation, browse and import issues, watch pull
requests and run the reconcile poll. GitHub sync
explains the pipeline; Connect GitHub covers
setup. Source: services/github/github.jac.
Result shapes¶
Apart from GithubStatus, every walker here reports one dict with ok.
error |
status |
When |
|---|---|---|
not_connected |
0 |
No installation token could be minted |
network |
0 |
GitHub could not be reached |
rate_limited |
403 |
GitHub's rate limit is exhausted |
unauthorized |
401 |
The installation token was refused. Marks the connection invalid. |
forbidden |
403 |
Any other 403 |
not_found |
404 |
Missing, or not visible to the installation. Marks the connection invalid. |
invalid |
422 |
GitHub rejected the request |
request_failed |
other | Any other non-2xx response |
message is GitHub's own message where it sent one. Exception text, headers
and raw bodies never cross back.
Connection¶
GithubStatus¶
Cheap, no GitHub call: every page showing GitHub UI opens with it.
Body field: none.
Reports one GithubConnectionView, with no
GitHub call. Pages open with the same view on
GetWorkspace; this is the read after a disconnect
or a sync.
configuredandmissing_configsay whether the server has the five App variables, and which are missing.statusisokorinvalid(a reconnect is needed).webhook_seen_atis when a delivery for this installation last arrived; the GitHub section's connection strip shows "Live ยท last event N ago" from it.
It also re-binds a valid connection whose gh_installations row is missing.
StartGithubInstall¶
Hands back the install URL carrying a one-shot nonce, stored server-side and burned on use so a forged callback cannot bind another installation.
Body field: none.
Reports {"ok": true, "url": "https://github.com/apps/<slug>/installations/new?state=<nonce>"},
or {"ok": false, "error": "not_configured", "message": "...", "missing": [...]}.
Stores a one-shot nonce on the workspace's GithubConnection (creating it on
first use). Calling it again replaces the nonce, so only the newest link works.
CompleteGithubInstall¶
Finish the round trip GitHub redirected back from. Two checks before anything is stored: the nonce matches the one this workspace issued (CSRF), and the GitHub user can actually see the claimed installation, since installation ids are small integers a forged link could otherwise pick.
| Body field | Type | Default |
|---|---|---|
code |
str |
"" |
installation_id |
int |
0 |
state |
str |
"" |
Called by the page when GitHub redirects back with installation_id, code and
state. Call it once per redirect: the OAuth code is single-use.
Reports {"ok": true, "connection": GithubConnectionView} or one of these
errors, checked in this order (the nonce is burned before the first check):
error |
Meaning |
|---|---|
no_pending_install |
No install was started from this workspace |
bad_state |
state does not match the stored nonce |
expired |
More than 15 minutes since StartGithubInstall |
invalid |
No installation id |
exchange_failed |
GitHub would not exchange the OAuth code (usually: OAuth during installation is off) |
not_yours |
The authorizing GitHub user cannot see that installation |
On success it binds the installation to this workspace, replacing any other workspace's binding, and unbinds a previous installation this workspace held.
DisconnectGithub¶
Forgets the installation. Imported tasks and their links stay: they are this workspace's own data, not GitHub's.
Body field: none.
Reports {"ok": true, "disconnected": true}, also when nothing was
connected. Forgets the installation, its cached token, its index row and its
queued deliveries. Repos, their flags, tasks and task links stay.
Browsing GitHub¶
ListGithubRepos¶
One GitHub page (100) of the repos this installation was granted,
filtered by query after the fetch, so a page under a query can run
short. attached marks the ones already tracked in the workspace;
has_more says whether GitHub holds another page.
| Body field | Type | Default |
|---|---|---|
query |
str |
"" |
page |
int |
1 |
Reports {"ok": true, "rows": [GhRepoRow], "page": n, "has_more": bool}.
One GitHub page (100 repos) granted to the installation, sorted by name.
query filters that page by substring after the fetch, so a filtered page can
be short. attached marks repos already added to a project.
ListRepoIssues¶
One page of a repo's issues. Page 1 comes from the page the sync
stored (synced_at, stale) and never calls GitHub; refresh or a
later page reads GitHub, and page 1 then replaces the stored one.
A foreign repo jid reports an empty page rather than an error: it leaks nothing about whether the id exists, and burns no GitHub quota.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
state |
str |
"open" |
page |
int |
1 |
refresh |
bool |
False |
Reports {"ok": true, "rows": [GhIssueRow], "page": n, "has_more": bool,
"synced_at": "...", "stale": bool}, 50 per page. state is open, closed
or all. Page 1 is the page the scheduled sync
stored for that state (synced_at is empty when none is stored yet, stale
past 20 minutes) and makes no GitHub call; refresh: true or page > 1 reads
GitHub, and page 1 then replaces the stored one. Pull requests are dropped
from GitHub's issues list, so pages can be short. already_imported and
imported_task_id point at the task that holds the issue. A foreign repo_id
reports an empty page without calling GitHub.
ListRepoPulls¶
One page of a repo's pull requests, served the way ListRepoIssues is:
page 1 from the store unless refresh, later pages from GitHub.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
state |
str |
"open" |
page |
int |
1 |
refresh |
bool |
False |
Reports the same shape with [GhPrRow] rows and the same stored-page
rule. state on each row is open, draft, closed or merged, and
linked_task_id finds a task by PR number or by a pasted PR link.
SearchRepoItems¶
One page of GitHub search results scoped to one repo. kind picks issues
or PRs; rows use the list walkers' shapes. GitHub allows ~30 searches a
minute, so the client only calls on an explicit action. Foreign repo: empty.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
kind |
str |
"issues" |
query |
str |
"" |
state |
str |
"open" |
page |
int |
1 |
GitHub search scoped to one repo, returning the same row shapes as the two list
walkers. kind is issues or pulls.
Reports {"ok": true, "rows": [...], "page": n, "has_more": bool}. A blank
query or foreign repo reports an empty page with no GitHub call. GitHub allows
about 30 searches a minute, so the client only searches on an explicit action.
Importing and writing¶
ImportIssues¶
Turn chosen issues into tasks, once each: (gh_repo, gh_issue_number) is
the identity. Closed issues land on the done step, the rest on the chosen
step; step_id wins over status, which only applies with no flow line.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
numbers |
list[int] |
[] |
project_id |
str |
"" |
status |
str |
"Backlog" |
step_id |
str |
"" |
Turns chosen issues into tasks, once each (the repo and issue number are the identity).
Reports {"ok": true, "imported": [TaskView], "skipped": [n], "failed": [n]},
or {"ok": false, "error": "not_found" | "project_required" | "not_connected", ...}.
- Up to 25 numbers per call.
- The task goes under
project_idif given, otherwise the repo's project. - Open issues land on
step_id(orstatus, defaultBacklog); closed issues land on the done step. - Title, body (first 2,000 characters), labels as tags, and assignees matched
to members by
github_usernameare copied. The log recordsImported from GitHub org/repo #nfor a single issue, or grows the day'sImported N issues from org/repoline for more. skippednumbers are already held by a task;failedones errored or are pull requests.
curl -X POST $BASE/walker/ImportIssues -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"repo_id": "<repo-id>", "numbers": [41, 42, 57], "status": "Backlog"}'
CreateIssueFromTask¶
Open a GitHub issue for this task. The one and only write to GitHub, and one-way: later task edits never touch the issue.
| Body field | Type | Default | Description |
|---|---|---|---|
task_id |
str |
"" |
from find_task |
repo_id |
str |
"" |
Opens a GitHub issue for a task. One way: later task edits do not touch the issue.
Reports {"ok": true, "task": TaskView}, or an error dict
(already_linked, not_found, not_connected, invalid, or a GitHub
failure). Nothing is reported for an unknown or foreign task_id.
The issue body is the task's notes plus a "Tracked in Flowline." footer; the
task gets the issue number, state and link, and the log records
Opened GitHub issue org/repo #n.
Per-repo policy¶
SetRepoAutoSync¶
Turn auto-filing of new issues on or off for one repo. Enabling clears the cursor so the next sync backfills the repo's history; the (gh_repo, gh_issue_number) identity keeps re-runs duplicate-free.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
enabled |
bool |
False |
Reports {"ok": true, "repo": RepoView} or
{"ok": false, "error": "not_found", "message": "Unknown repo."}.
Turning auto_sync on ("Import issues into project" in the GitHub section) clears the
repo's cursor, so the next sync back-fills its issue history.
SetRepoAutoDone¶
Per-repo policy: a merged PR or a closed issue moves the linked card to the done step on the next sync. Off, the board only shows nudges.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
enabled |
bool |
False |
Reports {"ok": true, "repo": RepoView} or not_found. With auto_done
on ("Move a card to Done when its issue closes or its pull request merges"), a
closed issue or a merged PR (on a card In Progress or in Review) moves the card
to the done step.
SetRepoLabelSync¶
Per-repo policy, off by default: a move across an arrow with a GitHub
label writes that label to the issue or its PR, and leaving a step takes
off the labels not kept. Turning it on creates the flow line's labels in
the repo, coloured like their steps; labels says how many were new.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
enabled |
bool |
False |
Reports {"ok": true, "repo": RepoView, "labels": <n>} or not_found.
With label_sync on ("Add the flow line's labels as work moves"), a move
across an arrow with a GitHub label adds it (to the linked PR when the arrow
carries a PR, else the issue), and leaving a step takes off the labels of the
arrows into it that are not kept. Turning it on creates every label the flow
line names in the repo, coloured like the step its arrow leads into; labels
counts the new ones (a label the repo has is left as it is, and -1 means
GitHub could not be written to). Writes need the App's Issues: read and write.
SetRepoAutoClose¶
Per-repo policy, the reverse of auto_done and off by default: a card landing on Done closes its GitHub issue and one leaving Done reopens it. The receiver drops the App's own echo, so neither is applied twice.
| Body field | Type | Default |
|---|---|---|
repo_id |
str |
"" |
enabled |
bool |
False |
Reports {"ok": true, "repo": RepoView} or not_found. With auto_close
on ("Close the issue when its card moves to Done" in the GitHub section), MoveTask and
UpdateTask close the linked issue when a card lands on Done and reopen it when
the card leaves Done.
Reconcile¶
SyncGithub¶
One bounded increment of the GitHub sync. Every tracked repo's issues
stream (issues AND pull requests, oldest update first) is read from the
repo's cursor and each item goes through apply_issue_item or
apply_pr_item; the call stops at the page or time budget with has_more.
The schedule runs it with auto; the Sync buttons run it by hand.
| Body field | Type | Default | Description |
|---|---|---|---|
auto |
bool |
False |
|
page_budget |
int |
0 |
Pages this call may read, clamped to SYNC_PAGE_BUDGET; 0 means the cap. |
full |
bool |
False |
Re-walk every tracked repo from its first issue: the update path then corrects what an earlier import stamped. One call resets the cursors; the rounds that follow continue from where it stopped. |
One bounded increment of the reconcile poll: drain the webhook queue, then read
each tracked repo's issues and pull requests updated since its cursor. The
server schedule runs it
with auto: true every 5 minutes per connected workspace; the Sync buttons run
it by hand, which also holds the workspace's sync lease for 4 minutes so the
schedule stays out of the way.
Reports not_connected, or:
{
"ok": true, "linked": 12, "refreshed": 3, "auto_added": 1, "auto_done": 1,
"scanned": 140, "pages": 2, "drained": 4, "unfiled": 0, "lists": 2,
"cooldown_minutes": 15.0, "has_more": false, "failure": "",
"last_sync_at": "2026-09-15T08:12:33.123456Z"
}
| Field | Meaning |
|---|---|
linked |
Linked tasks the pass looked at: issues and PRs on the pages it read and in the deliveries it drained (it looks tasks up per page, never the whole workspace) |
refreshed |
State, assignee and PR changes applied |
auto_added |
Issues filed as new tasks (auto_sync repos) |
auto_done |
Cards moved to done |
scanned, pages |
GitHub items read and list requests made |
drained |
Queued webhook deliveries applied |
unfiled |
New issues on auto_sync repos that have no project |
lists |
Tracked repos whose stored open issue and pull request pages were rewritten (a pass that reached the end of every stream) |
cooldown_minutes |
15 while deliveries are flowing, otherwise 1 |
has_more |
The page budget (5 by default, page_budget lowers it) or the 8 second clock ran out: call again |
failure |
GitHub's message when a request failed, else empty |
With auto: true, a call inside the cooldown reports all zeros and the
previous last_sync_at, and mints no token. A manual sync (auto: false)
ignores the cooldown. An invalid connection reports {"ok": false, "error":
"invalid"}.