Repository navigation
Conversation
…t round
Gemini synthesizes tool-use ids as `{tool}__holon_gemini_call_{index}`, so
the first tool call of every round shares one id. SendAgentMessage keyed
delivery idempotency on the bare tool call id, so a second send to the same
target from the same in-round position hit the persisted (scope, key) row
with a different request digest and failed permanently with
IdempotencyConflict.
The runtime owns delivery idempotency, so the key is now composed as
`{assistant_round_id}#{tool_call_id}` when the executing round is known:
same-round crash-recovery replays keep resolving to the same delivery,
while cross-round sends with an identical tool call id admit as
independent deliveries. Without an assistant round the legacy bare
tool-call-id key is preserved (known collision boundary).
Fixes #4691
jolestar
commented
Nov 29, 2026
jolestar
left a comment
Collaborator
Author
There was a problem hiding this comment.
深审结论:逻辑 LGTM,CI 有一处确定性失败需修复
6 文件 +285/-4 逐文件审查完成(idempotency key 组合、无 round 回退路径、wiring、fixture 更新、单元 + 集成双套测试),修复方案与 #4691 的 Gemini 碰撞场景完全对应,未发现正确性问题。
CI 失败定性(blocking,PR 自身引入)
Rust Test (lib-a) 03:21:14Z 失败(exit 2,非测试断言失败,是分片校验拦截):
ValueError: lib compile group a contains tests owned by another group
(missing or incorrect source cfg):
tool::tools::send_agent_message::tests::delivery_idempotency_key_changes_across_rounds_for_the_same_tool_call_id,
tool::tools::send_agent_message::tests::delivery_idempotency_key_falls_back_to_the_bare_tool_call_id,
tool::tools::send_agent_message::tests::delivery_idempotency_key_scopes_to_the_assistant_round
根因:crates/holon-runtime/src/tool/host/send_agent_message.rs 新增的 mod tests 只有裸 #[cfg(test)],缺少该目录统一惯例的 shard 门控。tool 是 LIB_C_OWNERS(组 c owner),无门控的测试会编入每个 shard 的测试二进制,非 c 组的 validate_lib_group 必然失败(lib-b / misc / control 也会撞同一错误,lib-a 只是先到)。
修复(一行)
在 #[cfg(test)] mod tests 上方补门控,与同目录 timer.rs、memory_get.rs、view_image.rs 等完全一致:
#[cfg(holon_lib_test_shard = "c")]
#[cfg(test)]
mod tests {其余核实(无同类问题)
runtime/tests/agent_and_tools.rs(+200):tests/mod.rs对agent_and_tools已有组级#[cfg(holon_lib_test_shard = "a")](runtime owner → 组 a),无需逐测试门控。runtime/tests/work_items.rs(+2):仅为ToolExecutionContext新字段补assistant_round_id: Nonefixture 值。runtime/turn/execution.rs/tool/host/mod.rs/holon-tools/src/tool/spec.rs:wiring 与字段定义正确,无新增测试。
补上这一行后 CI 应恢复全绿,逻辑层面无需其他改动。
This branch has not been deployed
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.
Runtime concept changed
Delivery idempotency key ownership moves fully to the runtime.
SendAgentMessagepreviously used the provider-issued tool call id as theclient_idempotency_key. Gemini transports synthesize tool-use ids as{tool}__holon_gemini_call_{index}, so the first tool call of every round reuses one id. The second same-position send to the same target then hit the persisted(caller:target scope, key digest)row with a differentrequest_digestand failed permanently withIdempotencyConflict(#4691).Per the issue spec (#4691 (comment)), the key is now composed from the assistant round that issued the tool call:
ToolExecutionContextgainsassistant_round_id: Option<String>, populated in the turn tool-execution loop from the sameassistant_round_idsource thatExternalCommandAttemptalready uses.SendAgentMessagehost branch passes the context through, and the delivery key becomes{assistant_round_id}#{tool_call_id}when the round is known;Nonefalls back to the legacy bare tool call id (known collision boundary, documented in tests).Semantics:
Complete{replay:true}admission path; no duplicate enqueue.caller:target) andruntime_dbconflict semantics are unchanged.Non-goals (per spec): no Gemini synthetic id changes, no
responseIdmodeling, no scope changes, noruntime_dblogic changes, no other tool idempotency changes.Verification
cargo fmt --all -- --checkRUSTFLAGS="-D warnings" cargo check --all-targets(root, holon-tools, holon-runtime)cargo test send_agent_message— 7 passed (3 new unit tests on key composition; 3 new integration tests covering same-round replay, cross-round split with Gemini-shaped ids, and theNonefallback incl. the known legacy conflict boundary; existing test unchanged)cargo test agent_message_delivery— 50 passed (includesidempotency_conflict_is_typed_and_does_not_admit_twice)cargo test idempotency— 7 passedcargo test agent_message_wait— 18 passed (one first-run parallel-load flake inagent_message_wait_retries_outbox_read_and_terminal_commit_without_synthetic_failurepassed 2/2 in isolation and 18/18 on group rerun; unrelated to this change)Fixes #4691