Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep old failures from waking snoozed V2 threads #9903

Mergedsaphid(GitHub profile, opens in a new tab)merged 2 commits intot3code/codex-turn-mapping fromrefs/pull/9903/headmerged by juliusmarminge View on GitHub

A thread snoozed after a failed run can immediately become eligible for automatic settlement because V2 treats any failed status as a fresh wake-up.

Compare the failed run's completion timestamp with the snooze timestamp. Older failures, equal timestamps, and missing completion timestamps preserve the snooze; fresh failures and completed work can still wake it.

Validation: 11 focused settlement tests passed, including a regression that failed before the fix. Scoped typecheck and targeted lint passed. Cross-provider review was unavailable after the direct Claude Opus 5 high process failed OAuth authentication (exit 1, no model ran).

Targets the Orchestrator V2 branch in #2829. Implemented and reviewed by GPT-6 Astra in Codex/T3.


Note

Medium Risk Changes eligibility for automatic thread settlement on snoozed threads, which can affect sidebar lifecycle timing but is scoped to one guard with new regression tests.

Overview Snoozed Orchestrator V2 threads no longer become auto-settlement candidates just because status is failed. The early-wake path in isAutoSettlementCandidate now treats a failure as waking the thread only when the latest run completed after snooze started (or when there is no snoozedAt). Pre-snooze failures, completion exactly at snooze time, and failed status with no completion timestamp keep the thread parked until snoozedUntil.

Fresh failures after snooze and completion-based early wake are unchanged. Tests in ThreadSettlementService.test.ts lock in those edge cases.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ce9ecd9d1b3a3ffd64d5680cf5270166fba3f6a7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Current-base verification

Updated to V2 base 26a48b007 at 669f993becd191d19d0e4923cdff47a602ec79f3. Fresh focused regression runs pass (11 tests), along with targeted lint and affected package typechecks. The contribution files remain byte-for-byte identical to the previously reviewed PR head; this update incorporates the current target branch. Earlier verification above is retained with its original scope and limitations. Fresh independent Claude review is unavailable: claude auth status reports signed out. Refreshed by GPT-6 Astra in the Codex harness.

Note

Fix isAutoSettlementCandidate so old failures don't wake snoozed V2 threads

Changes the failed-run early-wake condition in isAutoSettlementCandidate so a failed snoozed thread only qualifies for auto-settlement when it has no snooze-start timestamp or its latest run completed strictly after that timestamp. Threads completed before or exactly at snooze time remain ineligible. Tests in ThreadSettlementService.test.ts cover the before, coincident, and absent-completion cases.

  • Behavioral Change: failed threads with an active snooze and a completion that predates snoozing are no longer auto-settlement candidates; previously they could wake the thread.
Macroscope summarized 669f993.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at 60c1f1c

      Macroscope's review found this PR approvable — This is a narrowly scoped server bug fix that prevents stale failures from waking snoozed threads, with regression tests covering the relevant timestamp cases. The production impact is limited to correcting automatic-settlement candidate filtering, with no schema, configuration, or sensitive-area changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. reviewed diff and relevant surrounding code at 669f993becd191d19d0e4923cdff47a602ec79f3. no blocking findings.

      old, equal-time and absent completion timestamps keep the failed thread snoozed; later completion and expired snooze allow settlement. six isolated cases passed using the actual candidate function with the queued-turn guard stubbed false. no code changes needed. the full service suite was not rerun.

      ci snapshot: no failing or pending checks; some checks are skipped. this is a comment review, not an approval or merge.

    4. juliusmarminge merged this415ed0f

    5. juliusmarminge closed this

Sign in to join this conversation.