Skip to content

fix(gateway): drop agent-device instance pins when relaying - #1045

Merged
V3RON merged 1 commit into
mainfrom
fix/gateway-drop-instance-pins
Oct 29, 2026
Merged

V3RON merged 1 commit into
mainfrom
fix/gateway-drop-instance-pins

Conversation

@V3RON

@V3RON V3RON commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

An agent-device client reads GET /health before naming a lease, then pins that daemon's instance id on every request (x-agent-device-instance, x-agent-device-upstream-instance). Through a gateway, RelayHostLink sends the bare /health to the first capable worker. The lease often lands on another worker, whose daemon answers 409 with x-agent-device-instance-mismatch: true, so open fails with "Remote daemon instance changed".

Reproduced in #1009 (one iOS and four Android workers): every iOS open failed.

Fix

RelayHostLink.forward now deletes both pin headers before it relays, as dropInstancePins in front/host-link.ts already does on a worker for its phone daemon. The module manual's gateway flow says so.

This is the gateway commit from #1009 by Julius Marminge, authorship kept; that PR's warm-pool commits are in #1043.

Verification

  • src/agent-device/front/relay-host-link.test.ts: a bare /health probe and a call on a lease, each sent with both pin headers, reach fleet.relay without them. 17 passed.
  • Per fix(gateway): drop agent-device instance pins when relaying #1009: on a one iOS, four Android worker gateway fleet, every lease worked with all workers connected.

Review

Spec review: skipped. Code review: 0 blocking, 0 fixed, 2 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 2.3M.
Runs: 1. Cost USD: 0.1428. Agent seconds: 76.
Assessment: complete

Status

Implement: done Review: round 1, 0 findings Hardware: n/a (verified on a gateway fleet by the author) Gate: running
Next: gate

Written by an agent.

A client reads /health before it names a lease and pins that daemon's
instance id on every later request. The gateway forwards bare requests such
as /health to whichever capable worker it finds first, so with more than one
worker the pin often names a different daemon than the lease's. That daemon
then refuses every call with 409 x-agent-device-instance-mismatch ("Remote
daemon instance changed"), and allocation fails.

Drop x-agent-device-instance and x-agent-device-upstream-instance in
RelayHostLink.forward, as a worker already does for its phone daemon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@V3RON

V3RON commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 00ec5d4

Runs: 1. Cost USD: 0.1428. Agent seconds: 76.
Tokens input 20, output 4073, cache read 288441, cache write 29293.
- review 1 reviewer: claude-sonnet-5-5 76 s $0.1428
Finding outcomes: {}. Classes: {}.
{"findings":[]}

Written by an agent.

@V3RON

V3RON commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

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

  • code: src/agent-device/AGENTS.md step 2 was re-flowed onto one line with no content change.
  • code: gateway-relayed simulator calls now also lose the client's instance pins, matching the phone-lease behaviour in src/agent-device/front/host-link.ts:56; the tradeoff is already documented.
  • code: process — the "PR body" CI check failed (no ## Review, 214 words over the 200 budget); fixed in delivery.

Written by an agent.

@V3RON
V3RON merged commit 0274121 into main Oct 29, 2026
66 of 67 checks passed
@V3RON
V3RON deleted the fix/gateway-drop-instance-pins branch October 29, 2026 09:01
@V3RON

V3RON commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Delivery run

Merged: #1045 (no issue)
Parked: none
Waiting: none
Decided: none

Written by an agent.

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.

2 participants