fix(task-store): tolerate Windows EPERM/EACCES rename during atomic save#43
Merged
win4r merged 1 commit intowin4r:masterfrom Mar 29, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(task-store): tolerate intermittent Windows EPERM/EACCES rename failures when saving tasks
Summary
On Windows (especially in corporate environments with antivirus / file indexers / DLP), atomic
rename(tmp -> target)can intermittently fail withEPERM/EACCES. When this happens inside the A2A gateway task store, the durable task state cannot be persisted and long-running A2A flows (async task mode,--non-blocking --wait/tasks/get) become unreliable.This PR makes
FileTaskStore.save()more resilient:EPERM/EACCES, retry a few times with small backoffThis changes a hard failure into a recoverable path so polling can continue.
Why this matters
A2A async task mode relies on being able to persist incremental task states. A single failure to write the task JSON can break polling and make agent-to-agent messaging appear flaky.
Repro (Windows)
Fix
src/task-store.ts:rename(tmp, target)in a try/catchEPERM/EACCESwriteFile(target, payload)+ best-effort tmp cleanupDeployment / config note (recommended)
When running multiple OpenClaw profiles on the same Windows user, do not share the default task store directory.
Recommend configuring per-profile:
plugins.entries.a2a-gateway.config.storage.tasksDirExample:
{ "plugins": { "entries": { "a2a-gateway": { "config": { "storage": { "tasksDir": "C:/Users/<user>/.openclaw-<profile>/a2a-tasks" } } } } } }This reduces cross-profile collisions and further improves stability.
Testing
npx tsc --noEmitnpm testCI already runs on ubuntu; the change is isolated and should be platform-safe.