Repository navigation
fix(orchestration): never settle a thread that is still live - #167
Merged
Merged
Conversation
Refuse thread.settle / thread.auto-settle at the single dispatch choke point
when any of:
- the thread owns a non-terminal workflow run (queued/running/suspended/
sleeping/paused),
- the thread has a child that is live (actively running, or running its own
workflow — one concept), or
- a parent has a durable, unresolved t3team.child_wait on the thread.
All three are read from the durable projection tables (workflow_runs,
projection_thread_sessions + handoff activities, child_wait activities), so
they hold across restarts and cover every settle path: the client batch-settle,
the idle-days auto-settle, and the child sweepers. Genuinely-inactive threads
still settle as before.
Contributor
Thread transfer impact
This comment will update automatically after the next completed run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A thread is now refused by
thread.settle/thread.auto-settlewhen it is still live. Enforced at the single engine dispatch choke point, so every settle path is covered — the client "Settle (N)" batch, the idle-days auto-settle, and the child sweepers.A thread is refused when any of:
queued/running/suspended/sleeping/paused);t3team.child_waiton it (the deterministic "parent still needs this child" signal).Genuinely‑inactive threads settle exactly as before.
Why
Threads that still had work in flight were being settled and vanishing from the active roster: a launch thread with a paused/sleeping workflow, a parent while a sub‑thread was still working, and a child while a parent was still waiting on its result. All three are now refused.
All signals are read from durable projection tables (
workflow_runs,projection_thread_sessions+ handoff activities, andchild_waitactivities), so they hold across restarts and need no timers or new resident state.Tests
workflow_runsrow is refused (with the "still live" detail) while a control thread with no live relation settles normally.Normalizer.attachmentscases, confirmed to fail on a clean base as well.Guard
One choke point, three clean predicates (
Effect.all+ a single OR) — no nested branch logic.