Skip to content

fix(settlement): keep a merged thread when its last reply still needs you - #48

Merged
maschwenk merged 1 commit into
mainfrom
feat/settle-reply-gate
Nov 9, 2026
Merged

maschwenk merged 1 commit into
mainfrom
feat/settle-reply-gate

Conversation

@maschwenk

Copy link
Copy Markdown
Owner

the settle audit for 11-02 to 11-09 flagged 40 of 64 top-level auto-settled threads as wrong. two patterns: 130 of the 194 PR settles were repeats, where a PR merged before my last message kept settling the thread every time an automated run ended. and plenty settled on merge while the last message was "want both, or just one?", "i'm holding until you say yes", "the one step left is yours", or "i'll be woken when they merge". i usually replied within minutes

builds on these (both merged)

what changed

  • reply check. before a merged or closed PR settles a thread (linked or branch, any run type), the text generation model gets one question about the latest run's last reply: does it still need me? that means it asks something, wants approval, gives me a step, or says one-off work is still running that it'll report on. if it does, the thread stays and inactivity is still the backstop. scheduled check-ins that say "no change, monitoring continues" still settle, so no-news monitor threads drop out like before
    • new op checkSettlementReply next to triageCompletion, same text generation model setting
    • verdict cached per run id, so sweeps don't re-ask. a new run gets a new question
    • fails closed: an error or 30s timeout holds the thread. retries at +5 and +30 min, then that run is held for good (inactivity still applies), so a dead model costs 3 calls per run, not one a minute
    • held threads also skip the branch-PR refresh in wouldSettle, so holding doesn't add host calls every sweep
    • logs auto-settle reply checked (needsUser, origin) and auto-settle held for the latest run (reason) once per run
  • failed, interrupted or stopped runs never PR-settle. the 429 run was recorded failed. the stop case was trickier: run 114 stayed completed and Stop only left a run_interrupt_request turn item when it killed the background work, so the check reads that too. this rule doesn't depend on the setting
  • PR 46 gap. if every visible link got dropped as the thread's own work, a looked-up PR can't settle it either, and the branch label only applies when the thread has no links at all. fwiw today's sweep never looks up a thread that has visible links, so i couldn't hit this through the worker. it's closed in resolveAutoSettlement anyway
  • setting sidebarAutoSettleReplyCheck, on by default, with a Fork row under auto-settle ("Check the last reply first")

not doing the unsettledAt cutoff or the scheduled task exemption: hourly runs keep resetting the idle timer, so both would leave monitor threads in the active list forever. the reply check handles repeats instead

tradeoffs

  • fail closed means a broken text generation model stops PR settles until inactivity (3 days by default)
  • one haiku call per run that would PR-settle. last week that was ~320 settle attempts across top-level and subagent threads, so ~45 calls a day
  • the settle now waits on that call, a few seconds after the run ends instead of instantly. the thread might show in the list for a moment before it goes
  • by the audit's labels the check also holds a handful that were fine (below). most of those do literally give me a step or promise a follow-up, so i think holding them is ok

eval

offline, using the final reply before each of the 194 top-level PR settles from the audit (Haiku 5.5 through the pool proxy, 2 runs, same prompt as shipped)

  • high + medium confidence wrong settles: 16/17 held by the model, plus the 429 and Stop cases held by the run-status rule. the miss is the 3-hourly MikroORM rollout check ("pair 7 clean, 2 more pairs to go"). that's a scheduled progress report with nothing for me, which is exactly the no-news monitor case we want to settle. so by thread it's 9/10 high-confidence held
  • audit-correct settles: 18/22 still settle. held: tsrs CI ("i'll check that the saves land when it finishes"), minos CLI ("someone with superadmin needs to run..."), hermes ("a background watcher will pick me back up when it merges"), forge desktop ("run fork:install yourself"). 3 more correct ones ended on an API error in a failed run, so the run-status rule holds those until inactivity
  • repeat settles that said nothing new (112, hand-labeled): 102-103 still settle (~92%). the misses are monitor check-ins mentioning a pending check
  • repeat that did need me (main broke, offers a revert draft): held
  • low-medium confidence: 13-14/17 held
  • API error text on a run marked completed (5 real replies): 5/5 held, after adding an "ends on an error" line. without it 2/5 settled
  • pooled precision 0.53-0.55, recall 0.94

written with claude opus 5.5 in claude code

… you

A merged or closed pull request no longer settles a thread right away. The
text generation model first reads the latest run's last reply and keeps the
thread when the reply asks something, hands over a step, or says work is
still running. The verdict is cached per run; errors and timeouts hold the
thread, with two retries per run. Inactivity still settles held threads.

A run that failed, was interrupted, or was stopped never settles on a pull
request, and a looked-up pull request no longer settles a thread whose links
were all its own work. sidebarAutoSettleReplyCheck turns the model check off.
@maschwenk maschwenk added the coder-task-generated Created from a coding task label Nov 9, 2026
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.
⚠️ This PR changes transfer ceilings:

  • Codex Live turn WebSocket decoded: 29.3 KiB → 24.4 KiB
  • Claude Live turn WebSocket decoded: 29.3 KiB → 24.4 KiB
Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB +33 B (+0.6%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB +33 B (+2.7%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 21.5 KiB +674 B (+3.2%) 24.4 KiB ✅
Codex Live turn messages 2 1 −1 (−50.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +32 B (+0.6%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +32 B (+2.6%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.9 KiB +686 B (+3.2%) 24.4 KiB ✅
Claude Live turn messages 2 1 −1 (−50.0%) 8 ✅

Baseline: cdc3e41 · PR result: 3a6616d · Source CI: failure

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@maschwenk
maschwenk marked this pull request as ready for review November 9, 2026 11:32
@maschwenk
maschwenk merged commit 6e7e728 into main Nov 9, 2026
27 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coder-task-generated Created from a coding task size:L vouch:trusted 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