Skip to content

fix(discord-bot): persist T3 bearer and keep local bootstrap past 24h - #414

Merged
patroza merged 2 commits into
fork/devfrom
t3code/fix-discord-bot-local-bootstrap
Aug 20, 2026
Merged

patroza merged 2 commits into
fork/devfrom
t3code/fix-discord-bot-local-bootstrap

Conversation

@patroza

@patroza patroza commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Omegent on t3vm failed with T3 did not become ready after a server restart because the Discord bot re-exchanges local-bootstrap-credential on every process start, and that grant was seeded with the desktop 24h TTL. After t3code-server had been up more than a day, a bot-only restart (or a deploy that restarted only the bot) looped invalid_credential forever.

  • Keep the desktop IPC bootstrap seed at 24h.
  • Seed the file-backed local grant with a long-lived TTL (colocated trusted clients).
  • Persist the 30-day bearer under the bot data dir and reuse it on the next start; clear and re-bootstrap if T3 rejects it.
  • Also include basename asar unpack globs (*.node as well as **/*.node) so packWindowsServerAsar still creates server.asar.unpacked on hosts where @electron/asar 3.4 does not treat ** as nested.

Test plan

  • PairingGrantStore local-file grant still consumes after 25h and 400d
  • Desktop IPC grant still expires after 24h
  • Persisted bearer reuse / host mismatch / remaining-time floor / disk round-trip
  • T3Session existence contract for persist + invalid_credential fallback
  • build-desktop-artifact Windows asar unpack tests
  • t3vm: rebuilt dist, restarted server then bot; new Discord bot session issued 2026-08-20 06:49 UTC and HTTPS / is 200 again

The colocated Discord bot re-exchanges local-bootstrap-credential on every
restart. PairingGrantStore seeded that file with the desktop 24h TTL, so a
bot-only restart more than a day after t3code-server start failed forever
with invalid_credential.

Keep the desktop IPC seed at 24h. Give the file-backed local grant a
long-lived TTL, and persist the 30-day bearer so restarts do not depend on
re-bootstrap.
@electron/asar 3.4's unpack matcher does not treat **/*.node as matching
nested files on this host, so packWindowsServerAsar failed its unpacked-dir
check in the local ship gate. Include basename globs too so both dialects
unpack.
@patroza
patroza marked this pull request as ready for review August 20, 2026 07:05
@patroza
patroza merged commit 8cf087c into fork/dev Aug 20, 2026
6 of 10 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