openclaw - 💡(How to fix) Fix Race condition in `agents add` causes silent data loss

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When multiple agents add commands run in parallel (e.g., from orchestration scripts or concurrent terminal sessions), they race on the config file. This causes some agents to be silently lost or ConfigMutationConflictError to propagate to users.

Error Message

One of the agents may not appear in the config, or an error may be thrown.

  • Interactive wizard mode: catch the error and show a helpful message asking the user to re-run

Root Cause

When multiple agents add commands run in parallel (e.g., from orchestration scripts or concurrent terminal sessions), they race on the config file. This causes some agents to be silently lost or ConfigMutationConflictError to propagate to users.

Code Example

openclaw agents add --name agent1 --model sonnet &
openclaw agents add --name agent2 --model sonnet &
wait
RAW_BUFFERClick to expand / collapse

Summary

When multiple agents add commands run in parallel (e.g., from orchestration scripts or concurrent terminal sessions), they race on the config file. This causes some agents to be silently lost or ConfigMutationConflictError to propagate to users.

Reproduction

Run two openclaw agents add commands simultaneously:

openclaw agents add --name agent1 --model sonnet &
openclaw agents add --name agent2 --model sonnet &
wait

One of the agents may not appear in the config, or an error may be thrown.

Impact

  • Silent data loss (agent config not saved)
  • Poor UX when running orchestration scripts
  • Confusing errors for users running multiple terminals

Proposed Fix

PR #76601 adds retry logic similar to configure.wizard.ts:

  • Non-interactive mode: retry up to 5 times on ConfigMutationConflictError, re-reading the latest config and re-applying changes
  • Interactive wizard mode: catch the error and show a helpful message asking the user to re-run

See: https://github.com/openclaw/openclaw/pull/76601

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Race condition in `agents add` causes silent data loss