Repository navigation
fix: reply hooks can claim ordinary agent turns - #108353
Conversation
|
Codex review: found issues before merge. Reviewed July 16, 2026, 5:32 AM ET / 09:32 UTC. Summary PR surface: Source +9, Tests +10. Total +19 across 11 files. Reproducibility: yes. at source level: current embedded and CLI runner branches dispatch Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep runner-level dispatch and once-per-turn fallback deduplication, but thread the normalized post-inline-action user body separately from the model prompt into both runners and cover the complete auto-reply-to-runner path for embedded and CLI execution. Do we have a high-confidence way to reproduce the issue? Yes at source level: current embedded and CLI runner branches dispatch Is this the best way to solve the issue? No, not as submitted. Moving ownership to the canonical runners and deduplicating fallbacks is the right shape, but the normalized hook input must remain separate from the model-facing prompt. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 57ae43a89c92. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +10. Total +19 across 11 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
Co-authored-by: Clive (OpenClaw) <[email protected]>
f336138 to
0334da7
Compare
|
Merged via squash.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfb4f39b6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function buildHandledBeforeAgentReplyPayloads(reply?: ReplyPayload): ReplyPayload[] { | ||
| return [reply ?? { text: SILENT_REPLY_TOKEN }]; |
There was a problem hiding this comment.
Strip core-only media trust from hook replies
When a before_agent_reply handler returns a payload containing trustedLocalMedia: true (easy from JS or an as any cast), this helper now forwards that internal trust bit unchanged into dispatch. The plugin SDK explicitly omits trustedLocalMedia from plugin-facing replies (src/plugin-sdk/reply-payload.ts:12), and other hook reply payload paths strip it unless they can prove the media refs were already trusted (src/plugins/hooks.ts:284), because webchat media embedding gates local audio on that flag (src/gateway/server-methods/chat-webchat-media.ts:83). Preserve metadata and the public reply fields, but sanitize this core-only flag before returning plugin-owned hook replies.
Useful? React with 👍 / 👎.
* fix: honor reply hooks for user agent turns * fix: preserve reply hook turn context * fix: gate CLI reply hooks by trigger * fix(plugins): run reply hooks once per admitted turn Co-authored-by: Clive (OpenClaw) <[email protected]> * fix(plugins): reconcile reply hooks after rebase * fix(auto-reply): dispatch hooks for active steers * test: use valid channel context shape in steer hook test --------- Co-authored-by: Clive (OpenClaw) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* fix: honor reply hooks for user agent turns * fix: preserve reply hook turn context * fix: gate CLI reply hooks by trigger * fix(plugins): run reply hooks once per admitted turn Co-authored-by: Clive (OpenClaw) <[email protected]> * fix(plugins): reconcile reply hooks after rebase * fix(auto-reply): dispatch hooks for active steers * test: use valid channel context shape in steer hook test --------- Co-authored-by: Clive (OpenClaw) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Closes #108349
What Problem This Solves
Fixes an issue where users sending a prompt that a runtime plugin can answer deterministically would still wait for an embedded or CLI-backed model when the turn was triggered normally rather than by cron.
The runner call sites restricted
before_agent_replyto cron turns. The earlier auto-reply call site could run before runtime plugins were available, so it did not reliably provide the documented pre-model interception point.Why This Change Was Made
The embedded and CLI agent runners are now the canonical
before_agent_replyinterception point for supported user, heartbeat, and cron turns. The earlier auto-reply call site was removed so a hook that declines a turn cannot execute twice. Internal/manual runs remain excluded. Existing cron handling, handled/silent replies, fail-open behavior, execution-phase reporting, identity context, and pre-resource-allocation ordering are preserved.This is a generic plugin-hook fix. It adds no plugin-specific policy, configuration, or provider dependency.
User Impact
Runtime plugins can claim ordinary user turns before model/backend execution. Deterministic workflows can therefore return immediately without unnecessary model latency, tokens, or provider cost; declining hooks continue into the selected runtime normally.
Evidence
trigger: "user"can be claimed before an embedded attempt and before CLI preparation/subprocess execution.pnpm vitest run src/agents/cli-runner.before-agent-reply-cron.test.ts src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts src/auto-reply/reply/get-reply.before-agent-reply.test.ts— 50 tests passed across 4 Vitest project shards.oxfmt --check,oxlint, andgit diff --checkon the touched surface — passed.--mode branch --base origin/main, Codexgpt-5.6-sol, high reasoning) completed cleanly after fixes: no accepted/actionable findings; overall patch correct.AI assistance