fix(compensation): guard duplicate compensation scheduling with attempt, revision, and lifecycle checks#3925
Open
neuralmint wants to merge 1 commit into
Conversation
…pt, revision, and lifecycle checks Implements a CompensationPlanner that enforces failure fan-out invariants before committing scheduling state. Guards include: - Lifecycle state machine (PENDING → COMPENSATING → COMPENSATED|FAILED) - Attempt monotonicity (stale attempt detection) - Revision tracking (stale state detection) - Duplicate compensation gate (once COMPENSATED, no further transitions) The planner is integrated into OrchestrationEngine's error-handling path so failure fan-out triggers go through guarded transitions. Closes orchestration-agent#3924 Test plan: - 31 deterministic regression tests covering all lifecycle transitions, stale attempt/rejection detection, duplicate gate, serialization, metrics, and auditing logs. - All 62 existing tests pass with no regressions.
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
Implements a CompensationPlanner that enforces failure fan-out invariants before committing scheduling state during compensation.
Guards Added
PENDING → COMPENSATING → COMPENSATED|FAILED(with FAILED → COMPENSATING retry allowed)COMPENSATED, further transitions are rejectedIntegration
The
CompensationPlanneris instantiated in theOrchestrationEngineand invoked in the error handler path. When a task fails, the engine attempts a guarded transition toCOMPENSATING. If compensation was already scheduled (duplicate/stale), the planner raises an error and the engine logs a warning without masking the original exception.Testing
✓ 62 passedAcceptance Criteria
Closes #3924