fix(codex): omit idle PreToolUse hook relays#94515
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 3:06 PM ET / 19:06 UTC. Summary PR surface: Source -6, Tests +23. Total +17 across 6 files. Reproducibility: yes. for source-level reproduction: current main builds synchronous Codex PreToolUse command hooks for selected inactive/default loop-detection cases, and upstream Codex executes matched command hooks as child processes. I did not run a live multi-agent load reproduction in this read-only review. Review metrics: 1 noteworthy metric.
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 detailsBest possible solution: Land this only as a scoped idle-relay mitigation after maintainer sign-off on the default hook change, and keep or split tracking for the broader relay fan-out work before treating the linked P1 issue as fully fixed. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main builds synchronous Codex PreToolUse command hooks for selected inactive/default loop-detection cases, and upstream Codex executes matched command hooks as child processes. I did not run a live multi-agent load reproduction in this read-only review. Is this the best way to solve the issue? Yes as a bounded mitigation for idle no-work PreToolUse relays; unclear as the complete solution for the linked P1 issue because explicit loopDetection and concurrency fan-out remain maintainer decision points. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5db7c3797de3. Label changesLabel justifications:
Evidence reviewedPR surface: Source -6, Tests +23. Total +17 across 6 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)
|
|
@clawsweeper re-review Updated adjacent app-server tests to pin the new default: inactive Local validation after the update:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This is materially affecting our production OpenClaw deployment, and our live evidence matches the idle Environment:
Reproduction:
Observed during one incident:
The important detail for this PR is that explicitly disabling loop detection did not suppress process creation—it only produced the Happy to provide additional redacted logs or validate a build containing this patch if maintainers need production confirmation. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(codex): omit idle PreToolUse hook relays This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Summary
PreToolUsewhen the OpenClaw relay has no local pre-tool work to do.PermissionRequestand other requested hooks intact when they still have relay work.--pre-tool-use-unavailable noopfallback from generated relay commands; empty hook arrays are now the signal that no Codex pre-tool hook should run.PreToolUsestill remains active.PreToolUseis no longer installed as a presence/noop hook; it is installed only when local pre-tool work can make a decision.Linked context
Which issue does this close?
Closes #91009
Which issues, PRs, or discussions are related?
Related #94120
Was this requested by a maintainer or owner?
No maintainer request was available to me. This supersedes #94120 with the same patch rebased onto current
mainand a corrected real-behavior proof section.Real behavior proof (required for external PRs)
PreToolUsecommand even when OpenClaw had no local pre-tool hook/policy work, causing avoidable no-op hook subprocesses on every tool call.8a7cedfeb6, running the native hook relay builders directly through the TypeScript runtime used by the repository.pre_tool_useandpermission_request, with loop detection disabled, then builds the Codex native hook config and prints the resulting hook counts and command fallback presence.PreToolUseis represented as an empty hook array when no local pre-tool work exists,PermissionRequestremains installed, and the generated config no longer contains the unavailable noop fallback.native hook relay bridge not found; that failure also reproduced on an unpatched baseline during the earlier fix(codex): skip noop PreToolUse native hook relays #94120 work and is not caused by this diff.PreToolUsecould still be installed with a noop fallback command when no local pre-tool work existed; the focused regression now asserts that this hook is not installed in that case.Tests and validation
Which commands did you run?
What regression coverage was added or updated?
PreToolUsewhen the relay reports no local work.What failed before this fix, if known?
PreToolUsehook even when no local pre-tool work existed, relying on a noop fallback instead of omitting the hook.src/agents/harness/native-hook-relay.test.tsstill has pre-existing direct bridge failures in this local environment (native hook relay bridge not found); the focused tests for this patch pass.If no test was added, why not?
Tests were added/updated.
Risk checklist
Did user-visible behavior change? (
Yes/No)No.
Did config, environment, or migration behavior change? (
Yes/No)Yes. Generated Codex hook overlay config changes by omitting inactive
PreToolUsehook commands.Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)Yes. Tool execution hook behavior changes by avoiding no-op pre-tool relay commands when no local pre-tool decision path exists.
What is the highest-risk area?
Accidentally removing
PreToolUsewhen a local policy or explicit native loop detector still needs it.How is that risk mitigated?
The relay now decides per event via
shouldRelayEvent(event), with regression coverage for before-tool policy active, loop detection disabled, loop detection explicitly enabled, and mixed event sets wherePermissionRequestremains installed.Current review state
What is the next action?
Waiting for maintainer review and CI.
What is still waiting on author, maintainer, CI, or external proof?
CI must run on the new PR. No author-side code changes are pending from my local validation.
Which bot or reviewer comments were addressed?
This PR addresses the presentation/proof problem from #94120 by using the required
Real behavior proofsection and including after-fix terminal output.