revert(orb): drop the redundant cloud token-cache; keep the timeout bumps - #1640
Conversation
…umps The self-host engine already caches brokered tokens in Redis (redis-token-cache.ts, wired in server.ts) — the right layer (no broker round-trip on a hit, survives restarts, mints ~hourly). #1634's cloud-side cache in brokerOrbToken was therefore redundant, did a wasteful per-call D1 write, and its read never hit in prod (always fell through to a fresh mint). Restore brokerOrbToken to mint-on-call. KEEP the useful parts of #1634: BROKER_TIMEOUT_MS=25s (broker-client.ts) + createOrbInstallationToken's 25s mint timeout (app-auth.ts). The migration-0081 cached_token_json column stays (already applied; an applied migration can't be dropped without a gap) — now an unused, harmless column.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review — held for maintainer review
⏸️ Held for maintainer review Review summary
Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. Focused, clean revert of the D1-backed cloud token cache introduced in #1634. `brokerOrbToken` is restored to mint-on-call with a single `last_token_at` update; `readCachedOrbToken`, `cacheOrbToken`, `touchLastToken`, and the `decryptSecret`/`encryptSecret` imports are all removed without residue. The rationale is sound — the self-host Redis cache is strictly better (no broker round-trip on a hit, survives restarts, mints ~hourly), and the D1 cache never hit in prod. Leaving `cached_token_json` in the applied migration is the only correct choice given contiguity. The nine surviving broker tests cover every reachable branch of the restored function. Nits (4)
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1640 +/- ##
=======================================
Coverage ? 95.53%
=======================================
Files ? 204
Lines ? 22093
Branches ? 7981
=======================================
Hits ? 21106
Misses ? 412
Partials ? 575
🚀 New features to boost your workflow:
|
Summary
Reverts the cloud-side brokered-token cache added in #1634. It turned out to be the wrong layer: the self-host engine already caches brokered tokens in Redis (
redis-token-cache.ts, wired inserver.ts— confirmed live), which is strictly better — no broker round-trip on a hit, survives restarts, and mints from GitHub only ~hourly. The cloud cache was therefore redundant, did a wasteful per-call D1 write, and its read never hit in prod (it always fell through to a fresh mint — benign, but dead weight).brokerOrbTokenis restored to mint-on-call (the engine's Redis cache keeps that ~hourly, so no throttling). Kept the genuinely useful parts of #1634:BROKER_TIMEOUT_MS=25s(engine,broker-client.ts) andcreateOrbInstallationToken's 25s mint timeout (app-auth.ts) — those tolerate a slow cold mint and are unrelated to the cache.The migration-0081
cached_token_jsoncolumn is left in place: it's already applied to prod and an applied migration can't be removed (contiguity), so the now-unused column simply stays (harmless).Scope
broker.ts+ its test; keep the timeout bumps).site//CNAME/Pages; followsCONTRIBUTING.md.Validation
git diff --check·actionlint·db:migrations:check·typechecktest:coverage—broker.tsrestored to its pre-fix(orb): cache brokered installation tokens to stop GitHub token-mint throttling #1634 form (covered by the existing 9 broker tests: valid mint, invalid/revoked enrollment, ineligible install + the endpoint flows); the cache tests are removed with the cache.test:workers·build:mcp·test:mcp-pack·ui:*·npm audit --audit-level=moderateIf any required check was skipped, explain why:
Safety
Notes
gittensory-api, auto-deploys on merge). The engine's Redis token cache is the real caching layer (per feat(orb): pull-mode relay delivery for NAT/tailnet self-hosts #1639 pull-mode work).