Repository navigation
Conversation
…mmit (volcengine#4494) A single transient path-lock conflict during commit_session (surfacing as UnavailableError, e.g. Windows ERROR_LOCK_VIOLATION on .path.ovlock) silently cost one backfilled session its memory extraction: the orchestrator logged it and moved on, and nothing retried the commit later. commit_if_needed and maybe_commit_on_threshold now route through _commit_with_retry, which retries only UnavailableError with a bounded backoff (5s/20s/60s by default, injectable for tests). Deterministic failures keep their current raise-through semantics; the store's needs_commit flag stays set while retries are exhausted so a later run can still pick the session up.
maybe_commit_on_threshold routes through _commit_with_retry too but no test executed it: adds a transient-failure retry case and a below-threshold no-op case.
|
Heads-up for triage: #4661 (unified model retry boundaries) deletes the session-layer If #4661 lands first, this PR's retry loop becomes dead code and the PR should be narrowed to whatever survives (the |
|
Cross-linking for reviewer/maintainer awareness: #4729 (
If this PR merges first, #4729 will rebase its |
Root cause
ingest backfillcallsSessionReplayer.commit_if_neededonce per session. Whencommit_sessionhits a transient path-lock conflict — the report shows WindowsERROR_LOCK_VIOLATION(os error 33) on.../.path.ovlockmapped toUnavailableError("Storage backend unavailable: internal error: lock error")— the exception propagates to the orchestrator's per-sessionexcept, which logs[ingest:codex] session <id> failedand moves on. Nothing retries the commit: on a 597-session / 50,099-message backfill, one flaky lock permanently cost that session its memory extraction (the run ended with1 errors).The append path is already crash-safe (persisted batch intent +
reconcile()), but the commit step had no equivalent tolerance for transient storage errors.Fix
commit_if_neededandmaybe_commit_on_thresholdnow route through a new_commit_with_retryhelper:UnavailableError— the class the server maps transient lock/IO conflicts to. Deterministic failures (NotFoundError, validation errors, …) keep their current raise-through semantics.warningwith session id and attempt count, so transient flakiness stays visible in backfill output.SessionReplayer(commit_retry_delays=...)for tests; default is a module constant.needs_commitflag remains set — a subsequent backfill run picks the session up again.How verified
tests/ingest/test_replay.py(fast, conftest-free):UnavailableErrorthen succeeding → commit lands,needs_commitcleared, exactly 3 client calls;UnavailableErrorraised after initial + 3 retries,needs_commitstill set for a later run;ValueError→ raised on the first call, no retry.