recv: None = peek, positive value = opt-in long-poll
old behavior: omitted wait_seconds fell through to the 30s RECV_LONG_POLL_DEFAULT — claude calling 'is there anything in my inbox right now?' between actions blocked the turn for half a minute. flip the semantics: None (or 0) returns immediately, positive value parks up to MAX (180s, unchanged). cleaner 'peek vs wait' distinction; tool descriptions + agent/manager prompts updated to point at the new shape. harness's own serve loops in hive-ag3nt + hive-m1nd relied on the old default for their inbox poll. they now explicitly pass wait_seconds: Some(180) to opt into the full park — same effective behavior as before, just spelled out. retires the matching TODO under Turn loop.
This commit is contained in:
parent
90df2106bf
commit
06af23c8a4
9 changed files with 53 additions and 45 deletions
|
|
@ -81,19 +81,20 @@ async fn serve(stream: UnixStream, agent: String, coord: Arc<Coordinator>) -> Re
|
|||
}
|
||||
}
|
||||
|
||||
/// Default and max long-poll window for `Recv`. Caller can request a
|
||||
/// shorter (or longer up to `RECV_LONG_POLL_MAX`) wait via the
|
||||
/// `wait_seconds` field; values above the cap are clamped. 180s
|
||||
/// max keeps us under typical TCP/proxy idle limits while letting
|
||||
/// agents park their turn until a message lands instead of busy-
|
||||
/// looping with short waits.
|
||||
const RECV_LONG_POLL_DEFAULT: std::time::Duration = std::time::Duration::from_secs(30);
|
||||
/// Max long-poll window the caller can ask for; values above the
|
||||
/// cap are clamped. 180s keeps us under typical TCP/proxy idle
|
||||
/// limits while still letting agents park their turn until a
|
||||
/// message arrives. Omitting `wait_seconds` (or passing `0`) means
|
||||
/// "peek, don't wait" — claude can call recv whenever it wants a
|
||||
/// cheap "is there anything pending?" check without blocking the
|
||||
/// turn for 30 seconds. To actually park, the caller passes a
|
||||
/// positive `wait_seconds`.
|
||||
const RECV_LONG_POLL_MAX: std::time::Duration = std::time::Duration::from_secs(180);
|
||||
|
||||
fn recv_timeout(wait_seconds: Option<u64>) -> std::time::Duration {
|
||||
match wait_seconds {
|
||||
Some(s) => std::time::Duration::from_secs(s).min(RECV_LONG_POLL_MAX),
|
||||
None => RECV_LONG_POLL_DEFAULT,
|
||||
None => std::time::Duration::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,15 +69,16 @@ async fn serve(stream: UnixStream, coord: Arc<Coordinator>) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Default and max long-poll window for manager `Recv`. Caller can
|
||||
/// request a shorter or longer (up to MAX) wait via `wait_seconds`.
|
||||
const MANAGER_RECV_LONG_POLL_DEFAULT: std::time::Duration = std::time::Duration::from_secs(30);
|
||||
/// Max long-poll window for manager `Recv`. Same semantics as the
|
||||
/// sub-agent socket: omitted `wait_seconds` (or `0`) = peek and
|
||||
/// return immediately, positive value = park up to that many
|
||||
/// seconds (clamped at MAX).
|
||||
const MANAGER_RECV_LONG_POLL_MAX: std::time::Duration = std::time::Duration::from_secs(180);
|
||||
|
||||
fn manager_recv_timeout(wait_seconds: Option<u64>) -> std::time::Duration {
|
||||
match wait_seconds {
|
||||
Some(s) => std::time::Duration::from_secs(s).min(MANAGER_RECV_LONG_POLL_MAX),
|
||||
None => MANAGER_RECV_LONG_POLL_DEFAULT,
|
||||
None => std::time::Duration::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue