Repository navigation
Conversation
The settlement sweep kept dispatching thread.auto-settle for threads whose queued user message the orchestrator refuses to settle, repeating the same failed command every minute. Exclude a thread with a held user-created queued message from the settlement candidates, matching the orchestrator's queuedMessageExists check; automatic wakes still settle.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The settlement sweep now skips threads containing queued user messages instead of repeatedly attempting settlement. This is a narrow query filter with no new data mutations or changes to product defaults. You can add or adjust custom eligibility rules. Learn more. |
|
Thanks for this. #48436 makes the same change and is the one being kept. Thanks for the work on #48435. The same fix is already covered more completely by #48436, which exposes the queued-user-message state on settlement candidates and applies the exclusion in That version also updates the existing automatic-queue fixture and adds a focused failed-run regression, so automatic wakes remain candidates while held user messages are skipped. Please keep the reproduction and regression coverage from this PR in mind, but #48436 is the better change to continue with. Closing as a duplicate. |
Problem
Fixes #48419.
ThreadSettlementService.sweepbuilds candidates fromgetSettlementCandidates. A thread can keep a user-created message held in its queue after the preceding run fails, but the orchestrator rejectsthread.settlewith:The settlement query only inferred a queued turn from recent timestamps, so after the grace window the same idle thread stayed a candidate and the sweep kept dispatching
thread.auto-settle. The issue's trace shows 24 rejections in about 40 minutes on one thread.Fix
getSettlementCandidatesnow excludes a thread when it has a queued run whose user message is user-created and not an automatic wake (scheduled task, notification, or delegated completion). This mirrors the orchestrator'squeuedMessageExistscheck. Automatic queued wakes still remain settlement candidates.Verification
apps/server/src/orchestration-v2/ProjectionSettlement.test.tsthat creates a failed run plus a held user-created queued message, and an agent-created automatic queued message.expected true to be false(the held thread is a candidate). With the fix it passes and the automatic thread remains a candidate.ProjectionSettlement.test.ts: 11/11 pass.vp run check:changed: format, lint, knip, and typecheck pass. The changed-file test run also hits a pre-existingProjectionStore.test.tsfailure (statement.stat is not a function) that reproduces on a cleanorigin/mainworktree, so it is unrelated to this change.Model: DeepSeek V4.1 Flash 1017
Harness: OpenCode