fix(decrypt): correct 1-based attempt check for unknown-error retry
Codex P2 review caught: `retry()` in retry-utils.ts iterates with
`for (let attempt = 1; ...)`, so the `attempt` passed to `shouldRetry` on
the first failure is 1, not 0. The previous `attempt < 1` was therefore
always false → no retry on unknown errors, contradicting the inline policy
comment ("one retry in case it was a transient blip").
Use `attempt < 2` so the SECOND pass happens (initial + 1 retry = 2 total
attempts, which matches `maxAttempts: 2`) and the third pass is refused.
The session-record / corrupted-session branches above already return false
unconditionally and are not affected.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -119,7 +119,9 @@ export const DECRYPTION_RETRY_OPTIONS: RetryOptions = {
|
||||
}
|
||||
|
||||
// Unknown errors: one retry in case it was a transient blip.
|
||||
return attempt < 1
|
||||
// `attempt` is 1-based (retry-utils starts the loop at 1), so `attempt < 2`
|
||||
// allows the second pass and returns false on the third.
|
||||
return attempt < 2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user