Skip to content

fix(daemon): status.get shows an agent only its own leases and queue entries - #893

Merged
V3RON merged 2 commits into
security/data-dir-modefrom
security/status-own-leases
Oct 26, 2026
Merged

V3RON merged 2 commits into
security/data-dir-modefrom
security/status-own-leases

Conversation

@V3RON

@V3RON V3RON commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

status.get is an agent operation, and it returned every lease and waiting request to any agent token, with other principals' lease, device and requester ids. Now a non-admin session sees only the leases and waiting requests its principal owns, the rule lease.list already used. Admin sessions (local CLI, operator tokens, the console, a gateway's uplink) see everything, as before.

Changes

  • src/daemon/dispatcher.ts: lease.list and status.get share one owner filter; waiting keeps requests whose recorded owner is the principal.
  • src/gateway/dispatcher.ts: for a non-admin, status.get's leases uses the lease-index lookup lease.list uses, and waiting is filtered by the coordinator's recorded owner. Other fields are unchanged.
  • GET /v1/status OpenAPI notes, four website pages, and the daemon and gateway manuals say so.
  • No contract shape change, so no protocol bump.

Tests

  • src/daemon/dispatcher.test.ts and src/gateway/dispatcher.test.ts: one table each — admin, an agent with a lease and a waiting request, a proxy-style principal, an agent that owns nothing.

Assumptions

  • Assumption: which requests does a gateway agent's waiting list? — only the fleet-queue requests it owns; that list never held workers' queues.
  • Assumption: does the HTTP API reference need a separate edit? — no, the GET /v1/status OpenAPI notes generate that page.

Review

Spec review: skipped. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: skipped.
Rounds: 1. Tokens: n/a.

One combined review by the maintainer's agent on 2026-10-22 (comment below); no blocking findings.

Rebased onto main e1f2f43 on 2026-10-26 as one commit. Conflicts: src/daemon/dispatcher.ts keeps main's new lease.get beside this PR's #leasesFor and #waitingFor; both new dispatcher.test.ts tests kept. src/gateway/AGENTS.md Reads paragraph merges main's lease.get, workerLeaseId and inbox.get with this PR's filtering. remote-agents.mdx keeps main's GET /v1/leases row and adds this PR's GET /v1/status row.

Written by an agent.

@V3RON

V3RON commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Review (maintainer's agent, round 1)

No blocking findings.

  • The worker dispatcher now has one owner filter for lease.list and status.get, so the two cannot drift apart again. Waiting entries are filtered through the queue's recorded owner of the requester, which is the right source since a waiting entry carries no owner field and requesterId is caller-supplied.
  • The gateway path reuses the lease-index lookup lease.list already used, so a worker-local lease whose owner happens to share the caller's name is never shown; the table test pins exactly that case.
  • Nothing in src/contract/ changed, so no protocol bump; the route notes line feeds the generated HTTP reference, and the four website pages that describe agent status output now say the same thing.
  • Switching the existing "waiting matches list.get" test to an admin session is correct: it was asserting fleet-wide content through a caller that owns none of it.

Note, no change needed: the three one-off unit failures across the test:changed runs were different timing tests each time under a load average of about 27 (seven agents building in parallel on this machine) and pass alone; CI on the PR is the arbiter.

@V3RON
V3RON changed the base branch from main to security/data-dir-mode October 23, 2026 06:19
@V3RON
V3RON added this pull request to stack #897 October 23, 2026 06:19
@V3RON
V3RON marked this pull request as ready for review October 26, 2026 09:46
@V3RON
V3RON force-pushed the security/status-own-leases branch from 68ac8fc to 0e26780 Compare October 26, 2026 10:29
@V3RON
V3RON force-pushed the security/status-own-leases branch from 3dcf077 to bd03b8c Compare October 26, 2026 14:25
@V3RON
V3RON merged commit ed886e2 into main Oct 26, 2026
25 checks passed
@V3RON
V3RON deleted the security/status-own-leases branch October 26, 2026 14:26
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