banditcallback: shorten default TTL to 60s for absence-detection heartbeat#670
Merged
Conversation
…tbeat The lantern-cloud API now interprets absence of arm callbacks as a negative reward signal for the EXP3 bandit. That's the only signal the API can synthesize for censorship blocking: when a proxy is IP-blocked, SNI-blocked, or DPI-dropped at the network layer, the proxy itself sees nothing — the client never reaches it. Only the silence of expected heartbeats reveals the event. For absence to be detected promptly, the emitter must re-fire callbacks on a short cadence while a device is actively using the proxy. Drop the default TTL from 10 min to 60 s; the API-side heartbeat window is 90 s, so a healthy 60s-cadence device always lands before the absence-reaper deadline with ~30 s of jitter slack. Operators who pinned --banditcallbackttl explicitly are unaffected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--banditcallbackttlfrom 10m to 60s so the emitter re-fires per-device callbacks on a short cadence.Why
The API previously had only a one-shot positive signal per (arm, device) — no way to learn from failure. For a circumvention proxy that's a serious gap: when the proxy is IP-blocked / SNI-blocked / DPI-dropped, the proxy itself sees nothing because the client never reaches it. Only absence of expected heartbeats can reveal the censorship event.
The fix is two-sided: the API tracks a deadline per (arm, device) and turns missed heartbeats into a flat negative EXP3 reward; the proxy must re-emit on a short cadence so absence is detected within ~minutes, not hours. This PR is the proxy half.
API heartbeat window is 90s; 60s here leaves ~30s of slack for scheduling/network jitter.
Test plan
go test ./banditcallback/...green🤖 Generated with Claude Code