fix(session): retry session init once, report failure instead of going silent - #1
Open
lgomezt wants to merge 1 commit into
Open
fix(session): retry session init once, report failure instead of going silent#1lgomezt wants to merge 1 commit into
lgomezt wants to merge 1 commit into
Conversation
…of going silent initializeSession() and startFreshSession() caught their own errors with a console.error and returned session: null — no retry, no server-side trace. Every subsequent activity_logs save then no-ops on the null session check, invisibly. This is what happened to pid 54 on 2026-08-07: a session-init call failed once during the prepare->teach transition and the rest of their teach phase (code, oracle, chat, knowledge updates) was never logged, with no visible error to the participant or a researcher watching live. Both call sites now retry once after a short delay via a small, tested retryOnce() helper, and report a final failure through the existing (but previously unwired) reportLogFailure endpoint, so a recurrence shows up in the backend logs immediately instead of requiring a manual activity_logs audit days later. Claude-Session: https://claude.ai/code/session_01QdvEMCZypQR8SePXJiY22C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
initializeSession()swallowed its own failure withconsole.erroronly, returnedsession: null, and never retried — every subsequentactivity_logssave then silently no-op'd on the null session for the rest of the visit, invisibly (onlystudy_events, a separate ungated logger, kept working).initializeSession()andstartFreshSession()(same bug shape) now retry once after 1.5s via a small, unit-testedretryOnce()helper, and on a final failure report it through the app's existing-but-previously-unwiredreportLogFailureendpoint — so a recurrence lands in the backend logs the moment it happens instead of requiring a manualactivity_logsaudit.analysis/ASSUMPTIONS.md§G5 (private research repo, not in this PR).Merging this to
maintriggers the Dokploy auto-deploy of the live app (perCLAUDE.md) — the lab study is actively recruiting, so please pick the merge timing deliberately (e.g. not mid-session for an enrolled participant).Test plan
frontend/src/utils/retryOnce.test.ts— 5 new tests: clean first attempt, recovers on retry (the "no data lost" case), retry actually waitsdelayMs, reports + falls back safely after two failures,onFinalFailurenever double-fires.npx tsc -b --noEmit— cleannpx vitest run— 60/60 passing (was 55; +5 new)npm run build(full production build) — cleannpx eslinton touched files — no new errors (7 pre-existingno-explicit-anyerrors elsewhere in the file, untouched by this change)Claude-Session: https://claude.ai/code/session_01QdvEMCZypQR8SePXJiY22C