Repository navigation
feat(server): agents can settle their own thread after the run ends - #46
Merged
Merged
Conversation
A scheduled task that posts into a bound thread unsettles it on every delivery, and the agent could not put it back: settling its own thread fails while its run is active, and its MCP credential dies with the run. t3_thread_organize gains settle_after_run. It records the calling run on the thread (settleAfterRunId), and when that run ends the orchestrator applies it through the normal thread.settle mutation, so projections and events match a manual settle. Any message dispatched to the thread (including scheduled deliveries and steers), an unsettle, or a pin clears the request, and the apply also requires the run to have completed as the thread's latest 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.
A scheduled task bound to a thread unsettles it on every delivery, and the agent cannot put it back:
t3_thread_organizesettlefails while its own run is active, and its MCP credential expires with the run. Quiet monitoring runs therefore land in the active list every interval.t3_thread_organizegainssettle_after_run(caller's own thread only). It records the run assettleAfterRunIdon the thread. When that run ends, the orchestrator dispatches an internal apply command that settles through the normalthread.settlemutation, so events and projections match a manual settle. Any message dispatched to the thread (user message, steer, scheduled delivery), an unsettle, or a pin clears the request; the apply also requires the run to have completed as the thread's latest run. The tool description, orchestration instructions, and the sidebar user doc describe it.Agent call:
t3_thread_organizewith{"action":"settle_after_run"}and nothreadId.Known limits: a server restart between the run ending and the apply, or a run ended by runtime reconcile, drops the request and leaves the thread unsettled.
Stacked on #45.