Repository navigation
fix(codex): isolate hook imports and cancel disconnected waits - #147444
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. |
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin, a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:08 PM ET / 23:08 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR isolates Codex hook subprocess imports, cancels disconnected callback waits while preserving shared approval ownership, and updates managed Codex to 0.154.0. Merge readiness✅ Ready for maintainer review The PR remains useful and has no identified blocking defect. The earlier documentation finding is addressed, and the verified test merge resolves the previous conflict blocker. Current main does not contain the central changes. Priority: P2 Review scores
Verification
How this fits togetherCodex native tool hooks call OpenClaw’s relay through direct HTTP or authenticated Gateway fallback. The relay applies tool policy and approval decisions before returning a response to Codex. flowchart LR
A[Codex tool hook] --> B[Isolated relay process]
B --> C[Direct HTTP or Gateway fallback]
C --> D[Current relay authority]
D --> E[Tool policy and shared approval]
E --> F[Native hook response]
C --> G[Request disconnect]
G --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +154, Tests +2021, Docs 0, Config 0, Other +7. Total +2182 across 35 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one relay policy owner with request-scoped cancellation and lazy fallback, while retaining incident-scale performance work in the existing timeout issue. Do we have a high-confidence way to reproduce the issue? Yes for disconnected waits: current main omits connection cancellation from relay invocation, and the focused cases exercise that boundary. The original CPU/RPC timeout has not been reproduced against unmodified current main here. Is this the best way to solve the issue? Yes for the stated scope: the patch extends existing request and approval owners, preserves public deduplication and fallback, and separates the import graph without adding another policy implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fa5b2d16805c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Isolate the native hook relay build graph while preserving direct callbacks and authenticated Gateway fallback. Retire request-owned policy waits and approval claims without cancelling surviving duplicate callers or retained child ownership. Fixes #91009
Use the canonical main planner without reconstructing task authority from quoted history. Preserve projected worker recovery as a separate follow-up; the native hook repair and version fixture remain unchanged.
ba556f4 to
ec63d24
Compare
|
Merged via squash.
|
…law#147444) Isolate the native hook relay build graph while preserving readonly state lookup, explicit policy decisions, and the lazy authenticated Gateway fallback. Cancel disconnected request waits through the existing approval authority. Keep duplicate callers independently cancellable, retain unbound durable approval deduplication, and detach exact relay-owned entries before callbacks so old cleanup cannot remove a successor. Observe already-started promises when synchronous cancellation wins. Update managed Codex to the official 0.154.0 release and align its version fixtures and current documentation. This improves lifecycle ownership and reduces the relay import closure; it does not cap hook concurrency, prove faster bursts, or establish resolution of the historical constrained-host timeout. Related: openclaw#91009 Thanks to @nvtoroy for the constrained-host captures and guarded opt-out evidence in openclaw#121668 and openclaw#111205. The opt-out proposal remains distinct and unimplemented by this change.
Related to #91009. The original constrained-host timeout report remains open; this PR does not establish its resolution.
What Problem This Solves
Matched Codex tool bursts repeatedly load the native hook relay, while disconnected callbacks can leave policy or approval work running beyond the request that needed it.
User Impact
Policy callbacks remain enabled, with the existing direct relay, authenticated Gateway fallback, and explicit denial behavior. Managed Codex moves to the official 0.154.0 release. There are no new configuration keys, protocol fields, or database migrations.
Observed result: all four matched A/B/B/A runs and the installed relay package proof passed. The isolated graph is smaller, but the 20-call candidate turns were slower in this bounded comparison. Both variants contain the same request/approval lifecycle repair; this is a bundling-only comparison, not a main-versus-fix reproduction of the reported timeout. The installed host and source-matched official Codex plugin also passed the original loop-detection-only setting with 1/5/20 native calls, no custom policy handler, and health/status below the 10-second incident deadline. This is bounded operator proof, not an unmodified-main-versus-fix reproduction. These measurements and packages belong to the historical source snapshots below. The resolved main integration has also passed fresh public build, tarball, installed direct/fallback, and installed host/plugin loop-only proof. Exact-head CI and the final review passed; this PR landed as
3a997793.Why This Change Was Made
The dedicated relay entry already shipped in the earlier startup fix, but remained in the large shared output graph. Give it a separate split build graph so its Gateway fallback stays lazy.
Keep cancellation at the request and approval owners. HTTP disconnect and Gateway connection cancellation abort the disconnected request’s wait and retract its owned approval when its last waiter leaves. Duplicate approval callers share one request with independent waits; the existing bundled host capabilities retract only the owned approval claim when its last waiter leaves. Generic registrations retain pending durable approval deduplication until decision or expiry. Cancellation rejects the caller’s wait; it does not prove rollback or forcibly stop arbitrary asynchronous plugin computation. That request-lifetime contract is intentional and covered by the late-completion and surviving-sibling controls.
Approval keys now use structural tuples and exact relay ownership. Teardown detaches pending entries before cancellation callbacks, so a callback-created successor survives old cleanup. The shared abort helper also observes an already-started promise when cancellation wins synchronously, preventing an unhandled rejection.
Owner and compatibility details
Review dispositions
ClawSweeper’s active-version P3/rank-up is addressed across all six affected guides; historical 0.153.4 probe results and explicit source citations remain unchanged. Its cancellation risk is accepted as the wait-versus-rollback contract above. Its performance/incident risk is retained as a limitation: this PR claims import isolation and lifecycle ownership, not faster bursts, bounded process count, or resolution of the original timeout. The issue and the distinct opt-out proposal remain open.
Evidence
Current integrated source: exact head
ec63d2400f88c302d98061a6585fbba86a0305bfpassed 317 existing mock-provider tests locally and 127 Linux lifecycle/authority/retention/private-completion tests across eight files. Production and test plugin types passed. Both full P0–P3 review passes were scoped-clean. Targeted lint passed. Its fresh clean public build passed in 224.8 seconds; packing, inventory and tarball checks passed in 269.126 seconds total. The new relay closure has eight static files / 317,749 bytes (SHA-256505b9442452d0393aff91cc70dbefa39c07dbbb864317aba2f9bed4dbca4bccf). Fresh installed direct/fallback and native-loop proof also passed, as detailed below. Exact-head hosted CI completed successfully (126 successful jobs and 14 intentional skips). Its completed preflight checked out mergefce3ab824763c92387d0dedf521f406f985d8977, treecf7c168f5a4ec3b283e665f823f12b94fd32db99, combining this head with main911d14243e71e3b0fe6c9796783196ac1413f734; all four QA profiles passed on that run.Fresh installed artifacts and original-setting control: the clean public tarball is SHA-256
ef8ac8d6eca04f3e9f700ba08a1bcdacc7f10842aa3b4035c100a24805fdd498. Installed direct allow/deny each delivered exactly one callback without loading the fallback chunk; authenticated fallback allow/deny loaded it and delivered one callback. The readonly locator remained byte-identical; missing locators were not created; an invalid token produced explicit denial; generated commands selected the installed entry; cleanup passed. That transport fixture uses a source Gateway. Separately, the canonical selected-plugin artifact (SHA-25668934af25b34ab7a5de2741db4a2edf12ed66f9a1615d6db57425252f92b5faa, 137 files) was installed through the verified candidate registry and normal exact npm selector withtrusted-officialcatalog trust. The actual installed Gateway and source-matched Codex plugin completed all 26 unique native calls across 1/5/20 loop-only workloads with exact PreToolUse IDs, exit 0, and file readback; no custom policy or synthetic delay. On two CPUs, health maxima were 325/79/44 ms; status maxima were 1182/95/74 ms, all below 10 seconds. Native executable SHA-256 remained3188814c…40022. Each workload and final Gateway cleanup had zero observed/discovered live or zombie relays. All 9,641 installed host dist files and package.json remained unchanged. The model is a source QA fixture; shell execution is the real official native binary using the documented per-call non-login option. The batch completed successfully; a later portal-metadata sync warning did not change its exit-zero execution result.Historical integrated focused proof: 223 redaction tests, 7 shared-state cleanup tests, and 13 authority/real-Gateway tests passed on the projection below. Core, the exact Gateway test stripe, and full plugin typechecks passed. The private QA build passed in 263 seconds. The subsequent control build passed in 258 seconds. In this Testbox run, baseline matched 1/5/20-tool allows, a deny, and the no-hook control passed; the unmatched first write failed with EROFS and native exit 1. Those failed rows remain retained. A subsequent finite host/native diagnostic established the fixture cause described below; the corrected A/B/B/A and public-package batch passed.
Historical owner proof: the adf snapshot passed 217/217 Linux tests; d4 passed 236/236. Local helper/lifecycle proof passed 41/41, and the unchanged synchronous-abort reproducer changed from exit 1 to exit 0. These are exact-snapshot receipts, not measurements of the integrated runtime.
Historical gates/review: adf passed core/UI types and the other applicable gates; its test-only typing failure was corrected in 5dec, which passed all 18 core-test stripes plus extension, scripts, root-test and changed-test lint commands (22/22). Both 5dec P0–P2 review passes were scoped-clean. Both complete P0–P2 review passes on final original source
a8527b38were scoped-clean, including the main-aware authority assertion and strict native output/file checks. Final source verification passed. The final uniform non-login fixture delta also passed a complete P0–P2 review with no findings; this is delta review, not a replacement for the preceding full-source review. The candidate runtime repair remains the same; these historical reviews do not qualify later main integration or its emitted artifacts.Official native identity: Linux x64 package integrity and SHA-1 were checked against npm metadata. Its canonical extracted executable is SHA-256
3188814c35471432d4123203e0eb38e5bddc60226e3d7ddf0e59e649ea140022, reportingcodex-cli 0.154.0. The integrated lease resolved the same bytes, and the completed workload controls observed that executable digest.A/B/B/A: fixed integrated runtime, Node24.19, official Codex0.154.0, compile cache disabled, actual inherited two-CPU affinity, two interleaved repetitions per graph. All24 scenario cases passed (matched1/5/20 allows, deny, unmatched and no-hook); identical duplicate log lines are not extra repetitions. Health RPCs had no errors (maximum403ms), and observed/discovered relay identities reached zero live and zombie processes after each case and Gateway stop. Static local closure: A74 files/447,947 bytes; B8 files/315,210 bytes. Single-relay sampled peaks: A97.8–98.3MiB, B95.1–95.4MiB. Twenty-call turn times: A2.45/2.87s, B3.14/3.56s. These samples do not establish faster turns or lower aggregate peak RSS; sampled concurrency differed, and no process-count cap was introduced.
Historical public package: clean public pack and isolated npm installation passed. Tarball SHA-256
df21f66f419e4758bd0befa38a7820e331685a9754ff73320137f25abd0f1df9. Installed direct allow/deny each delivered one callback without loading the Gateway fallback chunk; authenticated fallback allow/deny each delivered one callback and loaded that chunk. The readonly locator remained byte-identical, missing locator files were not created, invalid token returned explicit deny, generated commands selected the installed entry, and owned children/Gateway settled. The Gateway for this transport packaging proof is a source fixture.CI fixture alignment and upstream QA repair: the media-path fake server advertised 0.153.4 after the managed pin moved to 0.154.0; its producer alignment passes 12 focused tests without weakening assertions. The original visible→silent QA failure was an unchanged mock-planner history bug. Upstream #147206 now owns that classifier repair; the complete mock-provider implementation and tests in this branch are byte-identical to frozen main
46aa369b315196a0ec57f6e171e97defbe64e18e. All 317 existing server/Responses tests pass after integration. Historical head1123429passed full CI, including QA profiles 1–4; profile 4 job103801199482passed the original visible→silent order on mergeab311a59ab7cd3e68b56bf1fd2dfc1c94b882a19. That success does not substitute for new-head CI.Named follow-up — projected QA worker recovery: main does not recover a quoted empty-worker task on explicit continuation. A proposed recovery also lost projected tool/completion ownership and could repeat a completed write, so that entire adjacent change was removed from this PR. The strict missing-write and repeated-write failures are retained. A future canonical recovery must preserve execution authority rather than infer it from lossy quoted history. This is independent of the native upgrade:
context-engine-projection.tshas identical blob264e86dd66fc3a4e09fcbd036481d6313f680f49at pre-upgrade81d0, frozen main46aa, and this head.Historical installed host/plugin pairing and loop-only proof: the initial mismatch paired the unpublished candidate host with the published
@openclaw/[email protected]plugin, which still uses native 0.153.4 and the old SDK export. The released host tag exports that old name; a shipped-pair compatibility failure was not established. The rename predates this PR in #144828. The canonical selected-plugin packer then built the matching candidate artifact (SHA-256b8b789be4c69aa92f1804643605fc574b8361d4a233eb317bac923ef13de9249), installed through the verified prerelease registry and normal exact npm selector. Catalog trust wastrusted-official; all 136 plugin files matched, the native dependency was 0.154.0, and the SDK resolved to the installed candidate host. The real installed Gateway completed native 1/5/20-call turns with loop detection enabled, no custom before-tool handler or synthetic delay, exact 1/5/20 PreToolUse call IDs, exit-zero and file readback. On two CPUs, health maxima were 224/64/206 ms and status maxima 807/74/184 ms. Actual native executable bytes matched3188814c…40022. Each scenario and final Gateway cleanup had zero observed/discovered live or zombie relays. All 9,535 installed host dist files and package.json were unchanged. This is a two-artifact installed proof; the provider remains the source QA fixture.Source attribution and proof limits
ec63d2400f88c302d98061a6585fbba86a0305bf; diff SHA-256a77df6e58210299095d476ccc673dbe7592a60892acbb68e602c039e064f837d, treef956a7e6bcc48406f6e71939998267cb99e0e6c8, frozen main base46aa369b315196a0ec57f6e171e97defbe64e18e; 35 changed paths. The normal validation checkout has this exact commit/tree. Both complete P0–P3 final-source review passes returned no actionable findings, and final source verification passed. Fresh public build/pack, installed direct/fallback, and source-matched installed native-loop checks passed; exact-head CI and the current ClawSweeper review passed with no actionable finding or remaining pre-merge item.dce90ac5d49649b820b0bfc2daed5fc8ec3faf5a1d2b5edb7d0c70ce0d17a3be, treef76536fbcf86306ee51465812f9e18ff07245949; earlier A/B and public relay package proof used projection3e818baa/ tree383f00cc, with identical public runtime/build/dependency bytes. Those projections used main1a0e78fc8a794af4e16d37e82147592dd707ab0band remain historical evidence. Main now adds Gateway ownership heartbeat, activity packaging, and a platform-gated FreeBSD identity loader reachable from the cold client; the fresh integrated public artifacts and lifecycle proof above cover those changes. The old artifact hashes do not qualify the new combined tree.0c3f6038/ tree7e3ab9ee. Only the pressure test changed afterward; its runtime, configuration, lockfile, Node version, and every measured local import file remain byte-identical.pwdleft the requested workspace, non-loginpwdretained it, both exit 0. This establishes a host login-startup cwd effect, not a permission-materialization defect. The fixture now sets the existing per-calllogin: falseoption for every scenario; no product, policy, sandbox grant or Codex contract changed. Instrumented timings are excluded from performance claims. Dependency source: login selection, advertised login option, snapshot shell wrapping.