Skip to content

fix(harness): add Codex pre-tool loop relay opt-out - #97224

Merged
steipete merged 1 commit into
openclaw:mainfrom
marchpure:fix/codex-harness-loop-detection-relay-default
Jul 15, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
marchpure:fix/codex-harness-loop-detection-relay-default

Conversation

@marchpure

@marchpure marchpure commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a narrow opt-out for Codex Harness loop-detection-only native PreToolUse relay subprocesses:

{
  tools: {
    loopDetection: {
      nativePreToolUseRelay: false,
    },
  },
}

Default behavior is preserved. If the new field is unset, Codex Harness keeps the existing native PreToolUse relay behavior unless tools.loopDetection.enabled is explicitly false.

What Problem This Solves

Codex Harness bridges Codex native hook callbacks into OpenClaw through command hooks. For PreToolUse, that can install an openclaw hooks relay command 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:

  • Adds tools.loopDetection.nativePreToolUseRelay?: boolean to config parsing and config help metadata.
  • Makes the harness relay predicate return false for loop-detection-only PreToolUse work when nativePreToolUseRelay=false.
  • Threads that decision into the Codex app-server overlay so inactive PreToolUse becomes hooks.PreToolUse=[] instead of an openclaw hooks relay --pre-tool-use-unavailable noop command hook.
  • Preserves explicit 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.
  • unset or 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.
  • CI failure investigation: check-lint only flagged one style issue in src/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:

  • Harness relay: nativePreToolUseRelay=false makes shouldRelayEvent("pre_tool_use") false.
  • Codex app-server overlay: when inactive PreToolUse hook installation is disabled, generated config contains hooks.PreToolUse=[] rather than a no-op relay command hook.

Proof Update (2026-06-29)

Current head after docs/compat update: 54c6ff15.

Validation run:

cd /tmp/openclaw-pr97224
pnpm test -- --run src/agents/harness/native-hook-relay.test.ts extensions/codex/src/app-server/native-hook-relay.test.ts

Test Files  2 passed (2)
Tests       87 passed (87)

Compatibility fix in this update: NativeHookRelayRegistrationHandle.shouldInstallInactivePreToolUseHook is 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 as false for the inactive PreToolUse hook installation path.

Runtime proof from the 4x8 Codex Harness validation run with tools.loopDetection.nativePreToolUseRelay=false and appServer.turnAssistantCompletionIdleTimeoutMs=300000:

A_codex_harness_clean completed tasks sampled so far: 7/8
backend_webhook_idempotency        exit=0 wall=393s  PreToolUse relay matches=0
fullstack_rbac                     exit=0 wall=988s  PreToolUse relay matches=0
python_cli_log_inspector           exit=0 wall=566s  PreToolUse relay matches=0
breakfast_tui_order_system         exit=0 wall=1115s PreToolUse relay matches=0
fault_tolerant_cluster_scheduler   exit=0 wall=1033s PreToolUse relay matches=0
local_devops_release_console       exit=0 wall=861s  PreToolUse relay matches=0
offline_incident_response_platform exit=0 wall=1283s PreToolUse relay matches=0

The process-tree sampler searched each completed harness leaf for hooks relay, pre_tool_use, and PreToolUse; all completed A-group harness leaves had zero matches. Live CPU while A8 was running showed Codex app-server around 1.3% and openclaw-agent around 0.9%, with high CPU coming from task-local build/test subprocesses, not native PreToolUse relay fan-out.

Docs were added for tools.loopDetection.nativePreToolUseRelay in:

  • docs/gateway/config-tools.md
  • docs/tools/loop-detection.md

The docs state the default/unset behavior remains enabled, and false only disables the loop-detection-only Codex Harness native PreToolUse relay subprocess path. It does not disable before-tool policy, trusted-tool policy, or other local tool work.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@marchpure

Copy link
Copy Markdown
Contributor Author

@steipete I found and fixed a separate Codex Harness CPU issue in this PR.

Root cause: tools.loopDetection.enabled is documented as default false, but Codex Harness native relay treated unset loop detection as enabled and installed PreToolUse native hook relays by default. On tool-heavy Codex Harness runs this spawns openclaw hooks relay subprocesses; ACP does not use this same path.

The fix is intentionally narrow: only install pre-tool relay for loop detection when tools.loopDetection.enabled === true; explicit before-tool policy still keeps the relay active.

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

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 27, 2026
@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 2:34 AM ET / 06:34 UTC.

