Skip to content

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

Merged
juliusmarminge merged 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:fix/v2-snooze-failure-ordering-20260905
Sep 6, 2026
Merged

fix(server): keep old failures from waking snoozed V2 threads#9903
juliusmarminge merged 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:fix/v2-snooze-failure-ordering-20260905

Conversation

@saphid

@saphid saphid commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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 for commit ce9ecd9. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 5, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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.

@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from b82facd to 2ac9bfe Compare September 5, 2026 04:56
@saphid
saphid force-pushed the fix/v2-snooze-failure-ordering-20260905 branch from 60c1f1c to ce9ecd9 Compare September 5, 2026 05:07

@t3-code t3-code Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@juliusmarminge
juliusmarminge merged commit 415ed0f into pingdotgg:t3code/codex-turn-mapping Sep 6, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants