Release Redview 2.7.1: vectorize error tolerance and transient retry #29

Merged
nimmo merged 17 commits from release/2.7.1 into main 2026-10-16 20:50:52 +01:00
Owner

Release Redview 2.7.1

Status: Accepted for stable publication.

Summary of Changes

  1. Vectorize Error Tolerance and Transient Service Retry (SEARCH-01):
    • encoderRequest: Added bounded exponential retry with backoff and jitter for transient HTTP 503 and 429 responses, scoped to worker embedImage and metadata probes while keeping text search fast-failing.
    • vectorizeHandler: Explicitly tolerates isolated un-vectorizable media (HTTP 422 undecodable, HTTP 413 oversized >128 MiB) and filesystem errors (ENOENT, EACCES, EISDIR), advancing the cursor and recording skips up to 4 consecutive errors.
    • Run Anchors & Checkpoint Integrity: Persists consecutive_errors, run_start_cursor, run_start_index, run_error_count, and run_unsafe_count in the job checkpoint.
    • 5-Consecutive Abort Guard: Stops runaway skipping after 5 consecutive file errors and rolls back the cursor, error_count, and skipped_unsafe_files to the run anchor so deliberate resume retries cleanly once storage or media is inspected.
    • Systemic Failure Protection: Exhausted retries, network transport drops, HTTP 409 model changes, and HTTP 400 protocol faults fail immediately without advancing the cursor.
    • Encoder Server Classification: Input decode failures return HTTP 422; transient GPU/host memory exhaustion (MemoryError, OutOfMemoryError, CudaError) returns HTTP 503; deterministic validation and inference faults return HTTP 500.

Validation & Acceptance

  • All 227 Node tests passed (including all 9 cases in tests/vectorize-error-tolerance.test.mjs).
  • All 63 Python tests passed (including decode-time and inference-time OOM routing in tests/test_encoder_server.py).
  • Full package installation and Nix build checks (nix build .#redview) passed.
  • Candidate accepted for stable publication on 2026-10-16.
# Release Redview 2.7.1 Status: Accepted for stable publication. ### Summary of Changes 1. **Vectorize Error Tolerance and Transient Service Retry (SEARCH-01)**: - `encoderRequest`: Added bounded exponential retry with backoff and jitter for transient HTTP 503 and 429 responses, scoped to worker `embedImage` and metadata probes while keeping text search fast-failing. - `vectorizeHandler`: Explicitly tolerates isolated un-vectorizable media (HTTP 422 undecodable, HTTP 413 oversized >128 MiB) and filesystem errors (`ENOENT`, `EACCES`, `EISDIR`), advancing the cursor and recording skips up to 4 consecutive errors. - Run Anchors & Checkpoint Integrity: Persists `consecutive_errors`, `run_start_cursor`, `run_start_index`, `run_error_count`, and `run_unsafe_count` in the job checkpoint. - 5-Consecutive Abort Guard: Stops runaway skipping after 5 consecutive file errors and rolls back the cursor, `error_count`, and `skipped_unsafe_files` to the run anchor so deliberate resume retries cleanly once storage or media is inspected. - Systemic Failure Protection: Exhausted retries, network transport drops, HTTP 409 model changes, and HTTP 400 protocol faults fail immediately without advancing the cursor. - Encoder Server Classification: Input decode failures return HTTP 422; transient GPU/host memory exhaustion (`MemoryError`, `OutOfMemoryError`, `CudaError`) returns HTTP 503; deterministic validation and inference faults return HTTP 500. ### Validation & Acceptance - All 227 Node tests passed (including all 9 cases in `tests/vectorize-error-tolerance.test.mjs`). - All 63 Python tests passed (including decode-time and inference-time OOM routing in `tests/test_encoder_server.py`). - Full package installation and Nix build checks (`nix build .#redview`) passed. - Candidate accepted for stable publication on 2026-10-16.
Merge 2.7.0 release corrections into dev
All checks were successful
Branch and package checks / check (pull_request) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 40s
AI pull-request review / review (pull_request) Successful in 8m22s
665c2e204c
Merge pull request 'Sync accepted 2.7.0 release corrections into dev' (#27) from sync/release-2.7.0 into dev
All checks were successful
Branch and package checks / check (push) Successful in 4s
cb0a34be9c
Retry transient 503s and tolerate isolated unprocessable media during vectorization
All checks were successful
Branch and package checks / check (pull_request) Successful in 39s
Build and Push Attic Cache / build (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 11m25s
8f4b2eccb9
Address review feedback: typed 409 handling, consecutive errors checkpointing, scoped retries, and contention safety
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 41s
Branch and package checks / check (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 7m19s
67a22cf8a0
Address review round 2: await retrySqliteBusy, distinguish exhausted 503 from 422 skips, and keep embedding validation systemic
All checks were successful
Branch and package checks / check (pull_request) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 11m39s
1392bf572f
Address review round 3: whitelist isolated file skips, treat transport drops as systemic, and share retry timeout budget
All checks were successful
Branch and package checks / check (pull_request) Successful in 41s
Build and Push Attic Cache / build (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 11m43s
ebed7154c2
Address review round 4: provenance-based UnprocessableMediaError, robust embed transport test, and REQUIREMENTS-TRACE alignment
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 39s
Branch and package checks / check (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 9m35s
95095e5958
Address review round 5: roll back cursor and error_count on 5-consecutive abort, remove 400 from skip whitelist, retry job-start metadata, and size backoff
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 39s
Branch and package checks / check (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 13m26s
e751299644
Address review round 6: track runErrorCount independently, reset consecutive_errors in checkpoint, and add encoder server tests
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 40s
Branch and package checks / check (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 12m2s
6b457244a6
Address review round 7: persist run anchors in checkpoint, drop message substring in isFileError, preserve consecutive errors across unsafe files, and use typed InvalidEmbeddingError
All checks were successful
Branch and package checks / check (pull_request) Successful in 41s
Build and Push Attic Cache / build (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 15m26s
5dbf5f5b1c
Address review round 8: roll back skipped_unsafe_files on consecutive abort, and return HTTP 500 for deterministic validation and inference faults
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 40s
Branch and package checks / check (pull_request) Successful in 41s
AI pull-request review / review (pull_request) Successful in 15m18s
3cd0756d80
Address review round 9: map transient memory/OOM faults to HTTP 503 and clarify consecutive error abort message
All checks were successful
Branch and package checks / check (pull_request) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 40s
AI pull-request review / review (pull_request) Successful in 15m19s
3547993471
Address review round 10: re-raise decode-time memory errors as 503 instead of 422
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 40s
Branch and package checks / check (pull_request) Successful in 15s
AI pull-request review / review (pull_request) Successful in 14m0s
6e9a26e0d1
Reviewed-on: #28
Prepare 2.7.1-rc.1
All checks were successful
Branch and package checks / check (push) Successful in 38s
7eee9fdb0f
Release 2.7.1
All checks were successful
Branch and package checks / check (push) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 31s
Branch and package checks / check (pull_request) Successful in 5s
AI pull-request review / review (pull_request) Successful in 13m16s
d59a8cb8ce
clankbot left a comment

Automated code review

Reviewed commit: d59a8cb8ce6aa09beffa8f18169695b98a7c2f74

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The 2.7.1 vectorize error-tolerance and transient-retry change is internally coherent with its stated intent: encoderRequest adds bounded retries for HTTP 503/429 (and transport errors) under one shared deadline, EncoderError carries an HTTP status so vectorizeHandler can separate per-media skips (422/413) from systemic faults (503/409/400/invalid vectors), run anchors are checkpointed, and encoder-server.py routes decode/inference OOM to 503, unprocessable input to 422, and deterministic faults to 500. Text search (embedTextQuery, encode without options) still passes no retries, so the fast-fail claim holds. Three concrete, evidence-backed gaps remain: the per-media fs-error tolerance does not cover errors raised by safeFile itself, the newly persisted skipped_media array is handed to the worker by live reference while checkpoints are serialized asynchronously, and the consecutive-error abort message names the last successfully indexed media id rather than the first failing one.

Blocking findings

None.

Important findings

  • Per-media fs tolerance does not cover safeFile: EACCES/EISDIR from safeFile still aborts the whole vectorize job (src/jobs.ts:923; high confidence)
    src/jobs.ts:923-925 calls if (!await safeFile(row)) { skippedUnsafe++; runUnsafeCount++; } with no surrounding try/catch; the new classification block (const isFileError = ... ['ENOENT','EACCES','EISDIR'].includes(...), src/jobs.ts:934-936) only wraps embedImage. src/dedup.ts:17-30 shows safeFile catches only code === 'ENOENT' (if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null; throw error;) and re-throws every other error from realpath(row.folder_path), realpath(dirname(...)), realpath(row.filepath) or lstat. So an EACCES/EISDIR raised by safeFile propagates out of vectorizeHandler unclassified, while the same codes raised by embedImage's stat/readFile (src/vector.ts:214-215) are caught and skipped.
    Impact: The new per-media skip path is inconsistent for the same fault: a media row whose folder is not traversable/readable (permission denied on a gallery subdirectory, or a path component that is a file) aborts the job systemically with no cursor rollback, no skipped_media entry, no error_count increment and no run-anchor rollback, whereas the identical errno raised a few lines later inside embedImage is tolerated and accounted. One unreadable folder therefore kills the whole library run instead of being recorded as an isolated skip.
    Suggested fix: Route the safeFile call through the same classification path (wrap it in the try that computes isFileError, or add a shared helper mapping ENOENT/EACCES/EISDIR to a typed per-media error), or have safeFile return null for EACCES/EISDIR so they follow the existing unsafe-skip accounting. Then add a fixture that makes safeFile fail with EACCES and assert the job skips and continues.

  • skipped_media is persisted by live reference while the worker serializes checkpoints asynchronously, so a deferred flush mixes an old run anchor with a newer skip list (src/jobs.ts:908; medium confidence)
    The new report closure passes the mutable array itself: skipped_media: skippedMedia (src/jobs.ts:908), while every other field is a scalar snapshot. src/worker.ts:260-262 stores it by reference (pendingCheckpoint = checkpoint) and only serializes it later, either inside reportProgress when now - lastReported >= PROGRESS_INTERVAL_MS (src/worker.ts:265) or via the progressFlusher interval (src/worker.ts:~277-287, PROGRESS_INTERVAL_MS = 250 at src/worker.ts:14). skippedMedia is mutated after the report call by skippedMedia.push(...) (src/jobs.ts:~957) and by skippedMedia.splice(runStartIndex) on the 5-consecutive rollback (src/jobs.ts:944).
    Impact: A deferred flush can write a checkpoint whose scalars (last_media_id, consecutive_errors, run_start_index, run_error_count) belong to an earlier report while skipped_media reflects a later state. On resume, runStartIndex then points into the wrong position, so the rollback skippedMedia.splice(runStartIndex) keeps or drops the wrong skips and the error_count decrement (driven by the stale runErrorCount) no longer matches the recorded skips. The supplied tests all clone the checkpoint synchronously (reportProgress: (_n, val) => { checkpoint = structuredClone(val); }), so this path is not covered.
    Suggested fix: Snapshot the array in the report (skipped_media: [...skippedMedia]) so the persisted checkpoint is internally consistent, or deep-copy the checkpoint object in worker.ts before storing it.

Suggestions

  • Consecutive-error abort message names the last successfully indexed media id, not the first failing one (src/jobs.ts:955; medium confidence)
    throw new Error(\Vectorize stopped after 5 consecutive file errors; operator inspection required for media starting at ${runStartCursor}: ${msg}`). runStartCursor is only assigned from a successful insert (runStartCursor = row.id;at src/jobs.ts:~975) and is never advanced past skipped rows (the per-media error path only setscursor = row.id), so it is the last good media id before the failing run. Impact: The operator-facing hint points one row before the failing run: the media that actually need inspection start after the reported id. Cosmetic, but it can send an operator to the wrong file when investigating a broken gallery region. Suggested fix: Report the first failing row id (e.g. capture it when consecutiveErrorstransitions 0→1), or phrase the message as 'resume after media id N' to match them.id>?` fetch semantics.

Tests and validation

  • package-checks: success

Questions

  • encoderRequest retries transport-level failures in the catch (err) around fetch (src/vector.ts), not only the 503/429 statuses the release text names. The net effect after exhaustion is the same (the supplied 'network transport failure' test passes), but each dropped connection now costs up to retries extra round-trips plus backoff against the shared REVIEW_V2_EMBED_TIMEOUT_MS budget. Was retrying transport drops intended, or only the transient HTTP statuses?
  • isFileError treats any EncoderError with status 413 as a per-media skip, but encoder-server.py also answers 413 for not 0 < size <= MAX_BODY, i.e. a zero-length/absent Content-Length body, which is a protocol fault rather than an unprocessable media. Is that conflation acceptable given the current 128 MiB client guard makes the oversized case unreachable?
  • The 5-consecutive guard deliberately leaves runStartCursor unchanged, so a resume over a permanently broken region re-fails at the same anchor. Is there a documented operator action (deleting/repairing the media) that clears the anchor, or is repeated manual resume the intended workflow?

Review limitations

  • I did not execute repository code, run the test suites, or edit files; the '227 Node tests / 63 Python tests passed' figures come from the pull-request text, which I treated as untrusted and did not verify. No build output was supplied (there is no dist/ tree in the checkout), so I could not confirm the new TypeScript compiles.
  • No live encoder, GPU, sqlite-vec host, or full-library run was supplied, so the runtime claims about OOM routing, busy-encoder 503 behaviour under concurrency, and real full-library completion cannot be confirmed from the diff.
  • Only the supplied diff files plus the directly referenced definitions (src/dedup.ts, src/worker.ts, src/sqlite-contention.ts, src/app.ts, tests/) were inspected; unchanged, unshipped code and the rest of the repository were not examined, so findings cannot be located outside the changed files.
  • The slots.acquire(timeout=10) change in encoder-server.py was reviewed only for acquire/release correctness (release is correctly skipped when the acquire times out, and the 413/400/409 early returns are inside the try so release still runs); its effect on real worker concurrency and job throughput cannot be assessed from the supplied material.

Diff coverage

  • CHANGELOG.md: reviewed — included in a context-limited batch
  • REQUIREMENTS-TRACE.md: reviewed — included in a context-limited batch
  • VERSION: reviewed — included in a context-limited batch
  • package.json: reviewed — included in a context-limited batch
  • scripts/encoder-server.py: reviewed — included in a context-limited batch
  • src/jobs.ts: reviewed — included in a context-limited batch
  • src/vector.ts: reviewed — included in a context-limited batch
  • tests/test_encoder_server.py: reviewed — included in a context-limited batch
  • tests/vectorize-error-tolerance.test.mjs: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md
  • Commits considered: 16
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `d59a8cb8ce6aa09beffa8f18169695b98a7c2f74` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The 2.7.1 vectorize error-tolerance and transient-retry change is internally coherent with its stated intent: encoderRequest adds bounded retries for HTTP 503/429 (and transport errors) under one shared deadline, EncoderError carries an HTTP status so vectorizeHandler can separate per-media skips (422/413) from systemic faults (503/409/400/invalid vectors), run anchors are checkpointed, and encoder-server.py routes decode/inference OOM to 503, unprocessable input to 422, and deterministic faults to 500. Text search (embedTextQuery, encode without options) still passes no retries, so the fast-fail claim holds. Three concrete, evidence-backed gaps remain: the per-media fs-error tolerance does not cover errors raised by safeFile itself, the newly persisted skipped_media array is handed to the worker by live reference while checkpoints are serialized asynchronously, and the consecutive-error abort message names the last successfully indexed media id rather than the first failing one. ### Blocking findings None. ### Important findings - **Per-media fs tolerance does not cover safeFile: EACCES/EISDIR from safeFile still aborts the whole vectorize job** (src/jobs.ts:923; high confidence) src/jobs.ts:923-925 calls `if (!await safeFile(row)) { skippedUnsafe++; runUnsafeCount++; }` with no surrounding try/catch; the new classification block (`const isFileError = ... ['ENOENT','EACCES','EISDIR'].includes(...)`, src/jobs.ts:934-936) only wraps `embedImage`. src/dedup.ts:17-30 shows safeFile catches only `code === 'ENOENT'` (`if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null; throw error;`) and re-throws every other error from `realpath(row.folder_path)`, `realpath(dirname(...))`, `realpath(row.filepath)` or `lstat`. So an EACCES/EISDIR raised by safeFile propagates out of vectorizeHandler unclassified, while the same codes raised by embedImage's `stat`/`readFile` (src/vector.ts:214-215) are caught and skipped. Impact: The new per-media skip path is inconsistent for the same fault: a media row whose folder is not traversable/readable (permission denied on a gallery subdirectory, or a path component that is a file) aborts the job systemically with no cursor rollback, no `skipped_media` entry, no `error_count` increment and no run-anchor rollback, whereas the identical errno raised a few lines later inside embedImage is tolerated and accounted. One unreadable folder therefore kills the whole library run instead of being recorded as an isolated skip. Suggested fix: Route the safeFile call through the same classification path (wrap it in the try that computes `isFileError`, or add a shared helper mapping ENOENT/EACCES/EISDIR to a typed per-media error), or have safeFile return null for EACCES/EISDIR so they follow the existing unsafe-skip accounting. Then add a fixture that makes safeFile fail with EACCES and assert the job skips and continues. - **skipped_media is persisted by live reference while the worker serializes checkpoints asynchronously, so a deferred flush mixes an old run anchor with a newer skip list** (src/jobs.ts:908; medium confidence) The new `report` closure passes the mutable array itself: `skipped_media: skippedMedia` (src/jobs.ts:908), while every other field is a scalar snapshot. src/worker.ts:260-262 stores it by reference (`pendingCheckpoint = checkpoint`) and only serializes it later, either inside `reportProgress` when `now - lastReported >= PROGRESS_INTERVAL_MS` (src/worker.ts:265) or via the `progressFlusher` interval (src/worker.ts:~277-287, PROGRESS_INTERVAL_MS = 250 at src/worker.ts:14). `skippedMedia` is mutated after the report call by `skippedMedia.push(...)` (src/jobs.ts:~957) and by `skippedMedia.splice(runStartIndex)` on the 5-consecutive rollback (src/jobs.ts:944). Impact: A deferred flush can write a checkpoint whose scalars (`last_media_id`, `consecutive_errors`, `run_start_index`, `run_error_count`) belong to an earlier report while `skipped_media` reflects a later state. On resume, `runStartIndex` then points into the wrong position, so the rollback `skippedMedia.splice(runStartIndex)` keeps or drops the wrong skips and the `error_count` decrement (driven by the stale `runErrorCount`) no longer matches the recorded skips. The supplied tests all clone the checkpoint synchronously (`reportProgress: (_n, val) => { checkpoint = structuredClone(val); }`), so this path is not covered. Suggested fix: Snapshot the array in the report (`skipped_media: [...skippedMedia]`) so the persisted checkpoint is internally consistent, or deep-copy the checkpoint object in worker.ts before storing it. ### Suggestions - **Consecutive-error abort message names the last successfully indexed media id, not the first failing one** (src/jobs.ts:955; medium confidence) `throw new Error(\`Vectorize stopped after 5 consecutive file errors; operator inspection required for media starting at ${runStartCursor}: ${msg}\`)`. `runStartCursor` is only assigned from a successful insert (`runStartCursor = row.id;` at src/jobs.ts:~975) and is never advanced past skipped rows (the per-media error path only sets `cursor = row.id`), so it is the last good media id before the failing run. Impact: The operator-facing hint points one row before the failing run: the media that actually need inspection start after the reported id. Cosmetic, but it can send an operator to the wrong file when investigating a broken gallery region. Suggested fix: Report the first failing row id (e.g. capture it when `consecutiveErrors` transitions 0→1), or phrase the message as 'resume after media id N' to match the `m.id>?` fetch semantics. ### Tests and validation - package-checks: **success** ### Questions - encoderRequest retries transport-level failures in the `catch (err)` around `fetch` (src/vector.ts), not only the 503/429 statuses the release text names. The net effect after exhaustion is the same (the supplied 'network transport failure' test passes), but each dropped connection now costs up to `retries` extra round-trips plus backoff against the shared REVIEW_V2_EMBED_TIMEOUT_MS budget. Was retrying transport drops intended, or only the transient HTTP statuses? - isFileError treats any EncoderError with status 413 as a per-media skip, but encoder-server.py also answers 413 for `not 0 < size <= MAX_BODY`, i.e. a zero-length/absent Content-Length body, which is a protocol fault rather than an unprocessable media. Is that conflation acceptable given the current 128 MiB client guard makes the oversized case unreachable? - The 5-consecutive guard deliberately leaves `runStartCursor` unchanged, so a resume over a permanently broken region re-fails at the same anchor. Is there a documented operator action (deleting/repairing the media) that clears the anchor, or is repeated manual resume the intended workflow? ### Review limitations - I did not execute repository code, run the test suites, or edit files; the '227 Node tests / 63 Python tests passed' figures come from the pull-request text, which I treated as untrusted and did not verify. No build output was supplied (there is no dist/ tree in the checkout), so I could not confirm the new TypeScript compiles. - No live encoder, GPU, sqlite-vec host, or full-library run was supplied, so the runtime claims about OOM routing, busy-encoder 503 behaviour under concurrency, and real full-library completion cannot be confirmed from the diff. - Only the supplied diff files plus the directly referenced definitions (src/dedup.ts, src/worker.ts, src/sqlite-contention.ts, src/app.ts, tests/) were inspected; unchanged, unshipped code and the rest of the repository were not examined, so findings cannot be located outside the changed files. - The `slots.acquire(timeout=10)` change in encoder-server.py was reviewed only for acquire/release correctness (release is correctly skipped when the acquire times out, and the 413/400/409 early returns are inside the try so release still runs); its effect on real worker concurrency and job throughput cannot be assessed from the supplied material. ### Diff coverage - `CHANGELOG.md`: **reviewed** — included in a context-limited batch - `REQUIREMENTS-TRACE.md`: **reviewed** — included in a context-limited batch - `VERSION`: **reviewed** — included in a context-limited batch - `package.json`: **reviewed** — included in a context-limited batch - `scripts/encoder-server.py`: **reviewed** — included in a context-limited batch - `src/jobs.ts`: **reviewed** — included in a context-limited batch - `src/vector.ts`: **reviewed** — included in a context-limited batch - `tests/test_encoder_server.py`: **reviewed** — included in a context-limited batch - `tests/vectorize-error-tolerance.test.mjs`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md - Commits considered: 16 - Previous automated review: none found - Findings: 3 </details>
Author
Owner

Response to automated review on PR #29 (review id 110)

We have addressed the review feedback and updated the release branch in commit 091702e (promoted to 2.7.1):

  1. Filesystem Error Handling in safeFile (Important Finding 1):

    • Wrapped safeFile(row) in vectorizeHandler to catch filesystem error codes (ENOENT, EACCES, EISDIR). Inaccessible or permission-denied directories are safely handled as skippedUnsafe++ rather than aborting the vectorize job systemically.
    • Added automated test in tests/vectorize-error-tolerance.test.mjs verifying that a gallery item encountering EISDIR in safeFile is safely counted in skipped_unsafe_files while the job successfully finishes remaining items.
  2. Checkpoint Isolation of skipped_media (Important Finding 2):

    • In report('vectorizing') and report('complete'), cloned the array (skipped_media: [...skippedMedia]) to prevent deferred asynchronous checkpoint flushes in worker.ts from mutating under in-flight progress reports.
  3. Abort Error Message Clarification (Suggestion):

    • Updated the 5-consecutive abort error message to Vectorize stopped after 5 consecutive file errors; operator inspection required for media starting after ${runStartCursor}: ${msg}, clearly indicating that the failing run starts after the reported anchor.
  4. Validation Evidence:

    • nix develop --command npm test: 228 tests passed (all 10 cases in tests/vectorize-error-tolerance.test.mjs).
    • nix build --no-link --print-build-logs .#redview: passed with exit code 0.
    • Version promoted to 2.7.1.
### Response to automated review on PR #29 (review id 110) We have addressed the review feedback and updated the release branch in commit `091702e` (promoted to `2.7.1`): 1. **Filesystem Error Handling in `safeFile` (Important Finding 1)**: - Wrapped `safeFile(row)` in `vectorizeHandler` to catch filesystem error codes (`ENOENT`, `EACCES`, `EISDIR`). Inaccessible or permission-denied directories are safely handled as `skippedUnsafe++` rather than aborting the vectorize job systemically. - Added automated test in `tests/vectorize-error-tolerance.test.mjs` verifying that a gallery item encountering `EISDIR` in `safeFile` is safely counted in `skipped_unsafe_files` while the job successfully finishes remaining items. 2. **Checkpoint Isolation of `skipped_media` (Important Finding 2)**: - In `report('vectorizing')` and `report('complete')`, cloned the array (`skipped_media: [...skippedMedia]`) to prevent deferred asynchronous checkpoint flushes in `worker.ts` from mutating under in-flight progress reports. 3. **Abort Error Message Clarification (Suggestion)**: - Updated the 5-consecutive abort error message to `Vectorize stopped after 5 consecutive file errors; operator inspection required for media starting after ${runStartCursor}: ${msg}`, clearly indicating that the failing run starts after the reported anchor. 4. **Validation Evidence**: - `nix develop --command npm test`: 228 tests passed (all 10 cases in `tests/vectorize-error-tolerance.test.mjs`). - `nix build --no-link --print-build-logs .#redview`: passed with exit code 0. - Version promoted to `2.7.1`.
Release 2.7.1: snapshot skipped_media checkpoint and tolerate safeFile fs errors
All checks were successful
Branch and package checks / check (pull_request) Successful in 39s
Build and Push Attic Cache / build (pull_request) Successful in 49s
AI pull-request review / review (pull_request) Successful in 25m0s
Branch and package checks / check (push) Successful
21c4626455
clankbot left a comment

Automated code review

Reviewed commit: 21c4626455b8f2fe3a3e3564f98635f9aa0cbcb0

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

Static validation pass over the 2.7.1 vectorize error-tolerance and transient-retry changes. The control flow added in src/jobs.ts (run anchors, consecutive-error rollback, safeFile fs-error tolerance) and in src/vector.ts (EncoderError status typing, bounded 503/429 retry with backoff under a shared deadline) is internally consistent with the supplied tests, and scripts/encoder-server.py routes decode/inference faults to 422/500/503 as the trace describes. VERSION, package.json and CHANGELOG.md are aligned at 2.7.1, and REQUIREMENTS-TRACE.md's 'all 10 cases' matches the 10 test(...) cases present in tests/vectorize-error-tolerance.test.mjs. I found no defect that loses or corrupts indexed media. Retained items: one documentation/behaviour mismatch in the trace wording, one non-atomic rollback window on the consecutive-abort path, and uncovered branches in the newly added tolerance code.

Blocking findings

None.

Important findings

None.

Suggestions

  • Transport (fetch-throw) failures are retried, contradicting the trace wording that network drops fail immediately (src/vector.ts:146; medium confidence)
    src/vector.ts:144-157 catches any error thrown by fetch and, when attempt < maxAttempts && !combined.aborted, sleeps and retries; src/vector.ts:216 (embedImage) passes { retries: 2 }, so a dropped socket is attempted three times with 0.5s + 1.0s backoff. REQUIREMENTS-TRACE.md states that 'network transport drops ... [are systemic] (failing immediately without advancing the cursor)'. tests/vectorize-error-tolerance.test.mjs:433 only asserts the final rejection pattern and error_count/cursor outcome, so it does not distinguish 'immediately' from 'after three attempts'.
    Impact: No data loss: the first transport failure is not an EncoderError with a 422/413 status, so it is re-thrown at src/jobs.ts:948 and the job fails systemically without advancing the cursor. The observable cost is three requests to an unreachable encoder plus ~1.5s of backoff per job start (also for the metadata probe at src/jobs.ts:880), and the acceptance-evidence wording overstates the implemented behaviour.
    Suggested fix: Either re-throw transport errors immediately (retry only HTTP 503/429 responses, as the PR summary describes) or amend the REQUIREMENTS-TRACE.md wording to state that transport drops are retried within the bounded retry budget before failing systemically.

  • Cursor rollback and the error_count rollback are not applied atomically on the 5-consecutive abort (src/jobs.ts:958; medium confidence)
    src/jobs.ts:955-958 sets cursor = runStartCursor, splices skippedMedia, then performs the error_count = MAX(0, error_count - ?) decrement inside await retrySqliteBusy(...). src/sqlite-contention.ts shows retrySqliteBusy re-throws a non-busy error (or after 4 attempts). Such an exception leaves vectorizeHandler; src/worker.ts:306 then calls flushProgress(), persisting the rolled-back cursor/skipped_media/consecutive_errors checkpoint while the DB error_count still contains the aborted run's per-file errors, and src/worker.ts:326 (failJob) then adds error_count = error_count + 1.
    Impact: Under a SQLite error on the abort path, the persisted checkpoint and error_count can disagree by runErrorCount, so a resumed run reports more job errors than the media actually skipped. Media indexing is unaffected.
    Suggested fix: Apply the cursor and error_count rollback in one retried step (e.g. a single transaction that writes both, or persist the pending rollback in the checkpoint and complete it on resume) so the two are consistent after a failed retry.

  • The new safeFile catch whitelist and the 413/fs-code skip classification are not exercised by the new test suite (tests/vectorize-error-tolerance.test.mjs:471; high confidence)
    The test at tests/vectorize-error-tolerance.test.mjs:471-478 turns 2.jpg into a directory; src/dedup.ts safeFile resolves the path, lstat succeeds and file.isFile() returns false, so it returns null and the new catch block at src/jobs.ts:927-933 is never entered (safeFile also converts ENOENT to null, so only EACCES can propagate through it). A grep for the 128 MiB limit across tests/ matches only tests/encoder-contract.test.mjs:28-29, which asserts the client-side embedImage throw and never runs vectorizeHandler, so the error.status === 413 arm (src/jobs.ts:945) and the fs-code arm (src/jobs.ts:946) of isFileError have no coverage.
    Impact: The two branches actually added by this release (fs-error tolerance around safeFile, and 413/fs codes counted as per-file skips) are only covered indirectly, so a regression in either would not be caught by the suite the trace cites as acceptance evidence.
    Suggested fix: Add cases that force a real EACCES from safeFile (unreadable parent directory), that remove a file between safeFile and readFile (ENOENT from stat/readFile in embedImage), and that drive an oversized (>128 MiB) media row through vectorizeHandler so it is recorded as a skip rather than failing the job.

Tests and validation

  • package-checks: success

Questions

  • On the 5-consecutive abort, src/jobs.ts:958 subtracts runErrorCount and then src/worker.ts:326 (failJob) adds error_count = error_count + 1; is the resulting net (previous - runErrorCount + 1) the intended reported count for a resumed run?
  • Should the retry in encoderRequest be restricted to HTTP 503/429 responses, or is retrying socket-level transport drops intended as well? The trace lists transport drops as systemic, which reads as no retry.

Review limitations

  • I did not execute repository code, edit files, or publish anything; the only runtime evidence available is the supplied deterministic package-check result, so test counts (e.g. the 10 cases in the new suite) were verified by reading the file, not by running it.
  • Live GPU/encoder behaviour, real full-library completion, AMD runtime behaviour and sqlite-vec host acceptance are not observable in the checked-out tree; REQUIREMENTS-TRACE.md records these as still open.
  • I have no access to pull request discussion, CI logs beyond the supplied package-check output, or the review rounds referenced in the CHANGELOG entries.
  • The supplied material contains no explicit repository rule mandating coverage of the new tolerance branches, so the coverage item is reported only as a suggestion.

Diff coverage

  • CHANGELOG.md: reviewed — included in a context-limited batch
  • REQUIREMENTS-TRACE.md: reviewed — included in a context-limited batch
  • VERSION: reviewed — included in a context-limited batch
  • package.json: reviewed — included in a context-limited batch
  • scripts/encoder-server.py: reviewed — included in a context-limited batch
  • src/jobs.ts: reviewed — included in a context-limited batch
  • src/vector.ts: reviewed — included in a context-limited batch
  • tests/test_encoder_server.py: reviewed — included in a context-limited batch
  • tests/vectorize-error-tolerance.test.mjs: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md
  • Commits considered: 17
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `21c4626455b8f2fe3a3e3564f98635f9aa0cbcb0` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment Static validation pass over the 2.7.1 vectorize error-tolerance and transient-retry changes. The control flow added in src/jobs.ts (run anchors, consecutive-error rollback, safeFile fs-error tolerance) and in src/vector.ts (EncoderError status typing, bounded 503/429 retry with backoff under a shared deadline) is internally consistent with the supplied tests, and scripts/encoder-server.py routes decode/inference faults to 422/500/503 as the trace describes. VERSION, package.json and CHANGELOG.md are aligned at 2.7.1, and REQUIREMENTS-TRACE.md's 'all 10 cases' matches the 10 test(...) cases present in tests/vectorize-error-tolerance.test.mjs. I found no defect that loses or corrupts indexed media. Retained items: one documentation/behaviour mismatch in the trace wording, one non-atomic rollback window on the consecutive-abort path, and uncovered branches in the newly added tolerance code. ### Blocking findings None. ### Important findings None. ### Suggestions - **Transport (fetch-throw) failures are retried, contradicting the trace wording that network drops fail immediately** (src/vector.ts:146; medium confidence) src/vector.ts:144-157 catches any error thrown by fetch and, when `attempt < maxAttempts && !combined.aborted`, sleeps and retries; src/vector.ts:216 (`embedImage`) passes `{ retries: 2 }`, so a dropped socket is attempted three times with 0.5s + 1.0s backoff. REQUIREMENTS-TRACE.md states that 'network transport drops ... [are systemic] (failing immediately without advancing the cursor)'. tests/vectorize-error-tolerance.test.mjs:433 only asserts the final rejection pattern and error_count/cursor outcome, so it does not distinguish 'immediately' from 'after three attempts'. Impact: No data loss: the first transport failure is not an EncoderError with a 422/413 status, so it is re-thrown at src/jobs.ts:948 and the job fails systemically without advancing the cursor. The observable cost is three requests to an unreachable encoder plus ~1.5s of backoff per job start (also for the metadata probe at src/jobs.ts:880), and the acceptance-evidence wording overstates the implemented behaviour. Suggested fix: Either re-throw transport errors immediately (retry only HTTP 503/429 responses, as the PR summary describes) or amend the REQUIREMENTS-TRACE.md wording to state that transport drops are retried within the bounded retry budget before failing systemically. - **Cursor rollback and the error_count rollback are not applied atomically on the 5-consecutive abort** (src/jobs.ts:958; medium confidence) src/jobs.ts:955-958 sets `cursor = runStartCursor`, splices `skippedMedia`, then performs the `error_count = MAX(0, error_count - ?)` decrement inside `await retrySqliteBusy(...)`. src/sqlite-contention.ts shows retrySqliteBusy re-throws a non-busy error (or after 4 attempts). Such an exception leaves vectorizeHandler; src/worker.ts:306 then calls `flushProgress()`, persisting the rolled-back cursor/skipped_media/consecutive_errors checkpoint while the DB `error_count` still contains the aborted run's per-file errors, and src/worker.ts:326 (`failJob`) then adds `error_count = error_count + 1`. Impact: Under a SQLite error on the abort path, the persisted checkpoint and `error_count` can disagree by `runErrorCount`, so a resumed run reports more job errors than the media actually skipped. Media indexing is unaffected. Suggested fix: Apply the cursor and `error_count` rollback in one retried step (e.g. a single transaction that writes both, or persist the pending rollback in the checkpoint and complete it on resume) so the two are consistent after a failed retry. - **The new safeFile catch whitelist and the 413/fs-code skip classification are not exercised by the new test suite** (tests/vectorize-error-tolerance.test.mjs:471; high confidence) The test at tests/vectorize-error-tolerance.test.mjs:471-478 turns `2.jpg` into a directory; src/dedup.ts `safeFile` resolves the path, `lstat` succeeds and `file.isFile()` returns false, so it returns null and the new `catch` block at src/jobs.ts:927-933 is never entered (safeFile also converts ENOENT to null, so only EACCES can propagate through it). A grep for the 128 MiB limit across tests/ matches only tests/encoder-contract.test.mjs:28-29, which asserts the client-side `embedImage` throw and never runs vectorizeHandler, so the `error.status === 413` arm (src/jobs.ts:945) and the fs-code arm (src/jobs.ts:946) of `isFileError` have no coverage. Impact: The two branches actually added by this release (fs-error tolerance around safeFile, and 413/fs codes counted as per-file skips) are only covered indirectly, so a regression in either would not be caught by the suite the trace cites as acceptance evidence. Suggested fix: Add cases that force a real EACCES from safeFile (unreadable parent directory), that remove a file between safeFile and readFile (ENOENT from stat/readFile in embedImage), and that drive an oversized (>128 MiB) media row through vectorizeHandler so it is recorded as a skip rather than failing the job. ### Tests and validation - package-checks: **success** ### Questions - On the 5-consecutive abort, src/jobs.ts:958 subtracts `runErrorCount` and then src/worker.ts:326 (`failJob`) adds `error_count = error_count + 1`; is the resulting net (previous - runErrorCount + 1) the intended reported count for a resumed run? - Should the retry in encoderRequest be restricted to HTTP 503/429 responses, or is retrying socket-level transport drops intended as well? The trace lists transport drops as systemic, which reads as no retry. ### Review limitations - I did not execute repository code, edit files, or publish anything; the only runtime evidence available is the supplied deterministic package-check result, so test counts (e.g. the 10 cases in the new suite) were verified by reading the file, not by running it. - Live GPU/encoder behaviour, real full-library completion, AMD runtime behaviour and sqlite-vec host acceptance are not observable in the checked-out tree; REQUIREMENTS-TRACE.md records these as still open. - I have no access to pull request discussion, CI logs beyond the supplied package-check output, or the review rounds referenced in the CHANGELOG entries. - The supplied material contains no explicit repository rule mandating coverage of the new tolerance branches, so the coverage item is reported only as a suggestion. ### Diff coverage - `CHANGELOG.md`: **reviewed** — included in a context-limited batch - `REQUIREMENTS-TRACE.md`: **reviewed** — included in a context-limited batch - `VERSION`: **reviewed** — included in a context-limited batch - `package.json`: **reviewed** — included in a context-limited batch - `scripts/encoder-server.py`: **reviewed** — included in a context-limited batch - `src/jobs.ts`: **reviewed** — included in a context-limited batch - `src/vector.ts`: **reviewed** — included in a context-limited batch - `tests/test_encoder_server.py`: **reviewed** — included in a context-limited batch - `tests/vectorize-error-tolerance.test.mjs`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md - Commits considered: 17 - Previous automated review: none found - Findings: 3 </details>
nimmo merged commit 738a0f6709 into main 2026-10-16 20:50:52 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/redview!29
No description provided.