Skip to content

Fix interactive tunnel latency and bound connection setup - #10

Merged
acking-you merged 1 commit into
masterfrom
fix/interactive-tunnel-latency
Sep 9, 2026
Merged

Fix interactive tunnel latency and bound connection setup#10
acking-you merged 1 commit into
masterfrom
fix/interactive-tunnel-latency

Conversation

@acking-you

@acking-you acking-you commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

Interactive RPC traffic can stall on the local TCP legs of a tunnel even when the relay sockets already use TCP_NODELAY. Subscriber-to-relay and publisher-to-service connection attempts can also outlive the SDK's control I/O deadline. This fixes both issues found while investigating Pocket-Codex session switching.

Related Issues

Companion Pocket-Codex fix: acking-you/pocket-codex#92.

Change Type

  • Bug fix

What Changed

  • Disable Nagle on both local TCP forwarding legs, with a socket-level regression test.
  • Bound subscriber relay connections and publisher local-service connections with the existing control I/O timeout and error type.
  • Exclude credentials from the subscriber tracing span.
  • Exercise a 20 MiB transfer followed by 200 small request/response exchanges on the same connection, in both plaintext and codec modes, including half-close and trailing data.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — 207 passed, 3 ignored; the subsequently added tcp_forward_disables_nagle_on_the_local_leg test also passed.
  • Manual verification completed

The tunnel integration tests measured small-message P95 around 2.1 ms in both codec modes after the large transfer. A combined build with the Pocket-Codex fixes completed 300 real bridge session switches over a local relay on one WebSocket with zero disconnects: median 13.8 ms, P95 45.5 ms, maximum 63.3 ms.

Compatibility / Risk

No wire-format, CLI, or dependency-version changes. TCP connection attempts now fail within the existing control I/O deadline. Disabling Nagle can increase packet counts for small writes.

The session benchmark used isolated historical fixtures and warm local caches; it is not a public-network latency guarantee or an isolated measurement of the Nagle change. The fixed commit is also available on the dedicated pocket-codex branch. Companion PR acking-you/pocket-codex#92 consumes that Git branch, with the exact commit pinned in Cargo.lock, so it does not need to wait for a registry release.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@acking-you
acking-you merged commit f0ed427 into master Sep 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant