From 214b1ebca2f5d51fe7a5329ede34e8443546f304 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Sun, 20 Sep 2026 12:24:23 +0800 Subject: [PATCH] fix(daemon): let navigation timeout results outlive the transport deadline navigate, navigate_back, navigate_forward, reload and wait_for_navigation resolve with a structured result at their own timeout_ms: reached "timeout", the URL the page actually reached and the last observed lifecycle. The daemon dispatched them with a transport deadline equal to that same timeout, so the extension's reply still had to cross the socket after the deadline had fired. The reply then took the TimedOutAfterResponse path, which preserves completed results only for session_stop, tab_borrow, request_help and the effect-aware transfers, so the caller received a bare "tool RPC timed out" instead. Grant these five methods the EXTENSION_RESPONSE_GRACE that upload, download and request_help already use. They are the complete set of tools whose extension handler resolves with "reached: timeout" at a caller-supplied deadline; every other tool is unchanged. --- crates/bsk-cli/src/daemon/ipc.rs | 39 ++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/crates/bsk-cli/src/daemon/ipc.rs b/crates/bsk-cli/src/daemon/ipc.rs index 288a0d3f..3c479d16 100644 --- a/crates/bsk-cli/src/daemon/ipc.rs +++ b/crates/bsk-cli/src/daemon/ipc.rs @@ -62,9 +62,12 @@ pub type RpcHandler = Arc< >; const DEFAULT_RPC_TIMEOUT: Duration = Duration::from_secs(15); -// The upload transaction owns its operation deadline and may need a bounded -// cleanup before it can return a useful structured error. Keep only that -// transport alive slightly longer so it does not replace the result. +// Some tools own their operation deadline and answer exactly at it: the file +// transfers need a bounded cleanup before they can return a useful structured +// error, request-help settles its own wait, and the navigation waits report +// `reached: "timeout"` with the URL the page actually reached. Keep those +// transports alive slightly longer so the transport deadline cannot replace a +// result the extension has already produced. const EXTENSION_RESPONSE_GRACE: Duration = Duration::from_secs(2); /// Upper bound on `wait_for_browser_ms` accepted over IPC. const MAX_BROWSER_WAIT: Duration = Duration::from_secs(60); @@ -799,7 +802,14 @@ fn tool_dispatch_transport_timeout(method: &Method, params: &Value) -> Result