Repository navigation
Auto-settle on merge: give the user time to read the agent's final reply when the agent merged the PR itself #14930
cardene777
started this conversation in
Ideas
Replies: 1 comment
|
Another data point, from 0.0.46-nightly.20261005.2667 (Linux server, Claude provider, orchestrator V2). The agent opens a PR, links it with
In older events on the same machine, at least 7 more threads settled while their last reply asked the user something. The grace rule proposed here covers this case, because the merge falls inside the latest turn. PR #16292 doesn't, because it only waits for runs that carry a user message. For now we have our agents end with |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
When the agent merges (or closes) the thread's pull request during its own turn, PR-driven auto-settlement fires the moment that turn completes. The thread drops into Settled and
ProviderCommandReactorstops its provider session onthread.settled, usually within a second of the agent's final reply and before the user has read it.I'd like to propose a grace period for that one case. A tested patch is included below.
What happens
Version: T3 Code 0.0.44 (desktop, macOS), Claude provider. The same code is on
main@ 54084ae.t3-codeMCPlink_pull_requesttool. T3 Code's agent instructions ask the agent to link every PR it creates or works on, so in agent-driven workflows almost every thread has a linked PR.gh pr merge) and ends the turn with a summary and a question such as "Should I continue with X next?".turn.completed→ the session leavesrunning→ThreadSettlementReactorsweeps →thread.auto-settle→thread.settled→session-stop-for-settle:server:auto-settle:<thread>:<uuid>stops the session.Over one afternoon, 8 threads were auto-settled this way. I inspected 6 of them. In each, the agent had merged the PR during the turn and ended the turn by proposing the next step, in 4 of them as an explicit question to the user.
thread.settledfollowedturn.completedby less than one second in 5 threads, and by 25 seconds in the sixth, which was waiting for the PR sync.From the user's side, the thread they were just talking to disappears into the collapsed Settled group and its session is stopped. It looks as if the session closed on its own.
Why the current rule settles immediately
pullRequestSettlesanchors on the user's latest request (latestTurn.requestedAt), so a PR merged during the turn counts as newer than the user's last activity. This is intentional (see the test "uses user request time instead of completion time as the PR anchor"). It is the right call when a human merges after reading the reply. It is not right when the agent did the merge itself and is still waiting for an answer.Turning off "Auto-settle merged threads" avoids the problem, but it also removes settlement when a human merges later, which is still useful.
Proposal
Hold PR-driven settlement for a grace period when the PR became terminal inside the latest turn (
requestedAt <= mergedAt/closedAt <= completedAt). Everything else stays the same:settledAtas today.The patch uses 30 minutes to match
ProviderSessionReaper's default inactivity threshold, so merge settlement never stops a session earlier than the idle reaper would. The exact value is your call.Patch
apps/server/src/orchestration/ThreadSettlementPolicy.tsand its tests (+114 / −1)Verification
On
main@ 54084ae, fromapps/server:vp test run src/orchestration/ThreadSettlementPolicy.test.ts: 25 passed (20 existing and 5 new).vp test run src/orchestration/ThreadSettlementReactor.test.ts: identical results before and after the patch, with no newly failing tests. 37 storage-cleanup and worktree tests fail in my local environment on the unmodified checkout as well.tsc --noEmit -p .: the same 56 errors before and after the patch, none in the changed files.vp fmt --checkpasses for both files.Feel free to take the patch as-is or adapt it.
All reactions