← Back to library

Hooks 重复投递治理:用幂等键去重 agent delivery(PR #44438)

问题/场景:网络重试或并发回调会导致同一事件被重复投递,出现重复消息/重复动作。前置条件:启用 hooks 或外部回调链路,且可观测 delivery ID。实施步骤:1) 升级到含 PR #44438 的版本;2) 构造同 idempotency key 的重复请求;3) 检查系统只处理一次并记录去重;4) 观察告警与审计日志无重复 side effect。关键命令:openclaw gateway status、日志检索。验证方法:相同幂等键仅首个请求生效。风险与边界:上游若不传稳定幂等键,去重效果有限。来源归因:GitHub PR #44438。

GITHUBDiscovered 2026-03-13Author openclaw contributors
Prerequisites
  • Your integration path can set or observe idempotency keys.
  • You have a test environment to replay duplicate deliveries.
Steps
  1. Upgrade to a version containing PR #44438.
  2. Send two or more identical delivery requests with the same idempotency key.
  3. Inspect logs/side effects and confirm only first request is executed.
  4. Repeat with a new key and verify exactly-one processing again.
Commands
openclaw gateway status
journalctl -u openclaw-gateway -n 200 --no-pager
Verify

Duplicate deliveries with same key are ignored after first success, avoiding repeated external actions.

Caveats
  • Different payloads sharing one key may be dropped incorrectly if caller key policy is poor(需验证).
  • Idempotency does not replace downstream transactional safeguards.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post