fix(api): make bound agent calls idempotent#338
Merged
Yevanchen merged 2 commits intoJul 20, 2026
Conversation
AsperforMias
requested review from
KurosawaGeeker,
Yevanchen and
samzong
as code owners
July 15, 2026 22:31
Collaborator
Author
|
那个七千多lines diff的是drizzle为每次迁移生成的完整db schema snapshot |
Yevanchen
force-pushed
the
fix/bound-agent-idempotency
branch
4 times, most recently
from
July 18, 2026 16:05
6eaedb2 to
262891d
Compare
Yevanchen
force-pushed
the
fix/bound-agent-idempotency
branch
from
July 19, 2026 16:06
262891d to
8fd460c
Compare
This was referenced Jul 20, 2026
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.
Summary
Idempotency-Keyhandling toPOST /api/v1/bound/:token.409.Fixes #327.
Why
2 Session / 2 Run / 2 api_commandrows after two identical timeout attempts. The same timeout trigger now leaves exactly1 / 1 / 1and one Queue delivery.Verification
just test-file apps/api/tests/bound-agent-idempotency.e2e.test.ts- 12 passed, 0 failed, 55 assertions.just tc-package @mosoo/apijust tc-package @mosoo/dbjust db-reset-local- applied migrations0000,0001, and the new additive0002to local Wrangler D1 only.just check- exit 0; formatting, docs, lint, all typechecks, all package tests, API 1013 passed/0 failed, and GraphQL codegen check passed.deployment_agent_call_timeoutafter durable admission, then queried D1 and confirmed one reservation, Session, Run, and dispatch command.Impact
Idempotency-Key. Identical retries under the same verified capability/deployment identity recover the original work; conflicting reuse returns409.bound_agent_call_idempotency_key, its unique subject/key index, and an updated-at index through additive migration0002_bound-agent-call-idempotency.sql.Review