[Bug] Semantic retries reprocess files that already succeeded in the previous attempt
Description
When semantic processing of a multi-file directory partially fails, a queue retry repeats work that already succeeded in the previous attempt.
For example, if summary generation succeeds for a.txt and then a transient provider error occurs for b.txt, the directory attempt aborts. On the next SemanticQueue attempt, a.txt is summarized and potentially vectorized again before retrying b.txt. One transient failure can therefore amplify LLM and embedding calls across every retry.
The current incremental path reconstructs per-file reusable state from the generated .overview.md. That free-form sidecar is not a durable progress checkpoint and may not be written or parseable after a partial failure.
Reproduction
- Create a directory containing
a.txtandb.txt. - Run incremental semantic processing with serial summary generation.
- Let
a.txtsucceed and make the first request forb.txtraise a retryable error. - Retry the same semantic message.
- Observe that the successful work for
a.txtis performed again.
With a deterministic test double, the current call sequence is effectively:
a.txt, b.txt, a.txt, b.txt
The desired sequence is:
a.txt, b.txt, b.txt
Expected behavior
Successful per-file progress should survive a directory-level failure. A retry should process only failed files or incomplete phases, plus any affected ancestor directory summaries.
Suggested direction
Persist versioned, structured per-file semantic state keyed by content hash, including summary and summary/vectorization status. Mark work as failed before starting and successful only after the corresponding output or queue message is durable.
Related issues
- #2383 tracks repeated work during unchanged
add_resourcerefreshes and already points toward a structured auxiliary file. - #3151 tracks swallowed overview-generation failures and missing queue retries.
This issue is specifically about retaining partial per-file success across an actual queue retry.