Skip to content

fix(dean): scope timeout retry cap to this-wait timeout events (VIR-8 hotfix)#138

Merged
nandanrao merged 1 commit into
mainfrom
hotfix/dean-timeout-gate
Jul 23, 2026
Merged

fix(dean): scope timeout retry cap to this-wait timeout events (VIR-8 hotfix)#138
nandanrao merged 1 commit into
mainfrom
hotfix/dean-timeout-gate

Conversation

@nandanrao

Copy link
Copy Markdown
Contributor

Production hotfix — Linear VIR-8 (MENtality incentive users stuck, not stitching to endline)

Root cause

Dean's timeout-selection gate used jsonb_array_length(externalEvents) < DEAN_TIMEOUT_MAX_ATTEMPTS (5) as a proxy for "timeout retry attempts". But externalEvents is a shared, never-drained log that also holds unrelated events — notably moviehouse:* video-player events from earlier in the survey. Respondents who watched a video clip arrived at their later 1-week timeout wait already showing ≥5 events, so Dean silently excluded them, never emitted the synthetic timeout, and they stayed parked forever.

Verified read-only against prod: Dean's timeout query returned 0 actionable users; all ~21 matured/in-window users failed the <5 gate, 19 of 21 specifically due to moviehouse events.

Fix

Count only the timeout events Dean emitted for the current wait (event.type='timeout' AND value == waitStart) instead of the whole log. Retry cap preserved; unrelated events no longer consume it. Unbounded growth stays independently bounded by the spammer gate (externalEvents > 100 → BLOCK_USER).

Dean-query-only: no state-shape change, no migration.

Tests

  • TestGetTimeouts_MaturedTimeoutFiresDespitePriorVideoEvents — matured timeout now fires despite 5 prior moviehouse events (control + stuck both fire).
  • TestGetTimeouts_RetryCapStillStopsAfterMaxTimeoutAttempts — cap still stops after 5 timeout attempts for the wait.
  • Updated TestGetTimeoutsIgnoresThoseAtOrAboveCap to model attempts as real timeout events.

All 11 timeout tests pass. (Pre-existing, unrelated TestGetPaymentsGetsOnlyThoseWhovePassedGraceButNotInterval failure reproduces on untouched main — not part of this change.)

Deploy

Dean is not part of the -wa platform rebuild; identical on main and prod tag dean-v0.0.41. After merge: tag dean-v0.0.43 → build → bump production.yaml versionDeanhelm upgrade -n vprod. Staging follows after.

🤖 Generated with Claude Code

Dean's timeout-selection gate used jsonb_array_length(externalEvents) as
a proxy for "timeout attempts made". But externalEvents is a shared,
never-drained log that also holds unrelated events (e.g. moviehouse:*
video events). A respondent who watched a video clip earlier in the
survey arrived at a later 1-week timeout wait already showing >= 5
events, so the `< DEAN_TIMEOUT_MAX_ATTEMPTS` (5) gate silently excluded
them: Dean never emitted the synthetic timeout, the wait never resolved,
and they stayed parked in the form forever, never stitching to the next
form. (Linear VIR-8: MENtality incentive users stuck, not stitching to
endline. ~21 matured users were blocked, 19 of them by moviehouse events.)

Count only the timeout events Dean emitted for the CURRENT wait
(event.type='timeout' AND value == waitStart) instead of the whole log.
The retry cap still works; unrelated events no longer consume it.
Unbounded state growth remains independently bounded by the spammer gate
(externalEvents > 100 -> BLOCK_USER), so narrowing this counter is safe.

Dean-query-only change: no state-shape change, no migration. Adds a
regression test (matured timeout fires despite prior video events) and a
retry-cap test, and updates the existing cap test to model attempts as
real timeout events rather than opaque array length.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for virtuallab-videos canceled.

Name Link
🔨 Latest commit cf02fe9
🔍 Latest deploy log https://app.netlify.com/projects/virtuallab-videos/deploys/6a6267bea710ae00086e6090

@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for vlab-research canceled.

Name Link
🔨 Latest commit cf02fe9
🔍 Latest deploy log https://app.netlify.com/projects/vlab-research/deploys/6a6267bed8959000094ce8fa

@nandanrao
nandanrao merged commit 664f548 into main Jul 23, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant