ConflictPolicy
public enum ConflictPolicy
io/agentscope/core/state/ConflictPolicy.java:34–46定义Conflict 策略相关取值的枚举。位于 io.agentscope.core.state 包。核心成员包括 OVERWRITE、FAIL、APPEND_MERGE。
Policy applied when an optimistic-concurrency save of agent session state conflicts with another writer's update.
CAS failures occur at the end of a turn — the reply may already have been streamed and tool side effects may already have run — so the policy cannot roll those back. Choose explicitly:
-
#OVERWRITE— unconditional last-writer-wins (default; matches pre-versioning behaviour). -
#FAIL— throwConcurrentSessionModificationExceptionand skip the write. Recommended when a distributed session turn gate is enabled. -
#APPEND_MERGE— reload the latest baseline, append this turn's new messages, and retry CAS. Reasonable for ordinary chat turns; unsafe for compaction/summary turns.
枚举常量摘要Enum Constant Summary
| 常量Constant | 说明Description |
|---|---|
OVERWRITE | 执行 `OVERWRITE` 方法。 Unconditional overwrite (default; preserves legacy last-writer-wins semantics). |
FAIL | 执行 `FAIL` 方法。 Fail the save and surface `ConcurrentSessionModificationException`. |
APPEND_MERGE | 追加MERGE。 Reload the latest baseline, append this turn's newly added messages, and retry CAS. |
枚举常量详情Enum Constant Detail
OVERWRITE
OVERWRITE
执行 OVERWRITE 方法。
Unconditional overwrite (default; preserves legacy last-writer-wins semantics).
io/agentscope/core/state/ConflictPolicy.java:36FAIL
FAIL
执行 FAIL 方法。
Fail the save and surface ConcurrentSessionModificationException.
io/agentscope/core/state/ConflictPolicy.java:39APPEND_MERGE
APPEND_MERGE
追加MERGE。
Reload the latest baseline, append this turn's newly added messages, and retry CAS.
io/agentscope/core/state/ConflictPolicy.java:45