[codex] add before_agent_reply plugin hook for system turns#275
Draft
[codex] add before_agent_reply plugin hook for system turns#275
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.
Summary
before_agent_replyplugin hook that can claim a turn, return synthetic text, or swallow it silentlysystem_eventdeliveryWhy
Heartbeat and scheduler-triggered system turns previously relied on prompt conventions or direct delivery paths. This hook gives plugins a deterministic interception point for plugin-managed maintenance and background work without forcing an LLM turn.
Impact
Plugins can now own system-managed turns before agent execution starts. They can:
Root Cause
HybridClaw had
before_agent_start, but no claimable reply-phase hook for plugin-managed system turns. That left heartbeat and scheduler flows dependent on prompt-level conventions instead of an explicit plugin seam.Validation
node_modules/.bin/vitest run --configLoader runner --config vitest.unit.config.ts tests/plugin-manager.before-agent-reply.test.ts tests/gateway-service.plugins.test.ts tests/gateway-service.bootstrap-autostart.test.ts tests/heartbeat.test.ts tests/scheduled-task-runner.before-agent-reply.test.tsnpm run typecheckgit diff --checkNotes
system_eventinterception path is implemented but does not yet have dedicated test coverage