feat(agent-queue): report concrete engine + Devin session id on release
parse_usage now always emits engine=<engine>, and the devin arm extracts the ATIF export's session_id. fleet-client includes engine + sessionId in the run insights it reports, so the coordinator/UI can show the real engine (not 'unknown') and a session handle for traceability/recovery (devin --resume <id>). 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:
parent
f9be343e32
commit
70c6d47a75
@ -1225,6 +1225,9 @@ recover_orphans() {
|
||||
parse_usage() {
|
||||
local engine=$1 log=$2
|
||||
[[ -f "$log" ]] || return 0
|
||||
# Always report the concrete engine that ran (the coordinator created the run
|
||||
# with the job's abstract engineClass, which is usually 'unknown').
|
||||
echo "engine=$engine"
|
||||
# 1) Generic, explicit usage line (preferred; emitted by any cooperating wrapper).
|
||||
local line; line=$(grep -E '^AQ_USAGE ' "$log" 2>/dev/null | tail -1)
|
||||
if [[ -n "$line" ]]; then
|
||||
@ -1264,6 +1267,10 @@ parse_usage() {
|
||||
dtc=$(grep -oE '"cache_read_tokens"[[:space:]]*:[[:space:]]*[0-9]+' "$exp" | grep -oE '[0-9]+' | awk '{s+=$1} END{print s+0}')
|
||||
dmodel=$(grep -oE '"model_name"[[:space:]]*:[[:space:]]*"[^"]+"' "$exp" | head -1 | sed -E 's/.*:[[:space:]]*"([^"]+)".*/\1/')
|
||||
[[ -n "$dmodel" ]] && echo "model=$dmodel"
|
||||
# Devin session handle — enables traceability/recovery (`devin --resume <id>`).
|
||||
local dsession
|
||||
dsession=$(grep -oE '"session_id"[[:space:]]*:[[:space:]]*"[^"]+"' "$exp" | head -1 | sed -E 's/.*:[[:space:]]*"([^"]+)".*/\1/')
|
||||
[[ -n "$dsession" ]] && echo "session_id=$dsession"
|
||||
[[ "${dti:-0}" -gt 0 ]] && echo "tokens_in=$dti"
|
||||
[[ "${dto:-0}" -gt 0 ]] && echo "tokens_out=$dto"
|
||||
[[ "${dtc:-0}" -gt 0 ]] && echo "tokens_cached=$dtc"
|
||||
|
||||
@ -349,13 +349,16 @@ fleet_report_insights() {
|
||||
metaf="$STATE/$job.meta"
|
||||
jid=$(_meta_val "$metaf" fleet_job_id); epoch=$(_meta_val "$metaf" fleet_lease_epoch)
|
||||
[[ -n "$jid" ]] || return 0
|
||||
local model ti to tc cost turns tools est ins=""
|
||||
local model engine session ti to tc cost turns tools est ins=""
|
||||
model=$(_meta_val "$metaf" model)
|
||||
engine=$(_meta_val "$metaf" engine); session=$(_meta_val "$metaf" session_id)
|
||||
ti=$(_meta_val "$metaf" tokens_in); to=$(_meta_val "$metaf" tokens_out)
|
||||
tc=$(_meta_val "$metaf" tokens_cached); cost=$(_meta_val "$metaf" cost_usd)
|
||||
turns=$(_meta_val "$metaf" turns); tools=$(_meta_val "$metaf" tool_calls)
|
||||
est=$(_meta_val "$metaf" usage_estimated)
|
||||
[[ -n "$model" ]] && ins+=",\"model\":\"$(_json_escape "$model")\""
|
||||
[[ -n "$engine" ]] && ins+=",\"engine\":\"$(_json_escape "$engine")\""
|
||||
[[ -n "$session" ]] && ins+=",\"sessionId\":\"$(_json_escape "$session")\""
|
||||
[[ "$ti" =~ ^[0-9]+$ ]] && ins+=",\"tokensIn\":$ti"
|
||||
[[ "$to" =~ ^[0-9]+$ ]] && ins+=",\"tokensOut\":$to"
|
||||
[[ "$tc" =~ ^[0-9]+$ ]] && ins+=",\"tokensCached\":$tc"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user