Summary
The PR adds a tools.loopDetection.nativePreToolUseRelay option, uses it to gate idle Codex PreToolUse native hook relay installation, updates relay tests, and documents the new loop-detection setting.

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.

  • Config surface: 1 added. Adds tools.loopDetection.nativePreToolUseRelay, an operator-visible behavior switch that maintainers should accept before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #91009
Summary: This PR is a candidate mitigation for the Codex native PreToolUse relay fan-out issue, overlapping with broader idle-relay and relay-memory-guard PRs while the merged lifetime-bound fix addressed only a neighboring leak class.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Get maintainer sign-off on whether the new opt-out is the intended fix shape versus the broader open relay PRs.

Risk before merge

  • [P1] This adds a new operator-visible loop-detection config switch and changes native PreToolUse relay installation, so maintainers need to accept the compatibility contract before merge.
  • [P1] This is a narrower opt-out than the broader open idle-relay/default-behavior PRs, so merging it may leave the canonical native hook relay fan-out issue only partially addressed.

Maintainer options:

  1. Accept the scoped opt-out (recommended)
    Maintainers can merge this as a default-preserving operator escape hatch while leaving broader relay fan-out/default changes to the canonical issue cluster.
  2. Choose the broader default change instead
    Maintainers can pause this PR and prefer a broader idle-relay omission PR if the intended product direction is to stop installing no-op PreToolUse hooks by default.
  3. Require explicit upgrade scope before merge
    Maintainers can ask the author to state which existing loop-detection and policy configurations keep PreToolUse installed and which now require the new opt-out.

Next step before merge

  • [P2] Maintainers need to choose whether this config opt-out is the desired compatibility shape; no narrow automated repair remains from this review.

Security
Cleared: The diff changes config/schema/docs and native hook relay gating without adding dependencies, secrets handling, network access, CI execution, or broader shell execution paths.

Review details

Best 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 changes

Label justifications:

  • P2: This is a normal-priority PR for a bounded Codex native hook relay mitigation with compatibility review still required.
  • merge-risk: 🚨 compatibility: The PR adds a new config/default surface and changes when native PreToolUse hook relays are installed for existing Codex loop-detection setups.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from a runtime proof showing PreToolUse relay matches at zero with tools.loopDetection.nativePreToolUseRelay=false, plus focused regression tests.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from a runtime proof showing PreToolUse relay matches at zero with tools.loopDetection.nativePreToolUseRelay=false, plus focused regression tests.
Evidence reviewed

PR surface:

Source +10, Tests +52, Docs +9. Total +71 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 6 14 4 +10
Tests 2 53 1 +52
Docs 2 21 12 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 88 17 +71

Acceptance criteria:

  • [P1] Review the focused native hook relay tests added in this PR.
  • [P1] Confirm the documented tools.loopDetection.nativePreToolUseRelay upgrade behavior against existing loop-detection configurations.
  • [P1] Compare with open PRs 94515, 97350, and 95410 before selecting the canonical fix path.

What I checked:

  • AGENTS policy applied: Root policy requires direct Codex dependency source inspection for Codex-related work and treats config/default additions and provider/tool routing changes as compatibility-sensitive. (AGENTS.md:14)
  • Current main keeps native Codex relay enabled: The bundled Codex harness still passes nativeHookRelay: { enabled: true } for Codex run attempts on current main. (extensions/codex/harness.ts:75, 68ddb9744f78)
  • Current main treats PreToolUse as local work for loop detection: nativeHookRelayEventHasLocalWork returns true for pre_tool_use when before-tool policy can run or native loop detection may run, which matches the issue's reported high-frequency hook path. (src/agents/harness/native-hook-relay.ts:586, 68ddb9744f78)
  • Current main preserves inactive PreToolUse no-op command hooks: The Codex app-server relay config still installs a selected inactive PreToolUse hook with --pre-tool-use-unavailable noop rather than clearing the hook array. (extensions/codex/src/app-server/native-hook-relay.ts:252, 68ddb9744f78)
  • Upstream Codex executes hook handlers as subprocess commands: Codex's native hook command runner spawns the configured command, writes hook JSON to stdin, and waits for it with a timeout, so OpenClaw command hooks are real per-hook child processes. (../codex/codex-rs/hooks/src/engine/command_runner.rs:24, ccdfb4f342a2)
  • PR head preserves SDK compatibility: The new shouldInstallInactivePreToolUseHook callback is optional on the relay handle, so existing relay-handle consumers are not forced to implement it. (src/agents/harness/native-hook-relay.ts:115, 54c6ff159da9)

