Repository navigation
fix: make A2A task admission atomic - #2792
Merged
Merged
Conversation
Signed-off-by: Eitan Yarmush <[email protected]>
Signed-off-by: Eitan Yarmush <[email protected]>
Signed-off-by: Eitan Yarmush <[email protected]>
EItanya
force-pushed
the
fix/atomic-task-admission
branch
from
September 10, 2026 16:29
1cdd7a0 to
e8db451
Compare
Signed-off-by: Eitan Yarmush <[email protected]>
EItanya
added a commit
that referenced
this pull request
Sep 20, 2026
Concurrent lifecycle retries can issue duplicate Actor mutations, and delayed callers can act after a newer operation. Keep the current lifecycle generation and non-expiring executor claim on the AgentInstance row. Claim and completion check that identity; superseded observers return an explicit conflict without touching the runtime. A successful joined caller observes current instance state while its generation remains current. Remove the separate operation-history table, serialized input/result copies, and historical lifecycle result retention. Create/Fork retries preserve instance identity and return current state without provisioning again. Deletion leaves a DELETED tombstone that reserves the owner/request ID, revokes shares, and releases runtime revision and checkpoint pins. Fork source identity survives checkpoint deletion; a generated foreign-key column pins that checkpoint only while the instance is live. Normal instance/task/share access excludes tombstones, and reused creation request IDs cannot recreate deleted compute. Read-only preparation may retry before execution is claimed. Ambiguous runtime failures and failed database completion retain the claim and resource pins, blocking conflicting lifecycle operations including Delete. Preserve pinned fork creation and per-Actor egress policy setup before publishing READY. Part 2 follows #2792. Shared A2A/checkpoint execution and multi-replica observation remain later work; live Substrate settlement has not been verified. This requires a clean database and no overlapping older lifecycle binaries. Validation: - Core internal/package suites, including SQL preparation and migration Up/Down. - PostgreSQL-backed lifecycle and store race tests covering exclusive claims, stale/ABA completions, delayed observers, ambiguous mutations, failed database completion, and egress failures. - Tombstone request reuse, task/share access, concurrent share creation/deletion, and checkpoint/revision pin cleanup. - Authenticated lifecycle service integration with real PostgreSQL and controlled Actor responses. - Go lint and diff checks. The unreleased schema is consolidated in migration 1. The existing CI migration-immutability check rejects that edit; no forward migration or policy bypass is included. Design and implementation tracker are updated locally and remain uncommitted. --------- Signed-off-by: Eitan Yarmush <[email protected]>
alexdarbyshire
pushed a commit
to alexdarbyshire/kagent
that referenced
this pull request
Oct 5, 2026
Concurrent lifecycle retries can issue duplicate Actor mutations, and delayed callers can act after a newer operation. Keep the current lifecycle generation and non-expiring executor claim on the AgentInstance row. Claim and completion check that identity; superseded observers return an explicit conflict without touching the runtime. A successful joined caller observes current instance state while its generation remains current. Remove the separate operation-history table, serialized input/result copies, and historical lifecycle result retention. Create/Fork retries preserve instance identity and return current state without provisioning again. Deletion leaves a DELETED tombstone that reserves the owner/request ID, revokes shares, and releases runtime revision and checkpoint pins. Fork source identity survives checkpoint deletion; a generated foreign-key column pins that checkpoint only while the instance is live. Normal instance/task/share access excludes tombstones, and reused creation request IDs cannot recreate deleted compute. Read-only preparation may retry before execution is claimed. Ambiguous runtime failures and failed database completion retain the claim and resource pins, blocking conflicting lifecycle operations including Delete. Preserve pinned fork creation and per-Actor egress policy setup before publishing READY. Part 2 follows kagent-dev#2792. Shared A2A/checkpoint execution and multi-replica observation remain later work; live Substrate settlement has not been verified. This requires a clean database and no overlapping older lifecycle binaries. Validation: - Core internal/package suites, including SQL preparation and migration Up/Down. - PostgreSQL-backed lifecycle and store race tests covering exclusive claims, stale/ABA completions, delayed observers, ambiguous mutations, failed database completion, and egress failures. - Tombstone request reuse, task/share access, concurrent share creation/deletion, and checkpoint/revision pin cleanup. - Authenticated lifecycle service integration with real PostgreSQL and controlled Actor responses. - Go lint and diff checks. The unreleased schema is consolidated in migration 1. The existing CI migration-immutability check rejects that edit; no forward migration or policy bypass is included. Design and implementation tracker are updated locally and remain uncommitted. --------- Signed-off-by: Eitan Yarmush <[email protected]>
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.
Concurrent replies to a waiting A2A task can both pass gateway state checks and dispatch. Move continuation admission into one PostgreSQL transaction so only one reply advances the task; identical retries return the stored task without another dispatch, and conflicting reuse of a message ID fails.
The transaction checks lifecycle, checkpoint, and active-task barriers while archiving the question and reply and recording the retry hash. Initial-message retries resolve before readiness checks, so accepted requests remain readable after suspension. Explicit Suspend uses the same instance lock and rejects active tasks. Forked histories preserve retry receipts only through the checkpoint boundary.
This is part 1 of the concurrency work. Lifecycle generations/recovery and shared execution remain separate. Admission deduplication does not provide crash-safe dispatch. The unreleased migration 1 constraint is updated to permit retry hashes on reply events; this assumes a fresh database.
Validation: