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 a17edba
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/architecture/task-lifecycle-model.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Production completion also accepts a recovery-compatible `active` parent that st
63
63
64
64
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 under the child record's own advisory lock inside the parent-file lock, so a peer write's backup-rename window cannot make a valid child record look missing, 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.
65
65
66
-
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 resume completes its fallible history reads and writes before the activation commit, so a preparation failure leaves the record interrupted and retryable. A failed preparation write also stops the resume, and the Task restores the authoritative API conversation history in memory. Before its destructive preparation write the resume first stores a durable pre-resume recovery copy of the original history in the task directory under a UUID-distinct name, so a failed preparation or restore cannot lose the original across a restart. When the activation commit rejects, the Task restores the persisted history through a conditional write whose status gate, content compare, and commit all run under the API-history file's advisory lock; the gate reads the task record under the record file's lock inside that scope, and no existing writer takes the reverse lock order. The restore commits only while the persisted record still shows the status the resume started from and the disk still holds the prepared slice, so an active record and a newer foreign history always win. An unreadable record status or an unreadable history fails the restore closed, and the restore never runs on unknown state. A record that is already active on disk keeps the prepared history, and the skipped restore is logged as a partial failure that names the recovery copy, which is retained because the active status alone does not prove this attempt's prepared history was the one accepted. A restore write that fails logs the same partial failure and names the recovery copy that still holds the original bytes. These guarantees bind writers that honor the shared advisory locks, which covers every in-repo writer of both files. The denied pending-action replay uses the same checked order: it persists the denial tool result before the activation commit, a failed append stops before activation and leaves the record interrupted with its durable pending action, and an activation rejection keeps the committed denial without an API-history restore, because the denial is a settled user decision rather than an unaccepted prepared slice. An accepted non-interrupted resume still runs without a store transition.
66
+
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 resume completes its fallible history reads and writes before the activation commit, so a preparation failure leaves the record interrupted and retryable. A failed preparation write also stops the resume, and the Task restores the authoritative API conversation history in memory. The preparation write of an interrupted resume is a compare-and-set under the API-history file's advisory lock. It replaces the original history only while the disk still holds that original and the record is still interrupted, so only one of two accepted resumes can prepare and the other stops before activation without writing. Before that write the resume first stores a durable pre-resume recovery copy of the original history in the task directory under a UUID-distinct name, so a failed preparation or restore cannot lose the original across a restart. When the activation commit rejects, the Task restores the persisted history through a conditional write whose status gate, content compare, and commit all run under the API-history file's advisory lock; the gate reads the task record under the record file's lock inside that scope, and no existing writer takes the reverse lock order. The restore commits only while the persisted record still shows the status the resume started from and the disk still holds the prepared slice, so an active record and a newer foreign history always win. An unreadable record status or an unreadable history fails the restore closed, and the restore never runs on unknown state. A record that is already active on disk keeps the prepared history, and the skipped restore is logged as a partial failure that names the recovery copy, which is retained because the active status alone does not prove this attempt's prepared history was the one accepted. A restore write that fails logs the same partial failure and names the recovery copy that still holds the original bytes. These guarantees bind writers that honor the shared advisory locks, which covers every in-repo writer of both files. The denied pending-action replay uses the same checked order: it persists the denial tool result before the activation commit, a failed append stops before activation and leaves the record interrupted with its durable pending action, and an activation rejection keeps the committed denial without an API-history restore, because the denial is a settled user decision rather than an unaccepted prepared slice. An accepted non-interrupted resume still runs without a store transition.
67
67
68
68
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.
0 commit comments