You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c3639c5
Browse filesBrowse the repository at this point in the historyBrowse files
| Event interleaving | Competing completion, cancellation, abandonment, and new delegation calls |
55
-
56
-
The model has three fixed task slots, enough to cover competing siblings and a nested parent-child-grandchild chain. It explores every reachable interleaving through depth 13, deduplicating canonical states. Representative checks also exercise rejected operations that do not create a new state: a second concurrent delegation while the first child is active, stale completion after re-delegation, late completion after abandonment, completion after interruption, and nested completion. Named semantic landmarks require the graph to retain interrupted-child re-delegation, nested delegation, and an explicitly resumed interrupted child delegating to a grandchild even when the raw state total changes. The resume action calls the production reducer and carries a model-only provenance bit so the explorer can distinguish that path from a child that was never interrupted; generic persisted transitions still reject `interrupted → active`.
| Pending-action settlement |`TaskHistoryStore.clearPendingActionIfMatching` compare-and-clear in the rejected-delegation settlement path (#1714) |
53
+
| Atomic event step |`atomicReadAndUpdate`, `atomicUpdatePair`, `atomicUpdateParentDelegation`, the parent-file-locked resume, and the per-parent delegation transition lock |
54
+
| Event interleaving | Competing completion, cancellation, abandonment, resume, and new delegation calls|
55
+
56
+
The model has three fixed task slots, enough to cover competing siblings and a nested parent-child-grandchild chain. It explores every reachable interleaving through depth 13, deduplicating canonical states. Representative checks also exercise rejected operations that do not create a new state: a second concurrent delegation while the first child is active, stale completion after re-delegation, late completion after abandonment, completion after interruption, and nested completion. Named semantic landmarks require the graph to retain interrupted-child re-delegation, nested delegation, and an explicitly resumed interrupted child delegating to a grandchild even when the raw state total changes. The resume action calls the production `resumeInterruptedChild` composition, which validates the parent's delegation pointer before applying the child reducer, and carries a model-only provenance bit so the explorer can distinguish that path from a child that was never interrupted. Generic persisted transitions still reject `interrupted → active`. A `resume-stale` rejected action covers the competing-host class: after the parent re-delegates elsewhere, the parent-locked ownership check rejects the resume and every record stays unchanged.
57
57
58
58
Each task slot can also hold one of two pending `create_subtask` actions. A `stage` action mirrors `setPendingTaskAction` overwrite semantics, delegation clears the action its request carried, completion clears the child's action only when its event carries the matching action ID, and a `settle-rejected` action models the settlement that follows an authoritative delegation rejection (#1714). Production settles through the typed `LifecycleTransitionError` from the shared guards: the provider calls the disk-authoritative `TaskHistoryStore.clearPendingActionIfMatching` compare-and-clear under the per-file lock, then propagates the original rejection. Six named witnesses must remain reachable: settlement from an interrupted record after rejection, settlement through a successful active delegation, unrelated-action preservation during completion, stale-action protection where a settlement targeting one action ID leaves a replacement action intact, matching-ID completion clearing, and replacement-ID completion preservation. A mismatched pending-action request keeps its production behavior: the atomic update throws before any transition, and no settlement runs.
59
59
60
60
Production completion also accepts a recovery-compatible `active` parent that still awaits the returning child, then clears the stale pointers. Normal model transitions never create that intermediate state, so it is covered by a focused reducer test rather than admitted as a generally valid reachable state.
61
61
62
-
Explicit resume compares the caller's expected parent with the authoritative child backlink under the child-file lock. Abandonment writes child detachment before parent release, so a stale approval is rejected even in that partial-write window. Representative reducer scenarios cover stale linked and standalone approvals; a two-store provider test covers abandonment after the parent precheck. Rehydrated interrupted tasks omit lineage from message metadata saves, preventing their stale construction snapshots from restoring severed links after rejection. This closes abandonment-before-resume, not every cross-host ordering: parent-only redelegation, reverse-order stale abandonment, and other live-task writers remain within the ownership/generation gaps below.
62
+
Explicit resume validates both records under file locks. A linked child resume holds the parent file's advisory lock across the parent ownership check and the child activation, so a competing host cannot re-delegate the parent in between. The re-delegation write (`atomicUpdateParentDelegation`) re-reads the awaited child's on-disk record inside the parent-file lock and rejects the delegation unless that child is still interrupted. The two guards share one lock order, parent file before child file, so they close the competing resume and re-delegation interleavings in both directions. The child-file merge still compares the caller's expected parent with the authoritative child backlink. The resume rejects an abandonment that committed before it, even in its partial-write window.
63
+
64
+
Representative reducer scenarios cover stale linked and standalone approvals. Two-store tests cover abandonment after the parent precheck and both resume/re-delegation orderings. A declined resume returns before any store transition for both `resume_task` and `resume_completed_task`. This acceptance gate is deliberate and replaces the previous fall-through into the task loop. An accepted non-interrupted resume still runs without a store transition.
65
+
66
+
Rehydrated interrupted tasks omit lineage from message metadata saves, so their stale construction snapshots cannot restore severed links after rejection. Reverse-order stale abandonment and other live-task writers remain within the ownership/generation gaps below.
63
67
64
68
## Shared-store concurrency model
65
69
@@ -145,6 +149,7 @@ The task delegation checker currently enforces:
145
149
7. Active-child re-delegation, stale completion after ownership moves to another child, duplicate/late completion, and abandonment of a live child are rejected by the shared production guards.
146
150
8. A rejected delegation settles only the exact matching pending `create_subtask` action. Settlement preserves status, lineage, and accounting, never clears a replacement or different-kind action, and never mutates a completed record. The settlement compare-and-clear reads the persisted record under the per-file lock, so it never clears from a stale host cache.
147
151
9. A completion clears the completing child's pending action only when the completion event carries the exact matching action ID. A completion with no action ID or a different ID preserves the pending action.
152
+
10. A linked interrupted child resumes only while the on-disk parent still awaits it, checked under the parent-file lock, and a re-delegation commits only while the awaited child's on-disk record is still interrupted, checked inside the parent-file lock. The rejected `resume-stale` action after a competing re-delegation leaves every record unchanged.
148
153
149
154
The completion persistence checker additionally enforces:
0 commit comments