flybrain/docs
acamilo d06e1cf809 bridge: refresh stored tokens on load before giving up, persist both roles
A stored access token that has expired (obtainmentTimestamp + expiresIn) or
that validate rejects with 401 is now refreshed once through its role's
RefreshingAuthProvider before startup fails, for the bot and broadcaster
roles alike. Refreshes are persisted under the role whose provider made
them (no more scope-set guessing), through one serialized writer, so both
roles reach tokens.json even when they are one account; writes stay
tmp + rename, 0600.

Only a refresh Twitch refuses (4xx, e.g. 400 Invalid refresh token) is
fatal, with one line naming the role and the runbook's re-authorize step.
Twitch errors are logged by status and message only: twurple's
HttpStatusCodeError message carries the refresh grant URL, client secret
and refresh token included, so the entrypoint and EventSub log lines now
redact it.

Tests mock Twitch's validate and token endpoints. Runbook and B1 updated.
2026-09-28 23:47:48 +00:00
..
design bridge: refresh stored tokens on load before giving up, persist both roles 2026-09-28 23:47:48 +00:00
publish flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
architecture-tour.md docs: the engagement rewards, and the v6 migration in deploy examples 2026-09-23 14:34:10 +00:00
control-api.md docs(control-api): the chat ring's sidecar, in the [chat] section 2026-09-22 16:26:29 +00:00
dataset-format.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
feed-protocol.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
integration.md docs: the engagement rewards, and the v6 migration in deploy examples 2026-09-23 14:34:10 +00:00
limitations.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
loop-review.md loop recovery: an escalation ladder that unsticks a trap on its own 2026-09-28 21:23:33 +00:00
model.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
overview.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
plasticity.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
readout.md docs: PROF-02a and RT-01a, the legacy Game Boy composition on the session framework 2026-09-23 08:32:05 +00:00
rewards-learning.md docs: the explore row stays "new place" 2026-09-23 21:23:40 +00:00
stream-mvp-plan.md bridge: refresh stored tokens on load before giving up, persist both roles 2026-09-28 23:47:48 +00:00
streaming-plan.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
verification.md flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00