Skip to content

Idempotency keys do not detect payload mismatches or expire #26

@nficano

Description

@nficano

The idempotency map stores only principal|idempotencyKey to JobId. When the same principal submits the same idempotency key with a different agent, input, lease, or runtime limit, JobManager.SubmitAsync returns the existing job instead of raising DUPLICATE_KEY. The documentation also shows ArcpServerOptions.IdempotencyWindowSec, but that option does not exist and no TTL is applied to the _idempotency dictionary.

The relevant locations are src/Arcp.Runtime/JobManager.cs:28, src/Arcp.Runtime/JobManager.cs:73, src/Arcp.Runtime/JobManager.cs:107, docs/guides/jobs.md:99, and docs/guides/jobs.md:107.

Fix prompt: Store an idempotency record that includes the original request fingerprint and creation time instead of only the job id. Compare subsequent submissions with the same principal and idempotency key against the stored agent, input JSON, lease request, lease constraints, parent job id, and max runtime; return the existing job only when the fingerprint matches, otherwise throw DuplicateKeyException. Add an IdempotencyWindowSec option or remove the documented TTL claim, and add tests for identical retry, mismatched input, mismatched agent, and expiration behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:mediumMedium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions