feat(agent-queue): honor a job's explicit engine on fleet claim

When materializing a claimed fleet job, write `engine: <pick>` into the job
frontmatter (resolve_engine then runs it). Only a KNOWN engine
(devin/claude/codex/copilot) is honored — never the run's 'unknown'/class
placeholder — so an engineless job still falls back to the factory default
(AGENT_QUEUE_ENGINE). No behavior change for existing jobs.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
saravanakumardb1 2026-06-01 02:30:38 -07:00
parent 70c6d47a75
commit 79e6a8db00

View File

@ -241,7 +241,7 @@ fleet_claim() {
case "$FLEET_CODE" in 2*) :;; *) err "fleet: claim failed (HTTP ${FLEET_CODE:-error})"; return 1;; esac case "$FLEET_CODE" in 2*) :;; *) err "fleet: claim failed (HTTP ${FLEET_CODE:-error})"; return 1;; esac
printf '%s' "$FLEET_BODY" | grep -q '"claimed"[[:space:]]*:[[:space:]]*true' || return 2 printf '%s' "$FLEET_BODY" | grep -q '"claimed"[[:space:]]*:[[:space:]]*true' || return 2
local jid body_md epoch repo base_branch verify automerge="" local jid body_md epoch repo base_branch verify automerge="" engine_pick
jid=$(printf '%s' "$FLEET_BODY" | _json_str id) jid=$(printf '%s' "$FLEET_BODY" | _json_str id)
body_md=$(printf '%s' "$FLEET_BODY" | _json_str bodyMd) body_md=$(printf '%s' "$FLEET_BODY" | _json_str bodyMd)
epoch=$(printf '%s' "$FLEET_BODY" | _fleet_json_num leaseEpoch) epoch=$(printf '%s' "$FLEET_BODY" | _fleet_json_num leaseEpoch)
@ -249,6 +249,11 @@ fleet_claim() {
base_branch=$(printf '%s' "$FLEET_BODY" | _json_str baseBranch) base_branch=$(printf '%s' "$FLEET_BODY" | _json_str baseBranch)
verify=$(printf '%s' "$FLEET_BODY" | _json_str verify) verify=$(printf '%s' "$FLEET_BODY" | _json_str verify)
printf '%s' "$FLEET_BODY" | grep -q '"autoMerge"[[:space:]]*:[[:space:]]*true' && automerge=true printf '%s' "$FLEET_BODY" | grep -q '"autoMerge"[[:space:]]*:[[:space:]]*true' && automerge=true
# Concrete engine the submitter picked (job.engine wins over engineClass via
# resolve_engine). Only honor a KNOWN engine — never the run's 'unknown'/class
# placeholder — so an engineless job still falls back to the factory default.
engine_pick=$(printf '%s' "$FLEET_BODY" | _json_str engine)
case "$engine_pick" in devin | claude | codex | copilot) ;; *) engine_pick="" ;; esac
[[ -n "$jid" ]] || { err "fleet: claim returned no job id"; return 1; } [[ -n "$jid" ]] || { err "fleet: claim returned no job id"; return 1; }
# Materialize a transient local job .md (same approach as from-tracker) so the # Materialize a transient local job .md (same approach as from-tracker) so the
@ -264,6 +269,7 @@ fleet_claim() {
echo "yolo: true" echo "yolo: true"
echo "fleet-job-id: $jid" echo "fleet-job-id: $jid"
echo "fleet-lease-epoch: ${epoch:-0}" echo "fleet-lease-epoch: ${epoch:-0}"
[[ -n "$engine_pick" ]] && echo "engine: $engine_pick"
[[ -n "$repo" ]] && echo "fleet-repo: $repo" [[ -n "$repo" ]] && echo "fleet-repo: $repo"
[[ -n "$base_branch" ]] && echo "fleet-base-branch: $base_branch" [[ -n "$base_branch" ]] && echo "fleet-base-branch: $base_branch"
# Per-repo verify command (drives the existing verify gate) + auto-merge flag. # Per-repo verify command (drives the existing verify gate) + auto-merge flag.