Skip to content

Bridge 2b: GitHub sign-in, contributions and the setup checklist - #6

Merged
KodeStar merged 35 commits into
mainfrom
feat/bridge-2b
Oct 20, 2026
Merged

KodeStar merged 35 commits into
mainfrom
feat/bridge-2b

Conversation

@KodeStar

@KodeStar KodeStar commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Bridge Phase 2b: community contributions (BRIDGE-PLAN.md "Phase 2b") and FIRST-RUN-PLAN F2 (the onboarding checklist).

  • Accounts tab: GitHub device-flow sign-in with the "AudioSilo Contributions" App (client ID only; expiring tokens refreshed single-flight, persisted atomically; sign-out revokes). Agent credential in the vault, handed to the agent container per run (container env/files win). A sign-in or a credential change resumes what was parked on it.
  • Status tab "Get set up" checklist (paired, libraries, ASR, agent, budget, GitHub optional); heartbeat setup block only after the server's accepts, one resend without it on a 400.
  • sidecars.contribute (share a book's local characters and recaps; long recaps to a gist) and meta.correct (file a correction batch). Filed at most once: a filing marker, a lookup that adopts the job's own issue, a one-minute settle, a day-old rule; a corrections request is keyed on the record and its {field, corrected} set, so a retry after a lost answer adopts the issue whatever the evidence.
  • Budget parks: a restart re-admits the ones a changed cap could let through; a raise on the Settings page wakes parked describe jobs; one wording for every kind.
  • "Not signed in" is told apart from "signed in, but GitHub couldn't be reached to refresh".

Gates: go build, vet, go test -race ./..., golangci-lint 0 issues; web typecheck, lint, format, test. Reviews: /simplify and /code-review max on every round.

Verified live against the server branch with a fake GitHub and fake meta: device sign-in/out, setup checklist, share and corrections filing, adopt after a dropped answer (incl. refilled evidence and a retitled work), budget wake on Settings and on restart, sign-in resuming a parked generate job, unrefreshed texts. Owner step: a real sign-in against the real App. Known (follow-up): a restart with a parked generate job posts 1-2 spurious "job failed" bell events.

Pairs with KodeStar/audiosilo-meta#2703, KodeStar/audiosilo-meta-community#428, KodeStar/audiosilo-server#157, KodeStar/audiosilo-frontend#118, #6, KodeStar/audiosilo-docs#150, KodeStar/audiosilo#72.

runner.json advertises handoff; when the container has no credential of its
own for the CLI, the Bridge stages credential/credential.json (its own
non-sticky dir, so the runner can delete it) before request.json. The runner
reads it strictly, deletes it before spawning, and the container's own
credential wins.
contrib.CorrectionBatchIssue maps the server's corrected fields onto meta's
batch vocabulary (title, published and isbn apply automatically; author,
narrator and the series fields go to a maintainer) and renders the form
meta's TestBatchGoldenBody pins. The round-trip test runs it through a real
metaissue.
GitHub sign-in through the GitHub App's device flow (internal/ghauth, a
stdlib leaf; internal/accounts: single-flight refresh sealed before use, any
refresh error or 401 is a refusal, sign-out revokes), the agent's credential
in the vault, and the page's /api/accounts routes. The contribution token
comes from the environment (read live), then the sign-in, then gh; the
github_pat an earlier version sealed is deleted once.

