feat(agent-ledger): assign close for terminal assignment closure#29
Merged
Conversation
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.
Purpose
Give orchestrators a direct way to mark an assignment
completedorabandonedafter the work it scoped is done. Before this, an assignment row could only leaveactivevia supersede or by aging out throughgc, so there was no durable signal of why the row closed and no way to free its(task, agent)slot without inserting a replacement.Summary of changes
agent-ledger assign close --assignment <id> [--outcome completed|abandoned] [--reason ...]subcommand underassign, sibling toassign update.CloseAssignment(singleBEGIN IMMEDIATEtx, SELECT-then-UPDATE), sentinelsErrAssignmentNotFound/ErrAssignmentNotActive/ErrInvalidAssignmentCloseOutcome, andValidAssignmentCloseOutcome.assignment.closedevent; promotes that type from SPEC §12.2 post-MVP to §12.1 MVP.sha256only inmetadata.close_reason_sha256and the event payload, matching the §17 privacy rule.outcome=superseded. CHANGELOG entry added.superseded, and the lifecycle boundary that active intents survive the close.Changes to review
outcome=supersededis rejected at CLI and domain. Confirm the rationale inassign_close.goand SPEC §18.3.2 holds: supersede transitions own the replacement row, so allowing it here would strand the task and break the §11.3.1 chain walk.ExitConflict (4) assignment_not_active, not a silent no-op. Check this contract is what downstream adapters want when racing a concurrent supersede.TestAssignClose_LeavesActiveIntentsAlone). Confirmgcand intent aging are the agreed sweep paths.assignment.closedinto the MVP event list (§12.1) and removes it from §12.2; downstream consumers keying on those lists may need to react.