Likely related people:

  • pashpashpash: Introduced the Codex native hook relay bridge surface that this PR changes. (role: introduced behavior; confidence: high; commits: 7a958d920c88; files: src/agents/harness/native-hook-relay.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • steipete: Authored the recent no-policy native hook fallback behavior that is directly adjacent to the inactive PreToolUse path this PR gates. (role: recent adjacent contributor; confidence: high; commits: fb64546d9e6f; files: src/agents/harness/native-hook-relay.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • joshavant: Merged the native hook relay lifetime bound fix for the same issue cluster, so they have recent context on relay process lifecycle behavior. (role: recent adjacent contributor; confidence: high; commits: 14b1ebd640c6; files: src/cli/native-hook-relay-cli.ts, src/agents/harness/native-hook-relay.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • evgyur: Authored an earlier idle Codex hook relay subprocess fix in the same native relay area. (role: adjacent owner; confidence: medium; commits: 592aae3696da; files: src/agents/harness/native-hook-relay.ts, extensions/codex/src/app-server/native-hook-relay.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@marchpure
marchpure force-pushed the fix/codex-harness-loop-detection-relay-default branch from b9dd3bc to 28cd1e7 Compare June 27, 2026 09:22
@marchpure

Copy link
Copy Markdown
Contributor Author

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 origin/main and force-pushed the PR to keep it CPU-only.

Current head: 28cd1e718c348e476f234e003b29e22364fa6e82

Current PR surface:

  • 1 commit: fix(harness): avoid default Codex pre-tool loop relay
  • 2 files only:
    • src/agents/harness/native-hook-relay.ts
    • src/agents/harness/native-hook-relay.test.ts

Revalidated after cleanup:

  • pnpm exec vitest run src/agents/harness/native-hook-relay.test.ts extensions/codex/src/app-server/run-attempt.turn-watches.test.ts -> 3 files passed, 216 tests passed.
  • git diff --check origin/main...HEAD -> passed.
  • GitHub reports the PR as mergeable.

The CPU root-cause and消融 notes in the PR body still apply; only the branch hygiene changed.

@marchpure

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

PR body refreshed after branch cleanup. Current head is 28cd1e718c348e476f234e003b29e22364fa6e82; current PR surface is CPU-only: 1 commit, 2 files. Validation numbers in the body now match the clean branch run.

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@marchpure

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

PR body is now corrected as normal Markdown after the REST update. Please review current head 28cd1e718c348e476f234e003b29e22364fa6e82.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 27, 2026
@marchpure
marchpure force-pushed the fix/codex-harness-loop-detection-relay-default branch from 28cd1e7 to 802ae2e Compare June 27, 2026 09:48
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime labels Jun 27, 2026
@marchpure

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated per review discussion: the PR now preserves default behavior and adds a narrower opt-out config, tools.loopDetection.nativePreToolUseRelay=false, instead of changing the unset/default semantics. Current head: 802ae2ed.

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@marchpure

Copy link
Copy Markdown
Contributor Author

Additional config-only verification, per discussion:

We do not need tools.loopDetection.enabled=false for this CPU mitigation. The narrower setting is enough:

{
  tools: {
    loopDetection: {
      nativePreToolUseRelay: false,
    },
  },
}

Direct relay behavior matrix from current head:

unset                                      shouldRelay=true   command=relay
nativePreToolUseRelay=false                shouldRelay=false  command=noop
enabled=false                              shouldRelay=false  command=noop
enabled=true,nativePreToolUseRelay=false   shouldRelay=false  command=noop
enabled=true                               shouldRelay=true   command=relay

So nativePreToolUseRelay=false independently prevents Codex/Harness from installing the loop-detection PreToolUse relay subprocess path, while leaving the broader tools.loopDetection.enabled switch untouched.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed P2 Normal backlog priority with limited blast radius. labels Jun 27, 2026
@marchpure

Copy link
Copy Markdown
Contributor Author

@steipete This PR has been updated to the safer config-based approach we discussed: default behavior is preserved, and CPU mitigation is controlled by tools.loopDetection.nativePreToolUseRelay=false instead of changing unset/default semantics.

Current head: 802ae2ed3348dd87ba949f0cc6119fce4107dd6a; PR is mergeable. Could you please help review/merge when you have a chance?

@clawsweeper clawsweeper Bot added the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Jun 29, 2026
@marchpure

Copy link
Copy Markdown
Contributor Author

@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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime labels Jun 29, 2026
@marchpure

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 29, 2026
@marchpure

Copy link
Copy Markdown
Contributor Author

@vincentkoc Could you please take a look and merge this one if you are comfortable with the compatibility/config surface? ClawSweeper now marks it proof: sufficient and status: ready for maintainer look, and the branch is mergeable with green CI.

@marchpure

Copy link
Copy Markdown
Contributor Author

@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 proof: sufficient and status: ready for maintainer look; the remaining item is maintainer review/acceptance of the compatibility/config surface.

@marchpure

Copy link
Copy Markdown
Contributor Author

@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 tools.loopDetection.nativePreToolUseRelay=false as an operator opt-out, while preserving existing default behavior and policy/trusted-tool paths. It overlaps with the broader #91009 cluster, so the question is whether maintainers prefer this scoped escape hatch or a broader relay/default change.

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]>
@steipete
steipete force-pushed the fix/codex-harness-loop-detection-relay-default branch from 54c6ff1 to 10ece34 Compare July 15, 2026 12:20
@steipete

Copy link
Copy Markdown
Contributor

Maintainer prep is complete and this rewrite is land-ready.

What changed:

  • Moved the switch out of global loop-detection config and into the Codex plugin as plugins.entries.codex.config.appServer.loopDetectionPreToolUseRelay (default true).
  • Passed that plugin-owned setting as a prepared capability fact into the generic relay registration.
  • Suppressed only loop-detection-only and inactive/no-policy Codex PreToolUse subprocesses when disabled. Actual before_tool_call and trusted policy work still installs the relay; unknown security-sensitive hooks remain fail closed.
  • Applied the same behavior to normal app-server turns and /btw side threads.
  • Made the expired foreign-bridge test deterministic: it now distinguishes the unrelated live PID probe from the expired record that must be pruned.
  • Preserved contributor credit in signed commit 10ece34227e1f5f46674d5e3c04738a672467805.

Proof on Blacksmith Testbox tbx_01kxjreqsp0rb3bn0cc34mv3q4:

  • corepack pnpm build — passed.
  • corepack pnpm test src/agents/harness/native-hook-relay.test.ts extensions/codex/src/app-server/config.test.ts extensions/codex/src/app-server/native-hook-relay.test.ts extensions/codex/src/app-server/run-attempt.native-hook-relay.test.ts extensions/codex/src/app-server/side-question.test.ts extensions/codex/src/app-server/schema-normalization-runtime-contract.test.ts — 84 core plus 214 Codex tests, 298 passed.
  • corepack pnpm check:changed — passed in 15m34s, including core/extension types, all lint shards, plugin SDK/boundary guards, storage guard, and import-cycle check.
  • Paired real gateway → Codex app-server → cron MCP/CLI scenario with openai/gpt-5.6-luna: disabled option passed with native_pre_tool_relay_execve_count=0; identical default-config control passed with count 3.
  • Docs MDX check and git diff --check — passed.
  • Fresh autoreview — no accepted/actionable findings (confidence 0.91).
  • Exact-head GitHub CI — all 14 workflows passed, including CI, real behavior proof, security/dependency guards, CodeQL, and OpenGrep (run 29414856313).

Upstream contract checked directly at Codex 1bbdb32789e1f79932df44941236ea3658f6e965:

  • ../codex/codex-rs/core/src/tools/registry.rs:498 dispatches PreToolUse before eligible tool execution.
  • ../codex/codex-rs/core/src/hook_runtime.rs:158 builds and runs the request.
  • ../codex/codex-rs/hooks/src/events/pre_tool_use.rs:54 selects matching handlers and treats an empty set as a no-op.
  • ../codex/codex-rs/hooks/src/engine/dispatcher.rs:89 executes each configured handler synchronously.

Known proof gaps: none.

@steipete
steipete merged commit 69ef3ca into openclaw:main Jul 15, 2026
113 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 16, 2026
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]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants