Repository navigation
fix(settlement): a pull request closed during a run the user did not start does not settle the thread - #46
Merged
Merged
Conversation
…does not settle it A background wake closed its own throwaway diagnostic pull request, and the thread auto-settled the moment that run ended, right after the agent asked the user a question. Treat a link closed while one of the thread's runs was working as work the thread did, like links added after they finished, so the decision falls through to the other links and the inactivity timer. Settlement candidates now carry the windows of runs that could contain such a close, read only for threads with a link closed since the user last wrote.
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
…settling An audit of last week's close settles showed all four happened during the thread's own run, and three were correct: the user's message started the run and asked for the close, or the run wrapped up a superseded PR. Only the incident's close came from a run a background notice started. Key the rule on what started the run. A close during a run whose prompt the user did not write (a scheduled task, a notice, a subagent completion, or another agent's message) is the thread's own work and cannot settle it. A close during a run the user's message started settles as before.
maschwenk
marked this pull request as ready for review
November 9, 2026 10:11
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.
the git checkout speed thread got auto-settled right as a background wake ended with "want both, or just one?". the only thing that tripped it was the agent closing its own throwaway diagnostic PR during that wake. a closed PR settles no matter what
autoSettleOnMergesays, so the settle landed the second the run went idlewhat changed
why it's keyed on what started the run
first version blocked every close that happened during any run. an audit of last week's close settles found all 4 happened during the thread's own run, and 3 of them were right to settle: 2 where my message started the run and asked for the close, 1 where a run my message started closed a superseded PR and wrapped up. the only bad one was the incident, where a background command notice started the run. the github close actor is no help here since agent
ghcalls run as meuser-authored means the run's prompt message has
createdBy = 'user'and noscheduledTaskId. scheduled task prompts carry whoever created the task, so one i scheduled still counts as automated. if the prompt message is missing the run counts as mine, so the old behavior holdsrun history
the candidate only had latest run timestamps. that covers the exact incident but not the next wake: if another background run happens before i write again, the close isn't in the latest run anymore, it's still newer than my last message, and the thread settles when that wake ends. same bug one wake later
so the candidate now carries the windows of automated runs, but only for threads with a closed link newer than my last message. that's rare, so most sweeps skip the extra query entirely. when it does run it's one batched query for those threads, bounded to runs that ended at or after the earliest close, using the
(thread_id, ordinal)index plus a primary key lookup of each run's prompt message. idle compaction runs and runs that never started are left outknown tradeoffs
closedAtis github's clock and run times are ours, so a close in the last second of a run could land just outside the window. in practice the agent's final message comes several seconds after the closewritten with claude opus 5.5 in claude code