Skip to content

[P2] Bound TCP operations by an end-to-end deadline including name resolution #70

Description

@wsdt

Audit: 2026-09-05, commit 2b3b1ee24da2.
Classification: Static performance/reliability finding; proposed stronger deadline contract. Priority: P2.

Finding

The explicit Rust TCP provider uses a 30-second timeout per address attempt and per socket read/write, but has no aggregate operation deadline.

In src/network_provider/tcp.rs, to_socket_addrs() runs synchronously before any timeout, each address gets a fresh SOCKET_TIMEOUT, and write_all can perform several writes. Consequently “30 seconds” is not a bound on the total connect/send operation. This is a static finding; no slow external endpoint was contacted during the audit.

The evaluator's fuel budget limits language steps, not time spent in an injected provider. docs/BOUNDED-LANGUAGE-NETWORK-IO-V1.md currently documents blocking sockets and an explicitly injected provider, so treat this as a deliberate contract extension rather than a claim of a sandbox escape.

Proposed slice

Add one caller-selected monotonic deadline policy for an invocation or operation, with a safe fixed maximum. Cover resolution, all address attempts, partial writes, reads, and readiness waits. Name resolution must use an explicitly injected bounded resolver or an independently owned cancellable worker; a detached resolver thread is not cancellation. Propagate remaining duration instead of restarting the full timeout per sub-operation.

Keep the fixture provider deterministic, and retain no-network behavior when no provider is granted. Audit the generated native networking implementation for the equivalent timeout contract; do not claim parity from the Rust seam alone.

Acceptance criteria

  • Several failing candidate addresses cannot multiply the aggregate connection budget.
  • Slow DNS resolution and a trickle-writing peer terminate under the declared aggregate bound.
  • Interrupted system calls preserve the same deadline and selected failure.
  • Timeout/cancellation leaves no retained connection or unmanaged resolver task.
  • Scripted resolver/socket/clock tests cover budget boundaries without waiting 30 seconds each.
  • A small explicit loopback integration test verifies the real adapter.
  • Documentation distinguishes per-syscall timeout, operation deadline, and invocation budget. Do not promise forced cancellation where the selected host cannot enforce it.

Agent handoff

Recheck the working revision and existing issues first. Read AGENTS.md, the relevant completion-matrix row, and the owning versioned specifications. This proposed slice must preserve canonical source, independent replay, precise target admission, and separately granted authority. Place regressions in the existing owning harness. Execute the applicable quality gates and record what actually ran; unrun native, hosted, or device evidence must stay unpromoted.

Later source recheck

At e1c5b5622678, the same resolver/per-address timeout chain remains in connect_socket. The new TLS client/server paths add handshakes, so their lifecycle must also receive an explicit aggregate deadline. The separate Reqwest HTTPS client has its own configured request timeout; this finding does not assert that it inherits the raw TCP timeout defect. No live slow-endpoint test was run.

Audit revision scope

Runtime observations in this ticket belong to commit 2b3b1ee. A final source-tree comparison against e1c5b56 was used to check for obvious superseding changes. That later snapshot was not rebuilt or exhaustively retested. Reproduce on the intended fixing revision before implementation.

Audit ID: SPX-AUDIT-20260905-11

Suggested scope: L. Dependencies: None required.

Activity

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