Skip to content

feat(tunnel): the gateway relays the tunnel socket to the lease's worker - #1125

Merged
V3RON merged 50 commits into
callstackincubator:mainfrom
leonardoxr:task/1113
Nov 1, 2026
Merged

V3RON merged 50 commits into
callstackincubator:mainfrom
leonardoxr:task/1113

Conversation

@leonardoxr

@leonardoxr leonardoxr commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1113

Status

Implement: done Review: round 2 passed, 1 fixed Hardware: n/a Gate: running

  • The Tests lines pass; openapi.test.ts shows the route's 503 TUNNEL_UNAVAILABLE and WORKER_UNREACHABLE. — CI on the reviewed head; src/tunnel/gateway.test.ts, src/input/gateway.test.ts and src/http/openapi.test.ts run in the fix runs
  • The remote-agents page describes tunnels through a gateway, with the capability on both sides. — remote-agents.mdx and configuration.mdx, checked by the claims review

Assumptions

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 1 fixed, 1 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 33.7M.
Runs: 9. Cost USD: 3.7555. Agent seconds: 1459.
Assessment: complete

Written by an agent.

leonardoxr and others added 30 commits October 31, 2026 00:51
…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>
…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>
…when the socket closes, the lease ends or the daemon stops (callstackincubator#1112)

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>
… 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>
… loopback listener and removes it on close (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…'s refusal reaches the holder with its code (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ction past 256 is closed (callstackincubator#1112)

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

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…layed to the lease's worker (callstackincubator#1113)

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

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…older's socket 4003 through a gateway (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…h its code and reason (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ed 4003 through a gateway (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ly on a device proved its own (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…and closed 4003 through a gateway (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
leonardoxr and others added 9 commits October 31, 2026 01:33
…or#1112)

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…al to 2 s (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the gateway keeps it from the holder (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…E are in the OpenAPI document (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e manual describe tunnels through a gateway (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@leonardoxr
leonardoxr marked this pull request as ready for review October 31, 2026 04:45
@leonardoxr

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Written by an agent.

… manual budgets (callstackincubator#1112)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@leonardoxr

leonardoxr commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 690b688
Round 2: 6c894eb

Runs: 9. Cost USD: 3.7555. Agent seconds: 1459.
Tokens input 250, output 71905, cache read 5628896, cache write 587108.
- fix implementer: claude-sonnet-5-5 120 s $0.2703
- review 1 reviewer: claude-sonnet-5-5 418 s $0.3537
- review 1 spec: claude-sonnet-5-5 38 s $0.3009
- review 1 code both: claude-opus-5-5 328 s $1.4307
- review 1 claims: claude-sonnet-5-5 53 s $0.2144
- fix 1 implementer: claude-sonnet-5-5 197 s $0.2916
- review 2 reviewer: claude-sonnet-5-5 171 s $0.1855
- review 2 code both: claude-opus-5-5 106 s $0.5797
- review 2 claims: claude-sonnet-5-5 28 s $0.1287
Finding outcomes: {"fixed":1}. Classes: {"architecture 10":1}.
{"findings":[{"id":"R1","role":"code","class":"architecture 10","outcome":"fixed","path":"src/tunnel/gateway-link.ts","round":"1","fix":"6c894eb6a9d7e4a3870802fcc3011a15792878f5"}]}

Written by an agent.

leonardoxr and others added 4 commits October 31, 2026 02:17
… rules at start, name the call in refusals (callstackincubator#1112)

A removal that fails keeps the loopback listener reserved and the device's
reclaim frees it; the start sweep only reads a leased device's rules and
reserves their ports; refusal texts follow the spec's shared values; a
cancelled TcpStream no longer closes its readable twice.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lementation with input (callstackincubator#1113)

Merge origin/task/1112. One src/modules/relay-channel.ts now holds the channel
framing, channelSocket, the close mapping and the refusal bodies that input and
tunnel each copied; the tunnel's coded relay failure answers 503 like input's.
Tests: the gateway aborts the relay when the holder closes, when a worker frame
is over the limit and when an upgrade is abandoned. The tunnel config row says
a gateway serves it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ay channel names it (callstackincubator#1113)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
V3RON added 5 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
@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/input/gateway-link.ts input's onClose now also deletes an empty socket set from the lease map, as tunnel already did; the client sees no difference

Written by an agent.

@V3RON
V3RON merged commit a345362 into callstackincubator:main Nov 1, 2026
53 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.

The gateway relays the tunnel socket to the lease's worker

2 participants