Repository navigation
Add Codex native hook relay memory guard - #97350
safetybanana wants to merge 2 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 28, 2026, 5:18 AM ET / 09:18 UTC. Summary PR surface: Source +410, Tests +235, Docs +38. Total +683 across 10 files. Reproducibility: yes. for source-level reproduction of the current relay pressure class: current main installs synchronous Codex command hooks, and upstream Codex spawns selected handlers as child processes; the PR's improved behavior is not proven in a real pressure run. Review metrics: 1 noteworthy metric.
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
Security Review findings
Review detailsBest possible solution: Fix the stale-relay fallback defect, add regression coverage for resume-failure plus denied guarded start, then require redacted real gateway pressure proof and maintainer approval of the config/security contract before merge. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction of the current relay pressure class: current main installs synchronous Codex command hooks, and upstream Codex spawns selected handlers as child processes; the PR's improved behavior is not proven in a real pressure run. Is this the best way to solve the issue? No for the current patch: memoryGuard is a plausible opt-in mitigation, but the stale relay bug must be fixed and maintainers still need to choose whether this config surface is the right long-term boundary versus #94515 or a lighter relay design. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d17b970bb50d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +410, Tests +235, Docs +38. Total +683 across 10 files. View PR surface stats
Security concerns:
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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
plugins.entries.codex.config.appServer.nativeHookRelay.memoryGuard/btwside-question turnsWhat Problem This Solves
On memory-constrained Gateway hosts, multiple Codex native hook relay helper processes can exist concurrently and each can consume hundreds of MiB. OpenClaw already has a disabled native hook relay config path; this patch makes relay installation conditional so low-memory hosts can degrade per turn instead of compounding pressure.
The guard is opt-in, so default behavior is unchanged.
Behavior
When
memoryGuard.enabledis true, OpenClaw checks:memory.current/memory.max) when bounded/proc/meminfoMemAvailablefallbackIf a configured threshold is exceeded, OpenClaw sends
features.hooks=falseplus empty native hook arrays for that turn. The model call can continue, but Codex-native hook relay behavior is not installed for that turn.Example:
Tests
node scripts/run-vitest.mjs run extensions/codex/src/app-server/native-hook-relay.test.ts --maxWorkers=1node scripts/run-vitest.mjs run extensions/codex/src/app-server/config.test.ts --maxWorkers=1node scripts/run-vitest.mjs run extensions/codex/src/app-server/run-attempt.native-hook-relay.test.ts --maxWorkers=1git diff --check HEAD~1 HEADEvidence
Local focused validation on the source branch:
native-hook-relay.test.ts: 13 tests passedconfig.test.ts: 109 tests passedrun-attempt.native-hook-relay.test.ts: 19 tests passedgit diff --check HEAD~1 HEAD: cleanThe implementation uses the existing disabled relay overlay (
features.hooks=false, empty hook arrays), so guarded degradation reuses the already-supported clearing path instead of introducing a new Codex config shape.Notes
Raw
pnpm exec vitestwas not used for final validation because it spent several minutes in bundler startup on this host. The repository test wrapper was used instead.