Skip to content

feat(agent-device): the front refuses requests that reach past the agent's device - #507

Merged
V3RON merged 14 commits into
task/474from
task/475
Oct 13, 2026
Merged

V3RON merged 14 commits into
task/474from
task/475

Conversation

@V3RON

@V3RON V3RON commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #475

Status

Implement: done (314/314 unit) Review: passed (round 2 + 2 fix checks; 1 test fix unreviewed) Hardware: n/a Gate: waiting for the stack
Next: merge with the #466 stack

Done when

  • Every Tests line above passes with pnpm exec vitest run --project unit src/agent-device/edge.test.ts. Checked: the src/agent-device unit run is green.
  • A request refused by each of rules 1 to 9 shows the refusal in the test output and no matching entry in FakeAgentDevice's received requests. Checked: the audit broke each rule once, and each break failed its own test.
  • A sharded test with no --device reaches FakeAgentDevice with the token's leased devices of its platform as its device. Checked: the rule 10 tests.

Assumptions

  • Assumption: the front passes the diagnostics route's session name through unchanged, so the test uses session tok_one:s1 (decided in delivery, pending the maintainer; see the Decision taken comment).
  • Assumption: AgentDeviceHost takes the leased platforms as a platforms constructor argument. It is the smallest way to let the front pick a sharded test's devices by platform without a new lookup.
  • Assumption: a device key is any string of 1 to 128 characters (maintainer's choice, 2026-10-13).

Review

Spec review: 2 blocking, 2 fixed, 1 notes. Code review: 10 blocking, 10 fixed, 3 notes. Claims review: 1 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 8.6M.

Fixed unreviewed: a test for an empty device key (edge.test.ts).

Rejected:

  • code: allocate.ts:325 the "absent target reads as mobile" rule is decided twice — not blocking: both places give the same answer today, and no rule is broken

Written by an agent.

V3RON added 5 commits October 13, 2026 12:11
…nt's device, and devices lists only its own (#475)
…ent's device, and devices lists only its own (#475)

2 failing -> 1 failing. Adds route and RPC method lists, the request rules,
the devices filter, and the platform list on the host status. The streamed
progress test installs an upload now, since an install without one is refused
by rule 8. The diagnostics route test still fails: the proxy answers 401 for a
session not named <tenant>:<session>.
…ck and a malformed batch (#475)

1 failing -> 1 failing. HTTP-API.md lists the new messages and the devices
filter; COMPONENTS.md names the new front and wire parts. The remaining
failure is the diagnostics route test, which sends session s1 where the
proxy needs <tenant>:<session>.
…o keep complexity down (#475)

1 failing -> 1 failing.
@V3RON

V3RON commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Decision taken

Question: the spec's test sends GET /sessions/s1/requests/r1/diagnostics and expects it to reach agent-device. The vendored @agent-device/proxy refuses a diagnostics session not named <tenant>:<session> with 401 before it reaches agent-device, so that test cannot pass as written.

Options:

  1. The front passes the session name through unchanged, and the test uses tok_one:s1. Agents see what agent-device's proxy does today: an un-prefixed session name gets 401.
  2. The front adds the tenant prefix to the session name. Agents could send s1, but the front would rewrite a path it otherwise only filters, and this code would have to follow any future change in how the proxy names sessions.

Taken: 1. It matches what agent-device does today, adds no code, and is the easiest to undo.

Reverting: add the prefix mapping in the front's diagnostics route, and change the test back to s1.

Written by an agent.

V3RON added 4 commits October 13, 2026 12:22
…the front passes through (#475)

1 failing -> 0 failing
…; a devices list with a non-object answers empty (#475)
…ey bound, and tests that prove the front's refusals and fills (#475)
@V3RON

V3RON commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

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

  • spec: src/agent-device/front/request-rules.ts:258 rule 10 fills the device of an ended lease still in the map for capabilities and doctor, which need no lease and may run on a device already re-leased
  • code: src/agent-device/front/request-rules.ts:157 if catalog.get fails, a correct leased model such as --device "iPhone 17 Pro" is refused with "simlock picks the device" instead of a retryable failure
  • code: src/agent-device/front/request-rules.ts:203 deviceKey is checked separately in meta, flags and input; a correct meta.deviceKey with a different flags.deviceKey is refused though agent-device reads meta first
  • code: src/agent-device/front/allocate.ts:325 "absent target reads as mobile" is decided twice (also request-rules.ts:229)

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 13, 2026 11:12
@V3RON
V3RON added this pull request to stack #508 October 13, 2026 11:12
@V3RON
V3RON merged commit 4996f3d into main Oct 13, 2026
22 checks passed
@V3RON
V3RON deleted the task/475 branch October 13, 2026 15:33
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 agent-device front refuses requests that reach past the agent's device, and devices lists only its own

1 participant