Skip to content

aac run / aac connect hang indefinitely when the relay accepts the connection but never responds; --timeout does not apply #161

Open

Description

@larancibia

Version: aac 0.11.0 (3b000d1), official Linux x86_64 release binary. Self-hosted relay (ap-proxy built from the same tag). Also reproduced on main at 5127562, built locally, against a TCP listener that accepts the connection and never answers the WebSocket upgrade.

What happens

With a saved connection, if the relay stops responding (process stalled, but the TCP port still accepts connections), aac run --timeout 8 ... never returns. It prints nothing and does not exit; I had to kill it after 40 seconds. Reproduced 3 out of 3 times.

By contrast, when the listener side is the one that stops responding, the same command exits after ~8 s with Timeout: Timeout waiting for credential response (exit code 3), as expected.

Steps to reproduce

  1. Run a relay, a listener and a remote client on a private network; pair them and confirm aac run --domain <d> --timeout 8 --env VAR=password -- <cmd> works.
  2. Freeze the relay process without closing its socket (e.g. docker pause <relay> or kill -STOP <pid>).
  3. Run the same aac run --timeout 8 ... command.

Expected: an error and a non-zero exit code within a bounded time.
Actual: no output, no exit.

Likely cause (from reading the code, not confirmed with a debugger)

--timeout is documented as "Timeout in seconds for credential response" and only bounds request_credential. The WebSocket connection itself is opened with connect_async(...) and awaited with no time limit (crates/ap-proxy-client/src/protocol_client.rs in v0.11.0; the same call is in crates/ap-relay-client/src/protocol_client.rs on main). The steps after it already have fixed limits (5 s for relay authentication, and timeouts around pairing), so the unbounded part appears to be just the connect/upgrade.

Why it matters

aac run is meant for unattended callers (agents, CI). A caller that passes --timeout reasonably expects the command to be bounded; today a stalled relay blocks it forever.

Possible fix

Wrap connect_async in tokio::time::timeout with a default (optionally exposed as a --connect-timeout flag), mapping expiry to the existing connection-failed error and exit code. A patch with a regression test is available at https://github.com/larancibia/agent-access/tree/fix/relay-connect-timeout (one commit on top of main). Pull requests on this repository are limited to collaborators, so I could not open one; feel free to take the patch, or let me know if you would rather I submit it another way.

Activity

  1. bitwarden-bot commented on Nov 13, 2026

    @bitwarden-bot

    Thank you for reporting this issue! We've added this to our internal tracking system.
    ID: PM-46941
    Link (for internal use): https://bitwarden.atlassian.net/browse/PM-46941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions