Category: spec-conformance Severity: major
Location: src/Arcp.Runtime/JobContext.fs:111-125
Spec: ARCP v1.1 §8.4
What
Spec §8.4 says 'chunk_seq (REQUIRED): 0-based monotonic chunk index per result_id. The chunks for one result_id MUST be emitted in order.' The runtime accepts any chunkSeq the agent supplies, in any order, for any result_id, and emits it verbatim. The client-side ChunkAssembler rejects out-of-order chunks but the runtime has no equivalent invariant check.
Evidence
member _.EmitResultChunkAsync (resultId: ResultId, chunkSeq: int64, data: ReadOnlyMemory<byte>, encoding: ChunkEncoding, more: bool, _ct: CancellationToken) : Task =
let encoded =
match encoding with
| ChunkEncoding.Utf8 -> Encoding.UTF8.GetString(data.Span)
| ChunkEncoding.Base64 -> Convert.ToBase64String(data.Span)
emit (JobEventBody.ResultChunk(resultId.Value, chunkSeq, encoded, encoding, more))
Proposed fix
Track per-result_id expected next chunkSeq and more/closed state on the JobRecord (or in JobContext). Reject (raise ArcpException InternalError) if chunkSeq != expected, if encoding is not Utf8|Base64 (already enforced by DU), or if a chunk arrives after a more=false chunk on the same result_id.
Acceptance criteria
Category: spec-conformance Severity: major
Location:
src/Arcp.Runtime/JobContext.fs:111-125Spec: ARCP v1.1 §8.4
What
Spec §8.4 says 'chunk_seq (REQUIRED): 0-based monotonic chunk index per result_id. The chunks for one result_id MUST be emitted in order.' The runtime accepts any chunkSeq the agent supplies, in any order, for any result_id, and emits it verbatim. The client-side ChunkAssembler rejects out-of-order chunks but the runtime has no equivalent invariant check.
Evidence
Proposed fix
Track per-result_id expected next chunkSeq and
more/closed state on the JobRecord (or in JobContext). Reject (raise ArcpException InternalError) if chunkSeq != expected, if encoding is not Utf8|Base64 (already enforced by DU), or if a chunk arrives after amore=falsechunk on the same result_id.Acceptance criteria