fix(issue-50, issue-55): onboarding and dispatch wait by the registry, one pane claim per server; tests stay out of the real agent homes #56

Merged
Godopu merged 17 commits from fix/issue-50-55 into main 2026-10-12 12:38:55 +00:00
2 changed files with 10 additions and 3 deletions
Showing only changes of commit 9e78ff3ba3 - Show all commits

No files matched your search

@@ -528,6 +528,12 @@ EOF
--role "$display_role" \ --role "$display_role" \
--status "pending" --status "pending"
# The reset above is a redispatch: it issued this attempt's token. Read it
# now, so a close from the waits below (busy, idle_wait) names this
# attempt, not the previous phase's (review reviewer-grok-01)
local _disp_tok=""
_disp_tok="$("$PY" -c "import json, os; p=os.path.join('$REGISTRY_DIR', '$JOB_ID.json'); print(json.load(open(p)).get('dispatch_token','') or '') if os.path.exists(p) else print('')" 2>/dev/null || true)"
# Registry wait (Issue #50), then idle wait - on the record just reset to # Registry wait (Issue #50), then idle wait - on the record just reset to
# pending for this phase, so the waiter's signal is written and other # pending for this phase, so the waiter's signal is written and other
# waiters see this job in the FIFO (review F1) # waiters see this job in the FIFO (review F1)
@@ -546,9 +552,6 @@ EOF
fi fi
fi fi
local _disp_tok=""
_disp_tok="$("$PY" -c "import json, os; p=os.path.join('$REGISTRY_DIR', '$JOB_ID.json'); print(json.load(open(p)).get('dispatch_token','') or '') if os.path.exists(p) else print('')" 2>/dev/null || true)"
# Start subscriber # Start subscriber
local logf="$REGISTRY_DIR/${JOB_ID}.iter_${iteration}_${display_role}.subscriber.out" local logf="$REGISTRY_DIR/${JOB_ID}.iter_${iteration}_${display_role}.subscriber.out"
local loop_sub_args=(--attempt-id "$attempt" --ack-timeout "$TIMEOUT") local loop_sub_args=(--attempt-id "$attempt" --ack-timeout "$TIMEOUT")
+4
View File
@@ -285,6 +285,10 @@ def test_s1_both_dispatch_paths_wait_by_the_registry_before_the_idle_wait():
# phase (review F1): a terminal self record cannot carry the signal (u3c) # phase (review F1): a terminal self record cannot carry the signal (u3c)
assert src.count('--status "pending"') == 1 assert src.count('--status "pending"') == 1
assert src.index('--status "pending"') < loop assert src.index('--status "pending"') < loop
# ... and reads the token that reset issued before it waits: a busy or
# idle_wait close from phase two on must carry this attempt's token
tok = src.index('_disp_tok="$(', src.index('--status "pending"'))
assert src.index('--status "pending"') < tok < loop
body = src.split("_registry_wait() {")[1].split("\n}\n")[0] body = src.split("_registry_wait() {")[1].split("\n}\n")[0]
assert "wait-open-jobs" in body and 'finalize_unfinished "$job_id" "error" "$SUB_RC_ERROR" "registry_wait"' in body assert "wait-open-jobs" in body and 'finalize_unfinished "$job_id" "error" "$SUB_RC_ERROR" "registry_wait"' in body
assert "exit 5" in body and "mam_int_knob MAM_DISPATCH_WAIT_S 600 0" in body assert "exit 5" in body and "mam_int_knob MAM_DISPATCH_WAIT_S 600 0" in body