fix(selfhost): make orb-relay-drain resilient to broker degradation - #3984
Conversation
The drain loop's 15s AbortSignal.timeout matched its 15s setInterval, so a degraded broker (slow responses or HTTP 500s) caused overlapping drain calls to pile up and immediate timeouts with no buffer. Raise the request timeout to 30s, add an in-flight guard so a tick is skipped while the previous drain is still running, and match the poll interval to the new timeout. Fixes GITTENSORY-1C.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
1 similar comment
|
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 #3984 +/- ##
=======================================
Coverage 93.70% 93.70%
=======================================
Files 373 373
Lines 35076 35076
Branches 12862 12862
=======================================
Hits 32868 32868
Misses 1584 1584
Partials 624 624
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-07 08:49:11 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 2 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 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.
|
Summary
Authorization: Bearerheader on the Orb broker request entirely, left a duplicatesignalkey, and leftsrc/server.tsin a state that wouldn't even parse (an orphanedif/returnoutside any function, an undefineddrainRelayreference, dangling braces, and the intendedsetIntervalfrequency change landing inside the.catch()handler instead of the interval argument) — which is why every build/typecheck-dependent check on that PR was failing.drainOrbRelay's 15sAbortSignal.timeoutmatched the drain loop's 15ssetInterval, so a degraded broker (slow responses or HTTP 500s) caused overlapping drain calls to pile up, plus immediate timeouts with no buffer.src/orb/broker-client.ts), add an in-flight guard around the drain call so a tick is skipped while the previous drain is still running, and match the poll interval to the new timeout (src/server.ts). TheAuthorizationheader and existing error handling are preserved untouched.Fixes GITTENSORY-1C.
Scope
src/server.tsis codecov-exempt (integration/smoke-tested);src/orb/broker-client.ts's changed line was already covered and no test asserts the literal timeout value.Validation
npx tsc --noEmit— clean.npx vitest run test/unit/orb-broker-client.test.ts test/unit/selfhost-monitored-work.test.ts— 57/57 pass.Safety
Authorization: Bearerheader on the broker request is preserved (the prior automated PR had dropped it).