Replace ApplyCommonActions with ActionHandler interface#332
Open
peyton-alt wants to merge 2 commits intomainfrom
Open
Replace ApplyCommonActions with ActionHandler interface#332peyton-alt wants to merge 2 commits intomainfrom
peyton-alt wants to merge 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the session state-machine transition flow to replace the “apply common actions + return remaining actions” pattern with a session.ActionHandler interface, so strategy-specific side effects can be dispatched during transition application.
Changes:
- Introduces
session.ActionHandler+session.ApplyTransition(...)and updates tests accordingly. - Updates
strategy.TransitionAndLog(...)to accept anActionHandlerand applies transitions + actions in one place. - Refactors manual-commit PostCommit/TurnEnd flows to use per-transition handlers and updates hook call sites to provide handlers (or
NoOpActionHandler).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/strategy.go | Updates the TurnEndHandler contract to provide a turn-end ActionHandler. |
| cmd/entire/cli/strategy/session_state.go | Updates TransitionAndLog to accept an ActionHandler and call session.ApplyTransition. |
| cmd/entire/cli/strategy/session_state_test.go | Adds coverage ensuring TransitionAndLog still applies phase changes even if the handler errors. |
| cmd/entire/cli/strategy/phase_postcommit_test.go | Adjusts post-commit/turn-end tests to validate emitted actions via result.Actions and apply via ApplyTransition. |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Refactors PostCommit and turn-end dispatch into ActionHandler implementations. |
| cmd/entire/cli/session/phase.go | Adds ActionHandler, NoOpActionHandler, and ApplyTransition to execute common + strategy actions. |
| cmd/entire/cli/session/phase_test.go | Replaces ApplyCommonActions tests with ApplyTransition and handler-behavior tests. |
| cmd/entire/cli/hooks_claudecode_handlers.go | Updates turn-end/session-stop transitions to pass an ActionHandler (strategy-provided or no-op). |
| cmd/entire/cli/hooks.go | Updates session-start transition to pass session.NoOpActionHandler{}. |
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.
No description provided.