hackbot: run per-action-type hooks before recording an action - #6425
Merged
suhaibmujahid merged 1 commit intoJul 30, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
Adds per-action-type “pre-record” hooks to hackbot_runtime.actions.ActionsRecorder, allowing the runtime to enrich or reject actions centrally right before they’re appended to the recorder.
Changes:
- Introduces an
ActionHooktype and hook registration (hooks=in constructor +add_hook()). - Executes registered hooks in order during
record()and propagates hook exceptions to abort recording. - Adds unit tests covering ordering, scoping, mutation visibility, abort behavior, and hook registration semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| libs/hackbot-runtime/hackbot_runtime/actions/recorder.py | Adds hook storage/registration and runs hooks during record() before appending actions. |
| libs/hackbot-runtime/hackbot_runtime/actions/init.py | Exports ActionHook alongside ActionsRecorder. |
| libs/hackbot-runtime/tests/test_recorder.py | Adds test coverage for the new hook behavior and invariants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
suhaibmujahid
force-pushed
the
worktree-action-hooks
branch
2 times, most recently
from
July 30, 2026 00:47
3dec664 to
c07fded
Compare
suhaibmujahid
force-pushed
the
worktree-action-hooks
branch
from
July 30, 2026 02:31
c07fded to
944a526
Compare
suhaibmujahid
enabled auto-merge (squash)
July 30, 2026 18:47
evgenyrp
approved these changes
Jul 30, 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.
Resolves #6424
ActionsRecorder now takes a mapping of action type to hooks (plus add_hook for wiring one after construction). Each hook receives the fully built action dict just before it is appended and may mutate it in place; raising aborts the recording, so a hook also serves as a validation gate.
Hooks live on the recorder so the runtime can attach behaviour that cuts across action domains without every handler knowing about it.