Python: handle concurrent FileCheckpointStorage deletion - #8261
Python: handle concurrent FileCheckpointStorage deletion#8261fzfzzfzzzfzzzz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is narrowly scoped, preserves other filesystem errors, and includes focused regression coverage.
Pull request overview
Makes file checkpoint deletion atomic under concurrent calls while preserving the storage contract.
Changes:
- Converts only
FileNotFoundErrorfromunlink()intoFalse. - Adds a deterministic concurrent-deletion regression test.
File summaries
| File | Description |
|---|---|
python/packages/core/agent_framework/_workflows/_checkpoint.py |
Removes the check-then-delete race. |
python/packages/core/tests/workflow/test_checkpoint.py |
Verifies concurrent deletes return one True and one False. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Motivation & Context
FileCheckpointStorage.delete()checked for existence before unlinking the checkpoint file. Concurrent callers could both observe the file, after which one caller removed it and the other leaked an undocumentedFileNotFoundErrorinstead of returningFalseas required by the storage contract.Description & Review Guide
unlink()directly and treatsFileNotFoundErroras a missing checkpoint. A deterministic regression test synchronizes the previous existence checks to reproduce the race.Trueand oneFalse; other filesystem failures continue to propagate unchanged.FileNotFoundErroris converted toFalse.Related Issue
Fixes #8255
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and title prefix in sync automatically.