Skip to content

feat(server): agents can settle their own thread after the run ends - #46

Merged
r4iju merged 1 commit into
mainfrom
feat/deferred-self-settle
Oct 8, 2026
Merged

r4iju merged 1 commit into
mainfrom
feat/deferred-self-settle

Conversation

@r4iju

@r4iju r4iju commented Oct 8, 2026

Copy link
Copy Markdown
Owner

A scheduled task bound to a thread unsettles it on every delivery, and the agent cannot put it back: t3_thread_organize settle fails 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_organize gains settle_after_run (caller's own thread only). It records the run as settleAfterRunId on the thread. When that run ends, the orchestrator dispatches an internal apply command that settles through the normal thread.settle mutation, 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_organize with {"action":"settle_after_run"} and no threadId.

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.

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.
@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Oct 8, 2026
@r4iju
r4iju changed the base branch from sync/upstream-20261008 to main October 8, 2026 13:01
@r4iju
r4iju merged commit 57f7668 into main Oct 8, 2026
7 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant