Repository navigation
fix(codex): preserve live-thread ownership across same-build module copies - #160949
Patrick-Erichsen merged 5 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: needs changes before merge. Reviewed October 1, 2026, 6:08 PM ET / 22:08 UTC (Revision 6). ClawSweeper reviewWhat this changesThe Codex plugin preserves thread subscriptions, quota snapshots, and native-child custody across copies of the same plugin build sharing one physical client. Merge readiness⛔ Needs changes before merge - 1 item remains The repair remains necessary on current main and has sufficient native boundary proof. No introduced correctness or security defect was found, and the earlier merge-conflict blocker is resolved. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Codex plugin sends agent work to the native Codex app-server. Its client runtime tracks subscription ownership and child custody so subsequent turns and session retirement reach the original owners. flowchart TD
A[Plugin module copies] --> B[Version-scoped state]
B --> C[Physical app-server client]
C --> D[Thread ownership]
C --> E[Native-child monitor]
C --> F[Quota notifications]
D --> G[Resume or release subscriptions]
E --> G
F --> H[Shared quota snapshot]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +95. Total +108 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one version-scoped owner for each physical client’s subscriptions, quota snapshots, and child custody while preserving account and generation isolation. Do we have a high-confidence way to reproduce the issue? Yes: independently evaluated module copies reuse a build-scoped client but current main creates separate ownership registries. The supplied native baseline trace demonstrates the failure; this read-only review did not execute it. Is this the best way to solve the issue? Yes: extending the existing build-state owner repairs the producer boundary without adding competing recovery logic or weakening native unload confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6ced196f957f. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
d83b713 to
4d18cc6
Compare
|
Published repaired head: Maintainer repair and verification for the candidate based on The original PR repairs the live-thread and quota owners. Review found the same split in native-child retirement: the second module copy could not find the original monitor and left its parent pin retained. The repair moves that WeakMap into the existing build-state owner, preserving the original monitor and its exact custody. A repeated release-callback type is also deduplicated to satisfy the existing line limit without changing runtime behavior. The paired native Codex 0.158.0 probe executed real The native monitor regression fails against the original monitor runtime (0 parent-pin releases), while the same-copy control passes (1). The repaired candidate passes both and all 119 focused tests across eight files/two routed projects. Those tests include two retained temporary proof drivers; they are not 119 newly added tests. Quota notifications are deterministic transport proof, not authenticated live inference. Final static verification completed with numeric exit 0 and unchanged six-file hashes: node scripts/check-changed.mjs --base 1fdf41920c157a0156a101c613376ec33a1d9f7d -- \
extensions/codex/src/app-server/client-runtime.ts \
extensions/codex/src/app-server/rate-limit-cache.ts \
extensions/codex/src/app-server/native-subagent-monitor-runtime.ts \
extensions/codex/src/app-server/client-runtime.test.ts \
extensions/codex/src/app-server/rate-limit-cache.test.ts \
extensions/codex/src/app-server/native-subagent-monitor.close.test.tsFresh canonical isolated autoreview of the complete candidate also completed with exit 0 ( .agents/skills/autoreview/scripts/autoreview --mode local \
--base 1fdf41920c157a0156a101c613376ec33a1d9f7d \
--engine codex --model gpt-5.6-sol --thinking highPersonally inspected the pinned Codex source at Production +24/-11 (net +13); tests +96/-1 (net +95). Reusing the existing owner needs three initializer registrations; the release-type alias and grouped registry keep the plumbing small. No config, protocol, schema, or persistence surface is added. The previous ClawSweeper review had no remaining findings or rank-up moves. This repair adds native-monitor coverage after that older review, so a refresh is requested below. The incident in #157691 remains unproven, and #153031 is not established as redundant. No UI or full-Gateway proof is claimed. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Completed the remaining test-cost request from ClawSweeper revision6 at
All51 passed, source hashes/head stayed unchanged, and every child process joined. Isolated cold compilation/module loading dominates local time. Available exact-head CI timing: the first two files are in The three regressions cover distinct owner failures: original retained subscription, notification cache, native-child retirement. Existing paired real native Codex0.158.0 proof remains applicable; main integration preserves its ownership registrations and retains main's auth/test cleanup. All96 current checks are success/skipped, all3 commit statuses successful, and the required CI gate passes. The latest rank-up move is applied. This does not claim authenticated quota/provider completion or establish causation/redundancy for the related incident and recovery PR. |
|
Merged via squash.
|
…opies (openclaw#160949) * fix(codex): preserve live thread owners across module copies * fix(codex): share physical-client rate limits across module copies * test(codex): await rate-limit notification without polling * fix(codex): share native monitor ownership across module copies --------- Co-authored-by: Patrick Erichsen <[email protected]>
Related: #157691
What Problem This Solves
Fixes lost Codex thread ownership when two copies of the same plugin build reuse one physical app-server client. Later copies could register duplicate handlers, miss retained subscriptions and rate-limit updates, or fail to retire a native child’s original parent custody.
Why This Change Was Made
Use the existing version-scoped build-state owner for the physical-client runtime, release-token maps, rate-limit snapshots, and native-child monitor. The original callbacks, auth identity, weak client keys, and thread-generation checks remain authoritative across module copies. This repairs ownership where it is created instead of adding a downstream unsubscribe fallback.
User Impact
Codex sessions keep their original subscription owner and current client-owned rate-limit information across same-build module copies. Native child retirement finds the original monitor and releases its parent pin exactly once. The native unload-confirmation guard, public API, configuration, and persistent storage are unchanged.
Evidence
Paired proof used pinned native Codex app-server 0.158.0, one real OpenClaw client, two independently evaluated runtime modules, and actual
thread/start/thread/unsubscribemessages. It used isolated temporary state without credentials or model turns:The native-child retirement regression fails on the original monitor runtime: copy B releases the original parent pin 0 times instead of 1. The same-copy control passes. The repaired monitor passes both cases and the permanent regression.
The repaired candidate passed 119 tests across eight files and two routed projects, including the temporary native proof drivers, client runtime, rate-limit cache, session retirement, build-state, and native monitor suites. The final type-only release callback alias followed that run; the final six-path changed gate subsequently passed with numeric exit 0. On resume, all six candidate file hashes still matched that successful gate. Fresh canonical isolated Codex autoreview of the entire candidate passed with no accepted/actionable P0 findings.
Production LOC: +24/-11 (net +13); tests +96/-1 (net +95). The three build-state registrations express the existing physical-client ownership boundary without introducing another runtime policy or fallback.
The quota path is proved with deterministic transport notifications; no authenticated quota update or provider inference is claimed. The native proof is terminal protocol evidence, not a Control UI or full Gateway flow. The related production incident in #157691 remains causally unproven; #153031 is a separate recovery proposal and is not established as redundant.