Skip to content

fix: avoid blocking stale PreToolUse relays#94858

Closed
Frosmans wants to merge 1 commit into
openclaw:mainfrom
Frosmans:gaia/pretooluse-relay-noop-fallback
Closed

fix: avoid blocking stale PreToolUse relays#94858
Frosmans wants to merge 1 commit into
openclaw:mainfrom
Frosmans:gaia/pretooluse-relay-noop-fallback

Conversation

@Frosmans

Copy link
Copy Markdown

Summary

  • default unavailable Codex PreToolUse native hook relays to an observational no-op
  • keep unavailable PermissionRequest handling fail-closed
  • update native hook relay command and CLI tests for the stale/missing relay fallback

Rationale

When a Codex app-server subagent keeps a stale native hook relay command after the originating OpenClaw relay is gone, shell and patch tools can fail with Native hook relay unavailable.

For PreToolUse, this should not hard-block tool execution when the relay itself is missing. The relay cannot provide policy enforcement at that point, and blocking strands otherwise valid subagent work. This change preserves fail-closed behavior for permission requests while making PreToolUse unavailable handling observational.

Validation

  • git diff --check
  • local runtime smoke, before preparing this upstream patch: stale/missing PreToolUse relay falls back to no-op and Codex subagent pwd && true succeeds

Not Run

  • Targeted upstream Vitest files could not run locally because pnpm install repeatedly timed out fetching native packages from npm (@openai/codex, @github/copilot, @zed-industries/codex-acp-darwin-arm64, @lancedb/lancedb-darwin-arm64, @anthropic-ai/claude-agent-sdk-darwin-arm64).

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close this PR as superseded: the useful stale no-policy PreToolUse fallback is already implemented by the merged guarded fallback, while this branch broadens the same path into a fail-open behavior for unknown or policy-active PreToolUse relay outages.

Root-cause cluster
Relationship: superseded
Canonical: #88846
Summary: The merged related PR is the canonical safe implementation of the useful no-policy fallback, while this PR broadens that boundary unsafely.

Members:

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

Canonical path: Close this branch in favor of the shipped guarded fallback from #88846, and keep any broader restart/drain repair on the open canonical relay lifecycle issue with fail-closed policy semantics preserved.

So I’m closing this here and keeping the remaining discussion on #88846.

Review details

Best possible solution:

Close this branch in favor of the shipped guarded fallback from #88846, and keep any broader restart/drain repair on the open canonical relay lifecycle issue with fail-closed policy semantics preserved.

Do we have a high-confidence way to reproduce the issue?

Partially: source inspection shows the current fail-closed fallback and the proposed fail-open broadening, but no live stale Codex relay run was executed in this read-only review.

Is this the best way to solve the issue?

No: the broad default no-op path is not the best fix because current main deliberately records no-op only when local PreToolUse work is absent; the safe implementation already shipped through the merged guarded fallback.

Security review:

Security review needs attention: Security review needs attention because the diff broadens a PreToolUse tool-policy fallback from guarded fail-closed to default no-op.

  • [high] Unknown PreToolUse state fails open — src/cli/native-hook-relay-cli.ts:290
    Defaulting missing PreToolUse unavailable mode to noop means stale or legacy relay commands can proceed without the current fail-closed block when the relay cannot be reached.
    Confidence: 0.9
  • [high] Policy-active relay commands get no-op marker — src/agents/harness/native-hook-relay.ts:452
    Adding the no-op marker for every PreToolUse command means policy-active registrations can fail open if their relay becomes unavailable.
    Confidence: 0.88

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • steipete: Authored the merged commit and PR that introduced the guarded no-policy native hook fallback in the same files. (role: recent fallback behavior owner; confidence: high; commits: fb64546d9e6f, 76eb478ac9fe; files: src/agents/harness/native-hook-relay.ts, src/cli/native-hook-relay-cli.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • joshavant: Authored a recent native hook relay lifetime fix touching the same harness, CLI, and Codex app-server relay files. (role: recent adjacent contributor; confidence: medium; commits: 14b1ebd640c6; files: src/agents/harness/native-hook-relay.ts, src/cli/native-hook-relay-cli.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • amknight: Authored the Codex native hook relay restart and generation preservation change adjacent to stale relay behavior. (role: recent adjacent contributor; confidence: medium; commits: 42e9504114f3; files: extensions/codex/src/app-server/native-hook-relay.ts)
  • pash-openai: Authored earlier work keeping Codex hook relays live across turns in the relay lifecycle area. (role: native relay lifecycle contributor; confidence: medium; commits: 3b5dab372ac2; files: src/agents/harness/native-hook-relay.ts, src/cli/native-hook-relay-cli.ts, extensions/codex/src/app-server/native-hook-relay.ts)
  • vincentkoc: Current line blame for the guarded fallback is carried by a later SDK approval response commit in the shallow checkout. (role: recent area contributor; confidence: medium; commits: a635e979653e; files: src/agents/harness/native-hook-relay.ts, src/cli/native-hook-relay-cli.ts)

Codex review notes: model internal, reasoning high; reviewed against f26f45c050cc; fix evidence: release v2026.6.8, commit fb64546d9e6f.

@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. 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: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

  • Action: closed this PR.
  • Close reason: duplicate or superseded.
  • Evidence: durable ClawSweeper review.
  • Coverage proof: PR B carries forward PR A's core useful intent in the safer canonical form already identified by the source report, while PR A's remaining broader no-op behavior is the reviewed security regression rather than independent work that should stay open. Covering PR: fix: preserve no-policy native hook fallback #88846.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant