Repository navigation
fix(codex): restore inference with required managed hooks - #138595
freeqaz-openai wants to merge 11 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 7, 2026, 10:17 PM ET / October 8, 2026, 02:17 UTC (Revision 20). ClawSweeper reviewWhat this changesThis PR restores Codex inference with required administrator hooks, protects restricted native startup and thread reuse, and makes inference verification use chat’s workspace and sandbox policy. Example: Run a restricted Codex turn with required administrator hooks
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR contains useful managed-hook and protected-startup work that current main does not fully provide. No concrete blocking patch defect was established, and its native behavior evidence remains sufficient. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin translates OpenClaw agent turns into requests to a native Codex process. Startup and thread admission combine sandbox restrictions, administrator requirements, and saved thread identity before allowing inference. flowchart TD
A[Chat or inference verification] --> B[Workspace and sandbox policy]
B --> C[Protected native startup]
C --> D[Administrator hook inventory]
D --> E[Validate saved thread identity]
E --> F[Start or reuse admitted thread]
F --> G[Inference and managed hooks]
Technical reviewBest possible solution: Integrate the repair into current startup and thread-admission owners, reusing main’s newer bounded-hook policy; the added configuration and executable checks protect boundaries that a hook-only relaxation cannot enforce. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main excludes the system-agent path from configured managed-hook admission. The recorded native results demonstrate repaired behavior; this reviewer did not execute a reproduction. Is this the best way to solve the issue? Yes for the original owner boundary: relaxing hook rejection alone leaves ordinary-hook discovery and retained-thread identity unchecked. Integration with current main remains unverified. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5a9a6d3ae51a. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. Added test files: 14. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +676, Tests +2159, Docs +163, Other -1. Total +2997 across 47 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (19 earlier review cycles; latest 8 shown)
|
8164010 to
0ae694c
Compare
0ae694c to
3ca4716
Compare
fa01381 to
4330ebc
Compare
4330ebc to
911bcd5
Compare
Integrate the pinned main revision and reuse the verified sibling setup wait. Preserve agent-end outcomes while surfacing early attempt failures and slow phase timings. Record reclamation timing boundaries on failure without changing its responsiveness assertion.
Reuse the existing runtime-plan fixture so the synthetic workshop tool does not trigger unrelated provider discovery during startup. Preserve all context and terminal assertions, and remove the temporary timing observations now that the startup path is identified. Reuse the matching fixture correction from #139131.
Integrate main e09a265 after the completed PR CI run. Resolve the sibling setup-wait comment overlap by taking the canonical main fixture; its 15-second wait and assertions remain unchanged.
Related: #138696 — provider, sandbox, and UI fixes
What Problem This Solves
Restores Codex chat and inference verification when administrator-managed hooks are required. Verification uses the chat's actual workspace and sandbox policy. Required hooks run while ordinary user/project hooks remain suppressed.
Protected startup also respects its deadline and cancellation lifetime: slow filesystem preparation cannot postpone timeout/abort settlement or proceed to new directory creation or client acquisition after ownership ends.
Why This Change Was Made
The existing Codex startup and lifecycle owners validate native configuration, actual executable/interpreter inputs, hook policy, and stored-thread identity before pending, retained, or resumed-thread shortcuts. Protecting configuration alone would leave launch inputs and loaded threads outside the decision.
The final repair moves filesystem preparation inside the existing startup timeout operation. A current-owner assertion combines abandonment and caller authority before/after preparation and before each helper-owned directory creation. Effective app-server options return with successful startup, removing the mutable outer slot; lease, retirement, and retry owners remain intact. Already-submitted filesystem operations cannot be undone, but their completion cannot authorize new work.
Current dependency and stored-data check
Independent inspection at
4bf12e05e44043f1ff1cd2b425c656b4b7614306verified the same fs-safe 0.8.1 official archive and exact lock as the companion dependency proof. The consumed directory/canonicalization operational code matches 0.7.2; archive changes and execution limits remain separate. Historical installed/native evidence still uses 0.7.2.Stored JSON changes; SQL schema does not. The version 1 codec adds optional
managedHooksFingerprint. The runtime fingerprint adds protected cwd/policy only for protected runs; legacy/mismatched protected bindings rotate before resume. The exact-client WeakMap is process-local and needs no database migration. Current/older codec, runtime-fingerprint, artifact-map and SQLite-owner hashes still match the existing 11 codec / five fresh SQLite-process / six identity results. Older writers discard the optional digest; current code treats it as unverified, and older binaries do not enforce the new protection.User Impact and Compatibility
Protected user homes, official npm launchers, and pnpm runtime links remain supported. Native-enabled and unsandboxed turns retain existing connection behavior. Checks account for writable aliases, Windows permission metadata, and unmounted workspaces. Native overrides and package-manager/cache topology remain trusted operator state.
Compatibility decision: retain the protected-startup boundary. Restricted sandboxed sessions with native tools disabled require protected local stdio. Remote/proxy transports, native network profiles, exposed native state/runtime paths, and unsupported launchers stop before inference. Recovery guidance covers shared-plugin impact, transport/network/mount remedies, and explicit auth targeting. Prefer preserving the native-home path and narrowing exposure; selecting/copying another home is not automatic account/history migration.
Recovery is operator-controlled because these configuration shapes remain valid for ordinary consumers. Automatically changing shared settings could change other agents' server, credentials, history, or restrictions. Separate Gateway configurations support agents requiring different connection policies. No new configuration option or PR-specific dependency override is introduced. The technical readiness assessment accepts this bounded behavior: local process protections cannot be applied to an attached remote server, and silently rewriting shared settings would affect other consumers. Broader remote enforcement and automatic home migration remain separate work.
Provider fallback, sandbox cleanup, UI identity, and inference diagnostics are in #138696. Both PRs target
mainindependently; unlisted OAuth models may also need that provider repair.Review and owner involvement
The final technical assessment recommends this scope for landing. The PR author
freeqaz-openaiis a verified active member ofopenclaw/openclaw-secops, satisfying the repository's listed-owner involvement rule. Livemainrules require the passing CI gate and linear history; they do not require a separate independent approval. Existing review requests remain available. This assessment does not represent a newly submitted human approval or change the automated reviewer’s score.Evidence
Current revision:
4bf12e05e44043f1ff1cd2b425c656b4b7614306. CI: normal CI passed, including the aggregate gate. Current-head checks report zero pending or failed checks. Earlier native and installed proofs retain their stated revisions.The fixture correction passed fresh independent P0–P2 review with no actionable findings. A separate full-tree verification accepts the mechanical main integration. Matching formatting, whitespace and assertion-conservation checks pass. The published commit is signed and passed the normal commit hooks.
Current CI evidence
The actual tested merge is
e84d0b41b83013cb448bebbc176091079c476306, combining4bf12e05e44043f1ff1cd2b425c656b4b7614306with main3e4becea5e2ce38ede69e8ecf5302805ecbfc09c. The merged agent-end test is byte-identical to the reviewed fixture.Hosted validation used Node 24.20.0, pnpm 12.3.4, and a successful frozen installation of fs-safe 0.8.1 and undici 8.10.2. These are observed current-run results. The earlier cold timings and test-order differences are retained in the work record; no isolated timing profile is claimed.
Mechanical main integration
The preceding fixture-correction head
0c58c071d8746efd47b0dab0093f9c035cff5322passed full CI at test merge37323c8f7aa3d30f82a384c7f982274a1cd29e47. Main then advanced from84b79be0d1f5556df5f4d131525c7a04f3b81db1toe09a265b11112623addd4de2167ee6b34cd82719. The sole conflict was two explanatory comment lines at the existing 15-second sibling setup wait; the canonical main file was accepted and now drops out of the PR diff. An independent conservation check confirms that the refreshed tree differs from the preceding green CI merge only in the same 15 files changed by main, with every changed blob identical to main and all remaining files identical to the tested merge. The runtime-plan test correction is unchanged. Matching formatting and staged whitespace checks pass; this integration adds no custom production behavior.Runtime-plan fixture correction
The agent-end context test now supplies the existing
createCodexRuntimePlanFixture. Its nonemptyskill_workshoptool otherwise falls back to provider discovery during startup. Supplying the prepared plan keeps this context test on the host-prepared tool-policy path already used by sibling fixtures. The change removes temporary agent-end phase diagnostics and preserves the controlled clock, startup readiness/error barrier, completed/aborted/refusal sequence, ten response iterations, and all eight assertions. No production code, product deadline, dependency, or workflow changes are added by this correction.The matching change in upstream PR #139131, introduced by df715579, passed all 148 tests across 12 Codex files, with the first completed case taking 3,558 ms, at upstream head
62d0b82cddc743a854e570fe2ebc124bfded35c2. The actual job log establishes that result; the overall upstream run had an unrelated failure. This supported selecting the correction; this PR's own validation is recorded above.Earlier diagnostics measured 139.7 seconds before
turn/starton managed023b95ef; general0dd80d15passed that case in 101.5 seconds against a 120-second limit. Those timings locate the delay but do not attribute its entire duration to provider discovery. Both fixture-correction heads and both refreshed heads passed their own normal CI; the corrected completed cases took about three seconds. These are observed CI results, not an isolated timing benchmark.The sibling-setup correction is now also present on main: a 15-second succeeded-status wait with its original lifecycle and assertions. Session reclamation retains all 200,000 rows, the 500 ms heartbeat limit, and failure-only interval diagnostics; no reclamation performance repair is claimed.
Local runtime/type checks remain unavailable because the configured registry policy blocks the required fs-safe 0.8.1 graph. Normal CI has installed pinned pnpm 12.3.4, fs-safe 0.8.1, and undici 8.10.2 successfully. No registry or dependency-policy bypass is used.
The earlier pinned-main integration was conflict-free: all 41 non-overlapping managed files, including the three startup-repair files, were conserved, while four overlapping files received automatic upstream integration. Historical green checks at
dab197ba, native replay, and installed proof retain their exact revisions; the whole current production tree is not claimed identical to that revision. The documentation correction remains: pinned Codex 0.153.4 rejects--profile/-pforapp-server.Integrated installed flow
Four installed Gateway → native Codex → OpenClaw sandbox-tool → Docker turns passed with official Codex 0.153.4: initial execution, project-hook injection, reuse after injection, and Gateway restart/reopen. Every turn validates a random value available at the worker's mount path, its actual tool callback, a workspace file and completed authenticated Gateway response. Inspected mounts retain read-only skills and network isolation.
The actual tool set contains only
sandbox_exec/sandbox_process; stored bindings confirm native-tool restriction and protected native context. The same native thread and policy fingerprints survive reuse/reopen while restart replaces the native client/process. A separate native positive control executes user, project and the exact later-injected hook payload; after clearing those markers, all four Gateway turns run required managed hooks and suppress all three ordinary hooks.This is a canonical combined-candidate installation of core plus the external plugin, not either PR's standalone package. Deterministic loopback provider, synthetic credentials, fs-safe 0.7.2; no real OAuth/hosted inference. An independent reviewer checked the receipts. Gateway/provider processes, all task containers, transfer jobs and temporary remote state are cleaned up. Artifact/source details follow below.
Data-model and dependency clarification
These checks ran at
c17e8c5acf; the later startup-lifetime repair left these owners unchanged. They remain historical evidence:managedHooksFingerprint. Eleven old/current codec cases and five fresh SQLite processes cover old write → current read/write → reopen → old rewrite → current reopen. Older writers discard the field; current admission treats missing identity as unverified. Older binaries do not thereby enforce the new policy.Startup-lifetime and native proof at
dab197baCaptured pre-fix failures for delayed timeout/abort settlement and directory creation after authority ended. The final four-suite run passes 120 tests, including eight deferred-filesystem cases for deadline, timeout-triggered run abort, explicit abort, and revoked authority. Tests join the late preparation tail before asserting no new directory creation/client acquisition. Successful protected startup/restart/turn, selection retry, ordinary modes, and child-process lifetime cases pass.
A rebuilt actual-owner timer probe settles deadline and explicit abort while
realpathremains pending: timeout callback once, no client acquisition. Targeted lint, formatting, and whitespace checks pass.Seven official Codex 0.153.4 native turns completed against the repaired owners on Linux, each returning
PROOF_INFERENCE_OKand one validated inert tool callback. Actual JSON-RPC, SQLite, and hook processes produced 14 deterministic loopback Responses requests and 18 native hook notifications, without account credentials.Active-owner assertions exercised the repaired preparation path. Closing injected authority rejected lifecycle restart without an observed thread/start, thread/resume, or turn/start RPC; this is not complete Gateway-cancellation coverage.
The replay executed a new 2,244,875-byte bundle, SHA256
e211dd392b8989bff314f5b285c22a5726f82799860e64172ef5ed3835ee4017. All 573 frozen-source and 956 bundled-input hashes remained unchanged. Official 0.153.4 package integrity was verified; binary SHA25656ef98ab4032d317ab26e9b5e5a175650717351edb16ed9cde0cb6d1734d62da.Historical upgrade, recovery, and regression evidence
At
c17e8c5acf, ten native turns covered official 0.153.0 → 0.153.4 binary upgrade and exposed-user-home rejection followed by same-home bind recovery. Inference resumed with config/synthetic account-metadata hashes and full prior native history preserved. These scenarios were not rerun as the new seven-turn sequence.That candidate also passed canonical packaging, clean npm core/plugin installation, and published 2026.9.1-beta.1 → candidate 2026.9.1 upgrade on macOS arm64. Installed native Codex advanced 0.150.1 → 0.153.4; fresh/upgraded Gateways passed authenticated health and registered Codex tools. Thirteen installed-CLI recovery checks passed, including dry-run/apply, shared-setting/two-agent preservation, and explicit auth targeting. Published-CLI auth records and synthetic credential/transcript data survived. These retain their historical attribution, not byte-parity with the repaired runtime.
A copied-home negative control with the original home unavailable failed full paginated-history readback with
missing source rollout; the original fixture was restored. The native rollout resolver makes SQLite's selected path authoritative. This pre-existing limitation motivates preserving original paths until migration is independently verified.Earlier implementation validation passed 677 focused cases, 33 launch cases, four catalog-fixture cases, and a full build. The Windows materialized-entrypoint regression failed before repair and passed afterward using the actual SDK resolver, with spawn mocked. These historical checks do not replace final-revision gates.
Limits: the integrated section establishes the combined candidate on Linux; standalone and historical proofs retain their named revisions and scope. No real OAuth/hosted-model, Windows ACL, cross-platform native binary, every-package-manager, or managed-service self-update claim is made. Completed proof resources were cleaned up; no live operator state changed.
Installed candidate identity
Local union
16f96489d39dc7ea08be8c26518c13efaa02037ccontains manageddab197ba3f2085642587dcc7257fa25814a3cc9dand generalb268310405c25d893bae1f0b6d5dae69f5b5c26fproduction. All 37,913 staged source files stayed unchanged during canonical build/packaging. One later test-only fixture refactor is recorded separately; that test is absent from the tarballs.Core SHA256
cff16a53a6de91ad40d8b36665f35e9f0cbaf480c4414ef9c44d833a5a4e69c3; external pluginc41090d5975f11a1b7c5c2ce85a37a74dfc492a1b1c4d998ce49a4c2fd7f5694; executed proof119dd61bf0866cf74c0254e5d4b65850b2e949cfe32f0f0b80ee4981d8d9cf71. Installed parity verifies 9,782 core payload files and 74 plugin files; the documented package lifecycle removes its separate pending sentinel. Four completed responses and eight main-phase provider POSTs passed. The nonce proves routing/effect, not secrecy from a malicious Gateway.Upstream CI dependency verification
The actual GitHub test merge also consumes upstream fs-safe 0.8.1. Its official artifact matches that merge's lock integrity; the used directory/canonicalization operational closures are byte-identical to 0.7.2. All 13 published-export cases pass on 0.8.1, plus four archive scenarios run against each version. Archive implementation changes are kept separate from that equality: 0.8.1 improves hardlink-destination preservation and final directory permissions in the exercised cases. This does not relabel the installed 0.7.2 package as a 0.8.1 Gateway proof.