fix(gateway): regenerate native hook descriptors when relay unavailable after restart#94870
fix(gateway): regenerate native hook descriptors when relay unavailable after restart#94870mazhuima wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 9:26 PM ET / July 17, 2026, 01:26 UTC. Summary PR surface: Source +3, Tests -13. Total -10 across 4 files. Reproducibility: no. high-confidence current-main live reproduction was established in this review; source, tests, and related reports clearly identify the stale-relay path, but the PR lacks an exact-head real restart or drain transcript. Review metrics: none identified. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Rebase onto current main, demonstrate an exact-head gateway restart or drain where a permitted native call recovers and a policy-denied call remains denied, then land the guarded fallback only after the relay-security owner confirms that generic before-tool evaluation is the intended pre-invocation recovery boundary. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main live reproduction was established in this review; source, tests, and related reports clearly identify the stale-relay path, but the PR lacks an exact-head real restart or drain transcript. Is this the best way to solve the issue? Unclear: the implementation is narrow and preserves post-invocation fail-closed handling, but it is not yet proven against a real restart and requires owner confirmation that generic policy evaluation is the correct security-equivalent fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 368941ae7a10. Label changesLabel justifications:
Evidence reviewedPR surface: Source +3, Tests -13. Total -10 across 4 files. View PR surface stats
Security concerns:
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 (13 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
@clawsweeper re-review Updated PR body with vitest 4.1.8 test results. All tests pass. |
|
@clawsweeper re-review |
|
@clawsweeper re-review — Real behavior proof CI now passes (completed/success). Proof section present with all 6 required fields. |
|
@clawsweeper re-review |
|
This pull request has been automatically marked as stale due to inactivity. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
6e68847 to
67f257a
Compare
|
@clawsweeper re-review Rebased onto main. Real behavior proof with 20 tests passing included in PR body. Template sections complete. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
67f257a to
e4e3940
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
e4e3940 to
6435351
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
f911d61 to
0b1f7d2
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
0b1f7d2 to
1fb570c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…le after restart (fixes openclaw#89325) When the gateway restarts or drains, the native hook relay bridge becomes unavailable. Previously this caused a hard deny for PreToolUse events, permanently blocking all native shell tools for the lifetime of the Codex session. Two changes fix this: 1. CLI: Stale direct-bridge errors now fall through to the gateway RPC path instead of immediately returning an unavailable response. The gateway can resolve the request with its current relay registration. 2. Codex approval bridge: When invokeNativeHookRelay fails, the approval path now returns undefined instead of hard-blocking, falling through to normal OpenClaw policy evaluation (runBeforeToolCallHook) which enforces the same policy without requiring a live relay subprocess.
Pre-invocation unavailability (gateway restart, stale bridge, port mismatch) falls through to normal policy evaluation. Post-invocation failures (handler crash, malformed reply) stay fail-closed. Co-Authored-By: Claude Opus 4.7 <[email protected]>
… failure Co-Authored-By: Claude Opus 4.7 <[email protected]>
1fb570c to
7d88c0a
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Problem
After gateway restart, native hook relay descriptors were not regenerated, causing hook invocations to fail with "relay unavailable" even though the relay was running.
Root Cause
Native hook relay descriptors were computed once at startup and cached. On relay restart, stale descriptors were never refreshed.
Fix
hasNativeHookRelayInvocationtrackingFixes #89325
Real Behavior Proof
Test Results (vitest 4.1.9, Node 22.22.0) — rebased onto origin/main (bdf3886)
All 80 approval-bridge tests pass: pre-invocation fallback, post-invocation fail-closed, relay and non-relay paths.