Compare commits

...
Author SHA1 Message Date
MoepchiandClaude Opus 5.5 5e7add6dc8 Drain queued packets before audio ticks in the connector
After a stall (CPU steal on the host), the missed 20 ms ticks fire in a
burst. With an unbiased select a tick could run before the already
received voice packets were processed, find an empty queue and play Opus
loss concealment, which sounds like a slowed-down tape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-10-16 08:18:20 +00:00
MoepchiandClaude Opus 5.5 983ce1e105 Rejoin the last channel after an automatic reconnect
A dropped gateway connection reconnected with the original connect
parameters, so everyone landed in the server's default channel again.
The reconnect now aims at the channel the user was in ("/<id>"), with
its cached password if one was entered.

The client log also records why a gateway connection ended: the
WebSocket close code, or the keepalive watchdog firing. Until now a drop
left no trace on the client side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-10-15 12:14:12 +00:00
MoepchiandClaude Opus 5.5 7d14c3409e Wait longer for the release preview image before giving up
GitHub's image service answered 429 for the whole 20 seconds after the
v0.16.0-beta.5 release, so the Bluesky post went out without a card. Back
off 15/30/45/60 s and honor Retry-After (capped at 60 s), which fits in
the job's 5-minute timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-10-11 15:24:01 +00:00
3 changed files with 31 additions and 6 deletions

No files matched your search

+11 -4
View File
@@ -47,16 +47,23 @@ def xrpc(method: str, payload: dict | bytes, token: str | None = None, content_t
return json.load(res)
def fetch(url: str, retries: int = 2) -> tuple[bytes, str]:
def fetch(url: str, attempt: int = 1) -> tuple[bytes, str]:
req = urllib.request.Request(url, headers={"User-Agent": "webspeak3-release-announcer"})
try:
with urllib.request.urlopen(req, timeout=30) as res:
return res.read(), res.headers.get_content_type()
except urllib.error.HTTPError as err:
if err.code != 429 or not retries: # GitHub's image service throttles bursts now and then
# GitHub's image service throttles right after a release, often for over a minute.
# 15+30+45+60 s stays well inside the job's 5-minute timeout.
if err.code != 429 or attempt > 4:
raise
time.sleep(10)
return fetch(url, retries - 1)
wait = 15 * attempt
retry_after = err.headers.get("Retry-After", "")
if retry_after.isdigit():
wait = min(int(retry_after), 60)
print(f"Preview image throttled (429), retrying in {wait} s.")
time.sleep(wait)
return fetch(url, attempt + 1)
def link_card(release: dict, text: str) -> dict:
+4
View File
@@ -1148,6 +1148,10 @@ async fn run(args: Args) -> Result<()> {
loop {
let mut events = con.events();
let outcome = tokio::select! {
// After a stall (e.g. CPU steal) the missed audio ticks fire in a burst.
// Polling in order drains the queued packets first, otherwise a tick can
// find an empty queue and play Opus loss concealment instead.
biased;
line = stdin_lines.next_line() => LoopOutcome::StdinLine(line),
ev = events.next() => LoopOutcome::ConEvent(ev),
_ = audio_ticker.tick() => LoopOutcome::AudioTick,
+16 -2
View File
@@ -8000,14 +8000,17 @@ function AppInner() {
// detach and run the drop handling right away.
socket.onmessage = socket.onerror = socket.onclose = null;
socket.close();
logClient("warning", "Connection", `No keepalive from the gateway for ${KEEPALIVE_TIMEOUT_MS / 1000} s`);
current().onclose();
}, KEEPALIVE_TIMEOUT_MS);
}
if (event.data !== KEEPALIVE_MESSAGE) current().onmessage(event);
};
socket.onerror = () => current().onerror();
socket.onclose = () => {
socket.onclose = (event) => {
clearTimeout(watchdog);
// 1000/1001 are clean closes; 1006 means the link died without a close frame.
logClient("info", "Connection", `Gateway connection closed (code ${event.code ?? "?"})`);
current().onclose();
};
};
@@ -8113,7 +8116,7 @@ function AppInner() {
// network blip, or the page coming back from being backgrounded/suspended
// — without disturbing which tab is active or losing chat/scroll history.
const reconnectSession = (sessionId: string) => {
const params = sessionParamsRef.current.get(sessionId);
let params = sessionParamsRef.current.get(sessionId);
const rec = sessionsRef.current.get(sessionId);
if (!params || !rec) return;
// Already open or mid-(re)connect — nothing to do.
@@ -8121,6 +8124,17 @@ function AppInner() {
return;
}
// Come back in the channel we were in, like the native client does. Kept
// in the params so a failed attempt (empty client list) still aims there.
const isActive = sessionId === activeSessionIdRef.current;
const state = isActive ? { clients, ownClientId } : rec.parked;
const lastChannel = state?.clients.find((c) => c.id === state.ownClientId)?.channel;
if (lastChannel) {
const cachedPassword = isActive ? channelPasswordCacheRef.current.get(lastChannel) : undefined;
params = { ...params, defaultChannel: `/${lastChannel}`, channelPassword: cachedPassword ?? params.channelPassword };
sessionParamsRef.current.set(sessionId, params);
}
logClient("info", "Connection", `Reconnecting to ${params.host}…`);
const socket = DEMO_MODE ? new DemoSocket() : new WebSocket(GATEWAY_URL);
rec.socket = socket;