Repository navigation
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@steipete I found and fixed a separate Codex Harness CPU issue in this PR. Root cause: The fix is intentionally narrow: only install pre-tool relay for loop detection when Validated with targeted tests and a 5.28 CPU消融 in the PR body. Could you please help review/merge when you have a chance? @clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 2:34 AM ET / 06:34 UTC. Summary PR surface: Source +10, Tests +52, Docs +9. Total +71 across 10 files. Reproducibility: yes. source inspection plus the linked field reports show the current-main path where Codex PreToolUse can install per-tool relay subprocesses even when the local work is effectively loop-detection/no-op, though I did not run a live Codex burst locally. 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: Merge only after maintainers accept the default-preserving opt-out as the desired scoped mitigation and keep the canonical issue or related PRs tracking broader native relay concurrency/default behavior. Do we have a high-confidence way to reproduce the issue? Yes, source inspection plus the linked field reports show the current-main path where Codex PreToolUse can install per-tool relay subprocesses even when the local work is effectively loop-detection/no-op, though I did not run a live Codex burst locally. Is this the best way to solve the issue? Unclear as the final product direction: the patch is a coherent scoped opt-out, but maintainers still need to choose between this default-preserving config switch and broader open PRs that change idle relay defaults or add stronger process guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 68ddb9744f78. Label changesLabel justifications:
Evidence reviewedPR surface: Source +10, Tests +52, Docs +9. Total +71 across 10 files. View PR surface stats
Acceptance criteria:
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
|
b9dd3bc to
28cd1e7
Compare
|
Update: I noticed the initial PR branch was accidentally cut from the Codex post-tool completion branch, so it included unrelated Codex app-server commits. I rebuilt the branch from current Current head: Current PR surface:
Revalidated after cleanup:
The CPU root-cause and消融 notes in the PR body still apply; only the branch hygiene changed. |
|
@clawsweeper re-review PR body refreshed after branch cleanup. Current head is |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review PR body is now corrected as normal Markdown after the REST update. Please review current head |
28cd1e7 to
802ae2e
Compare
|
@clawsweeper re-review Updated per review discussion: the PR now preserves default behavior and adds a narrower opt-out config, |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Additional config-only verification, per discussion: We do not need {
tools: {
loopDetection: {
nativePreToolUseRelay: false,
},
},
}Direct relay behavior matrix from current head: So |
|
@steipete This PR has been updated to the safer config-based approach we discussed: default behavior is preserved, and CPU mitigation is controlled by Current head: |
|
@steipete @steipete-oai This PR is now green and merge-state clean after the minimal lint-only follow-up. Could you please review and merge when you get a chance? Thanks. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@vincentkoc Could you please take a look and merge this one if you are comfortable with the compatibility/config surface? ClawSweeper now marks it |
|
@vincentkoc @steipete Could you please help review this PR? We are Volcengine, and we hit this Codex Harness pre-tool relay CPU issue during commercialization work. ClawSweeper marks the PR as |
|
@joshavant @steipete Could either of you help choose the direction for the native PreToolUse relay cluster? This PR takes the narrow/default-preserving option: add If the scoped opt-out is acceptable, this PR is mergeable with green CI and proof sufficient. If not, I can close/supersede it in favor of the preferred relay direction. |
Move the Codex-specific PreToolUse loop relay switch into the Codex plugin, preserve policy relays, and cover both normal and side turns. Co-authored-by: marchpure <[email protected]>
54c6ff1 to
10ece34
Compare
|
Maintainer prep is complete and this rewrite is land-ready. What changed:
Proof on Blacksmith Testbox
Upstream contract checked directly at Codex
Known proof gaps: none. |
|
Merged via squash.
|
Move the Codex-specific PreToolUse loop relay switch into the Codex plugin, preserve policy relays, and cover both normal and side turns. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: marchpure <[email protected]>
Move the Codex-specific PreToolUse loop relay switch into the Codex plugin, preserve policy relays, and cover both normal and side turns. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: marchpure <[email protected]>
Summary
Adds a narrow opt-out for Codex Harness loop-detection-only native PreToolUse relay subprocesses:
Default behavior is preserved. If the new field is unset, Codex Harness keeps the existing native PreToolUse relay behavior unless
tools.loopDetection.enabledis explicitlyfalse.What Problem This Solves
Codex Harness bridges Codex native hook callbacks into OpenClaw through command hooks. For PreToolUse, that can install an
openclaw hooks relaycommand hook before every tool call so OpenClaw can run before-tool policy / loop-detection checks.On tool-heavy Codex Harness runs, the loop-detection-only path creates repeated short-lived OpenClaw CLI subprocesses. Codex ACP does not use this same native-hook relay path.
The intended fix is not to globally disable loop detection or change default behavior. It gives harness users one explicit switch,
tools.loopDetection.nativePreToolUseRelay=false, to skip the loop-detection-only native PreToolUse relay while preserving other policy and trusted-tool paths.Changes
The PR keeps the scope intentionally small:
tools.loopDetection.nativePreToolUseRelay?: booleanto config parsing and config help metadata.nativePreToolUseRelay=false.hooks.PreToolUse=[]instead of anopenclaw hooks relay --pre-tool-use-unavailable noopcommand hook.before_tool_call/ trusted policy relay behavior.No docs pages are changed in this PR; the public surface is limited to schema/help metadata plus runtime behavior and tests.
Config behavior
nativePreToolUseRelay=false: disables loop-detection-only native PreToolUse relay subprocess installation.true: preserves current behavior.tools.loopDetection.enabled=false: still disables broader loop-detection behavior, but this PR does not require that broader switch.Evidence
Current PR head before the lint-only follow-up:
3a09080f.pnpm exec vitest run src/agents/harness/native-hook-relay.test.ts extensions/codex/src/app-server/native-hook-relay.test.ts extensions/codex/src/app-server/run-attempt.turn-watches.test.ts-> 4 files passed, 228 tests passed.git diff --check-> passed.check-lintonly flagged one style issue insrc/agents/harness/native-hook-relay.ts(no-unnecessary-boolean-literal-compare); the follow-up keeps the same behavior using?? true.Regression coverage includes both layers that matter:
nativePreToolUseRelay=falsemakesshouldRelayEvent("pre_tool_use")false.hooks.PreToolUse=[]rather than a no-op relay command hook.Proof Update (2026-06-29)
Current head after docs/compat update:
54c6ff15.Validation run:
Compatibility fix in this update:
NativeHookRelayRegistrationHandle.shouldInstallInactivePreToolUseHookis optional, so external typed integrations that construct older relay handles are not forced to implement the new method. The Codex app-server side treats missing method asfalsefor the inactive PreToolUse hook installation path.Runtime proof from the 4x8 Codex Harness validation run with
tools.loopDetection.nativePreToolUseRelay=falseandappServer.turnAssistantCompletionIdleTimeoutMs=300000:The process-tree sampler searched each completed harness leaf for
hooks relay,pre_tool_use, andPreToolUse; all completed A-group harness leaves had zero matches. Live CPU while A8 was running showed Codex app-server around 1.3% andopenclaw-agentaround 0.9%, with high CPU coming from task-local build/test subprocesses, not native PreToolUse relay fan-out.Docs were added for
tools.loopDetection.nativePreToolUseRelayin:docs/gateway/config-tools.mddocs/tools/loop-detection.mdThe docs state the default/unset behavior remains enabled, and
falseonly disables the loop-detection-only Codex Harness nativePreToolUserelay subprocess path. It does not disable before-tool policy, trusted-tool policy, or other local tool work.