Category: spec-conformance Severity: major
Location: crates/arcp-runtime/src/runtime/server.rs:784-797; crates/arcp-core/src/error.rs:33-106
Spec: ARCP v1.1 §7.2 and §12
What
§7.2: "A reused key with conflicting parameters returns DUPLICATE_KEY." §12 lists DUPLICATE_KEY as a normative error code. The runtime instead emits job.failed with ErrorCode::FailedPrecondition, and the ErrorCode enum has no DuplicateKey variant at all. A conformant client matching on DUPLICATE_KEY will never see it. (This is distinct from issue #59, which concerns whether idempotency is enforced; enforcement now exists via idempotency_index, but the error code is wrong.)
Evidence
let mut err = Envelope::new(MessageType::JobFailed(JobFailedPayload {
code: ErrorCode::FailedPrecondition,
retryable: Some(false),
message: format!(
"idempotency key {} already bound to a different command intent",
scope.idempotency_key
),
details: None,
}));
The ErrorCode enum (error.rs) contains no DUPLICATE_KEY; nor AGENT_NOT_AVAILABLE, TIMEOUT, or RESUME_WINDOW_EXPIRED from §12.
Proposed fix
Add #[serde(rename = "DUPLICATE_KEY")] DuplicateKey (and, while there, AgentNotAvailable → "AGENT_NOT_AVAILABLE") to ErrorCode, wire as_str/round-trip tests, and change the conflict arm in spawn_tool_invoke to use ErrorCode::DuplicateKey with retryable: Some(false). Update the conformance test to assert the wire code.
Acceptance criteria
Category: spec-conformance Severity: major
Location:
crates/arcp-runtime/src/runtime/server.rs:784-797;crates/arcp-core/src/error.rs:33-106Spec: ARCP v1.1 §7.2 and §12
What
§7.2: "A reused key with conflicting parameters returns
DUPLICATE_KEY." §12 listsDUPLICATE_KEYas a normative error code. The runtime instead emitsjob.failedwithErrorCode::FailedPrecondition, and theErrorCodeenum has noDuplicateKeyvariant at all. A conformant client matching onDUPLICATE_KEYwill never see it. (This is distinct from issue #59, which concerns whether idempotency is enforced; enforcement now exists viaidempotency_index, but the error code is wrong.)Evidence
The
ErrorCodeenum (error.rs) contains noDUPLICATE_KEY; norAGENT_NOT_AVAILABLE,TIMEOUT, orRESUME_WINDOW_EXPIREDfrom §12.Proposed fix
Add
#[serde(rename = "DUPLICATE_KEY")] DuplicateKey(and, while there,AgentNotAvailable→"AGENT_NOT_AVAILABLE") toErrorCode, wireas_str/round-trip tests, and change the conflict arm inspawn_tool_invoketo useErrorCode::DuplicateKeywithretryable: Some(false). Update the conformance test to assert the wire code.Acceptance criteria
tool.invokewith the same idempotency key but different arguments yields an error carrying wire codeDUPLICATE_KEY.ErrorCodeserde round-tripsDUPLICATE_KEY.