The setup checklist (internal/setup) leads the page's Status and rides the
heartbeat once the server's reply accepts it; a 400 on it resends without.
can_contribute is computed at every beat, the monthly budget is editable on
the page (saving it reviews it) and read live by the engine, and a sign-in
or new agent credential re-admits the books parked waiting for one.
sidecars.contribute shares a book's kept characters and recaps with the
community (pipeline.Executor.Share: the job's work or the book's match,
never a new work; a local or covered row is filed again, a filed issue is
kept). meta.correct files an admin's corrections to the core repo as one
correction-batch issue, once per job (a run stopped mid-filing never files
twice). Both run in the light lane and fail with a sentence when the
Bridge isn't signed in or the book isn't matched.
The page's Accounts tab (#/accounts) signs in to GitHub with the device flow and stores the agent credential for the agent container. The Status tab shows the setup checklist until it is complete, linking each step to its tab, and Settings gains the monthly agent budget.
A create call that outlives the client's timeout may still make the gist or issue, so a retried share or contributing stage filed it again. Each submit now records a filing marker before the call and the next one adopts what the user made since then, filing again only when GitHub's list is complete and holds none.
The engine card says the monthly budget is set on the Settings tab and applies straight away, and each setup step keeps its link beside the text, top-aligned, however its detail wraps.
A share or meta.correct whose earlier try can't be found or ruled out files again once the marker is over a day old by GitHub's clock, rather than failing for good: meta's intake catches a duplicate, and nothing on the page clears a marker. The correct tests pin the fake GitHub's clock.
The budget park hint names the Settings tab, each agent credential shows its own saved time (set_at_by_kind, additive), the GitHub card says either sidecar can need a gist, and the staging order, sign-out order and token source are described as built.
StaleFiling becomes a Client method reading the Client's GitHub clock, so no caller can pass another; the two stale-marker share tests become one table.
Only a list that can't reach back to a day-old marker files again (a refusal, outage or cancel keeps the marker); meta.correct adopts its own issue anywhere in the list and never files past a same-record batch with another body; StaleFiling reads only the clock learned from GitHub. Budget hint names the env caps; doc and comment fixes.
The filing marker is keyed on the book, so a new job after a lost answer adopts the issue the earlier one filed, or finds that batch filed and files its own. A lookup waits a minute before ruling an issue out, a 401 on it is the sign-in refused, and the rows of pages read before one that failed are looked through first, in meta.correct and the share alike. A lost or failed answer is worded for the console.
A sidecars.describe job parked on the monthly budget waits in its own loop, so a budget saved on the page now pokes it to try again, as the engine's parked books are re-admitted.
A sidecars.describe job tries again as the Bridge starts, so a budget raised in config.yaml or the environment needs only the restart. Its park reason and hint now say so; an engine book's (sidecars.generate) still asks for the Retry, since a restart re-admits no budget park.
The console refills the evidence with a default line naming the server version, in the admin's language, each time its dialog opens, so a retry after a lost answer was usually a new request and filed a duplicate without looking. The filing marker's key is now the record (work, recording id, ASIN, ISBN) and the changes as a sorted set of field and corrected value: not the evidence, the source stamp, the region or a change's current value. A new job with other evidence adopts the issue the marker's sum names.
…very job

budget_exceeded joins the parks a daemon start re-admits once, since a cap raised in config.yaml or the environment applies at the start; a book still over its budget parks again in the budget preflight before any spend. The per-kind budget hint and park reasons collapse to one form with no Retry. A GitHub sign-in already resumes the only contrib_unavailable park (a sidecars.generate job's engine book); a test pins it.
The contributing park, the share and suggest-corrections failures and the
contribute=issue pre-check said "isn't signed in" (and the park "then Retry")
even when the Bridge was signed in but GitHub couldn't be reached to refresh
the sign-in. accounts.Token now wraps ErrUnrefreshed, contrib.Resolve answers
ErrSignInUnrefreshed (still an ErrNoCredential) when that sign-in was the only
credential, and each caller words it as "once GitHub can be reached". The
not-signed-in park now says a sign-in carries the book on, matching the server.
…check

The runner sends only a job's latest progress, so an instant fake describer let
the writing, rescanning and done steps replace the describing step (and the
rate-limit park) before the reporting loop sent it when a send was in flight.
The fake now waits, on the job's goroutine, for the fake server to have that
progress before it returns; the checks themselves are unchanged.
@KodeStar
KodeStar merged commit dfde1e3 into main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant