You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read-idle timeout on the agenticd connection loop #119
The carved-out slice of audit finding #5 (the rest is deferred to the backlog issue #118, decided on #109): give the connection read/dispatch/write loop a read-idle deadline so a peer that opens a socket and never completes a frame can't hold a spawn_local task forever.
Scope:
Apply a bounded read-idle timeout around read_frame_bytes in handle_connection (crates/agenticd/src/server.rs:140). On timeout, log (with peer_uid) and close the connection — the same log-and-close shape the FrameError::TooLarge arm already uses (no correlation_id available for a structured reply mid-frame).
Pick a generous default (a slow but legitimate first frame must not trip it); make it a const with a comment, tunable later.
The idle timeout resets per successful frame so a long-lived connection issuing well-spaced requests is unaffected.
Tests: a peer that connects and sends nothing (or a partial frame) is dropped after the deadline; a peer sending well-spaced complete frames is not dropped.
Resolution records: PR link, the chosen timeout value, test names.
What landed:handle_connection wraps each read_frame_bytes in a per-frame READ_IDLE_TIMEOUT (30s); on elapse it log-and-closes with peer_uid (same shape as the oversize-frame arm). The clock resets per frame, so well-spaced-within-window connections are unaffected. Injected via handle_connection_with_idle_timeout so tests use a short deadline.
Chosen value: 30s — generous enough that a slow legitimate first frame won't trip it; idle-beyond-window connections just reconnect (cheap over a Unix socket).
Scope held: no connection/per-UID caps, rate budgets, or queue metrics — those stay in backlog #118 per the #109 decision.
Tests:idle_connection_is_dropped_after_deadline (connect-and-send-nothing dropped with "idle" error), well_spaced_frames_are_not_dropped (Pings spaced within the window survive, clean close returns Ok). Both avoid tokio::spawn since the handler future isn't Send. Workspace tests + clippy + fmt green.
Activity
tonibergholm commentedon Jul 10, 2026
Resolution
Shipped as PR #123 (pending review/merge).
What landed:
handle_connectionwraps eachread_frame_bytesin a per-frameREAD_IDLE_TIMEOUT(30s); on elapse it log-and-closes withpeer_uid(same shape as the oversize-frame arm). The clock resets per frame, so well-spaced-within-window connections are unaffected. Injected viahandle_connection_with_idle_timeoutso tests use a short deadline.Chosen value: 30s — generous enough that a slow legitimate first frame won't trip it; idle-beyond-window connections just reconnect (cheap over a Unix socket).
Scope held: no connection/per-UID caps, rate budgets, or queue metrics — those stay in backlog #118 per the #109 decision.
Tests:
idle_connection_is_dropped_after_deadline(connect-and-send-nothing dropped with "idle" error),well_spaced_frames_are_not_dropped(Pings spaced within the window survive, clean close returns Ok). Both avoidtokio::spawnsince the handler future isn'tSend. Workspace tests + clippy + fmt green.Add a read-idle timeout to the agenticd connection loop (#123)