fix(issue-50): the loop path reads this attempt's token before it waits (review reviewer-grok-01)

The `--status pending` reset is a redispatch and issues a new dispatch
token, but the loop read `_disp_tok` only after the registry and idle waits.
A busy or idle_wait close from phase two on therefore carried the previous
phase's token and the engine refused it, leaving the record pending while
the caller saw session_busy. The read now follows the reset directly; s1
pins reset < token read < registry wait.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-10-10 18:14:48 +00:00
1 parent 3705bc72a8
commit 9e78ff3ba3
2 files changed
+10 -3

No files matched your search

+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)
assert src.count('--status "pending"') == 1
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]
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