Skip to content

Add --priority to sair-acquire so bot PRs can queue behind human ones - #60

Open
compscidr wants to merge 1 commit into
mainfrom
feat/acquire-priority
Open

compscidr wants to merge 1 commit into
mainfrom
feat/acquire-priority

Conversation

@compscidr

Copy link
Copy Markdown
Owner

Client side of compscidr/sair-ochestrator#582.

  • AcquireLockRequest.priority (int32, field 7): higher is served first, ties are FIFO, 0 is exactly today's behaviour so existing callers are unaffected.
  • sair-acquire --priority N, validated as a 32-bit integer, sent as the priority query param.
  • Proxy plumbs it HTTP → ScopedPortManager.AcquireCommandRouter.AcquireLock → gRPC, same shape as run_url.

Typical use in a workflow: sair-acquire --count 1 --priority ${{ github.actor == 'dependabot[bot]' && -1 || 0 }}.

The orchestrator side (queue ordering in DeviceLockManager) follows in a separate PR that pulls this proto from main.

🤖 Generated with Claude Code

Closes compscidr/sair-ochestrator#582 on the client side: a new int32
priority on AcquireLockRequest (higher first, FIFO within a value, 0 is
today's behaviour), plumbed from sair-acquire through the proxy's HTTP
API to the orchestrator.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 12, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new priority plumbing lacks a success-path HTTP API unit test verifying a valid ?priority= value is forwarded into the acquire call.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a priority concept to SAIR lock acquisition so automated/bot jobs can wait behind human-driven jobs while devices are busy, by plumbing the value from sair-acquire → proxy HTTP API → proxy internals → orchestrator gRPC request.

Changes:

  • Add AcquireLockRequest.priority (int32) to the orchestrator proto and forward it from the proxy’s gRPC request.
  • Add sair-acquire --priority N with 32-bit integer validation and send it as a priority query parameter.
  • Update docs and add/extend unit tests for priority validation/forwarding in the proxy layer.
File summaries
File Description
tools/sair-acquire Adds --priority flag, validates int32 range, and forwards as priority query parameter
README.md Documents --priority usage and a suggested GitHub Actions expression for bots
proto/orchestrator/orchestrator.proto Adds AcquireLockRequest.priority field (int32, field 7)
internal/proxy/scoped_port.go Extends ScopedPortManager.Acquire to accept/forward priority
internal/proxy/http_api.go Parses priority query param (int32 range) and forwards into acquire call
internal/proxy/http_api_test.go Adds validation test cases for invalid/oversized priority
internal/proxy/command_router.go Extends AcquireLock to accept priority and set it on gRPC request
internal/proxy/command_router_test.go Asserts priority is forwarded into AcquireLockRequest
internal/proxy/adb_connection_remote_test.go Updates AcquireLock call sites for new signature
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 75 to 80
{"non-numeric count", "?count=abc", "count parameter must be a non-negative integer"},
{"negative count", "?count=-1", "count parameter must be a non-negative integer"},
{"count with serial", "?count=1&serial=DEVICE_A", "count and serial parameters are mutually exclusive"},
{"non-numeric priority", "?priority=high", "priority parameter must be a 32-bit integer"},
{"oversized priority", "?priority=2147483648", "priority parameter must be a 32-bit integer"},
}
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