Skip to content

feat(tunnel): simlock tunnel forward reaches a leased device's port from the caller's machine - #1127

Merged
V3RON merged 152 commits into
callstackincubator:mainfrom
leonardoxr:task/1115
Nov 1, 2026
Merged

V3RON merged 152 commits into
callstackincubator:mainfrom
leonardoxr:task/1115

Conversation

@leonardoxr

@leonardoxr leonardoxr commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1115

Status

Implement: done Review: fix-check passed (round 1, round 2, fix-check), 5 fixed Hardware: pass at ac517aa (4/4 across a full run and one re-run after an emulator boot hang, #1183) Gate: running

Done when

  • The Tests lines pass: src/daemon/tunnel-cli.e2e.test.ts, src/cli/tunnel.test.ts, src/tunnel/worker.test.ts, src/drivers/android/index.test.ts. — run in the fix runs; CI on the head
  • e2e/slow-android-tunnel.test.ts passes in the slow lane with a gateway and a worker on one machine: simlock tunnel reverse <p> forward <q>; the device fetches the caller's page on <p>; a device-side server started with (printf 'device-ok'; sleep 30) | nc -l -p <q> after the tunnel prints its lines answers device-ok to a client on the caller's localhost:<q> that retries its connect until it succeeds, for at most 5 s, and receives the bytes that client sends. — slow lane at ac517aa, 2026-11-01: full file 3/4 (this test passed; the lone-worker test hit a boot timeout, Android: a stale emulator crash dump makes every boot wait on a crash-report dialog until the lease times out #1183), then the lone-worker test alone passed; 4/4 at the head
  • The CLI reference describes forward. — cli.mdx, checked by the claims review

Assumptions

  • Assumption: how the slow-lane test observes "receives the bytes that client sends" — the device server redirects nc's output to a file the test reads back; the spec's command is otherwise unchanged.
  • Assumption: wording of the new usage and BAD_REQUEST messages and the RESET reasons (timeout, adb's own closed) — the spec fixes the codes, not the text; chose short messages matching the existing ones.

Review

Spec review: 2 blocking, 2 fixed, 0 notes. Code review: 2 blocking, 2 fixed, 1 notes. Claims review: 1 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 43.4M.
Runs: 25. Cost USD: 16.0376. Agent seconds: 10324.

Rejected:

Assessment: complete

Written by an agent.

leonardoxr and others added 30 commits October 31, 2026 00:50
…els and gets READY, and a device connection arrives as OPEN with its bytes as DATA (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ctions as OPEN and DATA (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ED and close 4003 (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…de and close 4003 (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tation, and is refused (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r and gets ROTATION_UNSUPPORTED naming it (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…blet simulator (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s and gets INPUT_UNAVAILABLE with the reason (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… when the helper or the write fails (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…esh helper; a socket open during a rotate keeps its helper (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…credit pausing only its connection (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…credit (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… a closed connection is ignored (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s sockets and device.rotate (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…when the socket closes, the lease ends or the daemon stops (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…gets the op's output (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…a tunnel's rules and close its connections (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rotate (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ugh a gateway (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… may (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… worker (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eway (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…wn message (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…he unknown message (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ller's lease id (callstackincubator#1107)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
V3RON added 7 commits November 1, 2026 10:52
# Conflicts:
#	src/contract/AGENTS.md
#	src/contract/protocol.ts
#	src/daemon-protocol/index.test.ts
#	src/daemon/AGENTS.md
#	src/daemon/main.ts
#	src/drivers/android/index.test.ts
#	src/drivers/android/index.ts
#	src/modules/AGENTS.md
#	src/modules/testing.ts
#	website/src/content/docs/docs/reference/errors.mdx
# Conflicts:
#	src/input/AGENTS.md
#	src/modules/AGENTS.md
# Conflicts:
#	src/cli/AGENTS.md
#	src/cli/index.test.ts
#	src/cli/index.ts
#	src/cli/remote-lease.ts
#	src/cli/tree.ts
#	src/daemon/lease-inputs.test.ts
#	src/gateway/fleet-coordinator.ts
#	website/src/content/docs/docs/reference/cli.mdx
…y: data both ways, lease end, worker stop, tunnels off, a quiet tunnel kept open (callstackincubator#1110)
…th --lease and closed stdin, the worker is joined before leasing, the serial comes from the lease, cleanup nukes on the worker (callstackincubator#1110)
V3RON added 9 commits November 1, 2026 19:02
…y: data both ways, lease end, worker stop, tunnels off, a quiet tunnel kept open (callstackincubator#1110)
…th --lease and closed stdin, the worker is joined before leasing, the serial comes from the lease, cleanup nukes on the worker (callstackincubator#1110)
… 5 s, create the forward rule the test checks is gone; fix the 257th-connection claim
…ot once adb answers; release returns before the reclaim ran
@V3RON

V3RON commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • code: src/cli/commands/tunnel.ts:534 on macOS a caller port another process holds on 0.0.0.0 or ::1 still binds on 127.0.0.1, so the CLI prints its forward line instead of TUNNEL_CALLER_PORT_IN_USE; the cause is the shared listener factory (src/ports/tcp-listener.ts:33-37), outside this diff

Written by an agent.

@V3RON V3RON added the needs-hardware PR parked: a Done when line needs a real simulator or emulator run. label Nov 1, 2026
@V3RON V3RON removed the needs-hardware PR parked: a Done when line needs a real simulator or emulator run. label Nov 1, 2026
@V3RON
V3RON merged commit 9c3f869 into callstackincubator:main Nov 1, 2026
73 of 75 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.

simlock tunnel forward: reach a leased device's port from the caller's machine

2 participants