Repository navigation
fix(codex): preserve native fork identity and app policy - #137167
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 5:28 AM ET / 09:28 UTC. ClawSweeper reviewWhat this changesThis PR preserves native Codex fork identity and applies OpenClaw app-admission and approval policy across fresh, resumed, warm, and side-thread lifecycles. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 8 items remain Keep open: the new durable approval cleanup does not refresh an already-loaded native thread, so its higher-precedence app-link policy can remain active; ordinary ask-mode turns also now fail on inventory timeout despite an existing safe apps-disabled fallback. Priority: P1 Review scores
Verification
How this fits togetherThe Codex plugin translates OpenClaw’s per-turn app policy into configuration for native Codex threads. That configuration controls which connected apps can run and where their destructive-action approvals are reviewed. flowchart LR
A[OpenClaw agent turn] --> B[Codex policy builder]
B --> C[Native thread configuration]
C --> D[Codex app and approval policy]
D --> E[Connected app tool execution]
B --> F[Persistent native configuration]
F --> C
Before merge
Findings
Agent review detailsSecurityNeeds attention: The new persistent cleanup can leave a loaded native thread using a higher-precedence approval policy after the cleanup reports success. PR surfaceSource +44, Tests +967, Docs +11. Total +1022 across 29 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Reload loaded native thread configuration after a successful approval cleanup, add a pre-existing warm-thread override regression, and retain the apps-disabled fallback for ordinary ask-mode inventory timeouts. Do we have a high-confidence way to reproduce the issue? Yes from source: start a thread with a loaded app-link approval override, run the new cleanup through the warm-reuse path, and the omission of reloadUserConfig leaves that loaded configuration unchanged. Is this the best way to solve the issue? No: clearing persistent configuration alone is insufficient because Codex reloads loaded thread configuration only when explicitly requested; the ordinary ask timeout should use the already-safe apps-disabled fallback. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 74ade6f54c87. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What 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 (1 earlier review cycle)
|
c4b4213 to
eee7f47
Compare
|
Merged via squash.
|
Apply connected-app ask policy through native thread session overrides, preserving saved native preferences across warm reuse, cold resume, user-config reload, side-question forks, and scheduled turns. Remove durable approval writes, readback, and the best-effort reload dependency. Keep scheduled tool ceilings and reject legacy-managed app layers that outrank session configuration. Preserve literal JSON property names through approval projection, configuration merge, and binding fingerprints so changed dynamic schemas, app links, and MCP settings invalidate the correct binding. Share identical ordinary/scheduled policy serialization. Ordinary inventory timeouts continue with apps disabled; scheduled authority remains strict. Validation: 327 focused tests; full changed-file type, lint, boundary, dead-export, and cycle checks; independent Codex review. Real Codex 0.153.0 app-server probes with synthetic localhost services verify approval before execution, denied calls executing nothing, unchanged saved settings, apps-disabled recovery, and literal schema transport. Related: #137167. Production net -87 lines. No new user option, database schema, storage format, or protocol version. Native administrative requirements remain authoritative; exposing effective app requirements is recorded as a separate follow-up in the PR.
…7167) * fix(codex): preserve native fork identity and app policy * test(codex): clean up canonical descendant fixtures * refactor(codex): keep approval diagnostics in their owner * test(gateway): align update routing with trusted actor metadata * fix(codex): keep empty admission available and verify fork model
Apply connected-app ask policy through native thread session overrides, preserving saved native preferences across warm reuse, cold resume, user-config reload, side-question forks, and scheduled turns. Remove durable approval writes, readback, and the best-effort reload dependency. Keep scheduled tool ceilings and reject legacy-managed app layers that outrank session configuration. Preserve literal JSON property names through approval projection, configuration merge, and binding fingerprints so changed dynamic schemas, app links, and MCP settings invalidate the correct binding. Share identical ordinary/scheduled policy serialization. Ordinary inventory timeouts continue with apps disabled; scheduled authority remains strict. Validation: 327 focused tests; full changed-file type, lint, boundary, dead-export, and cycle checks; independent Codex review. Real Codex 0.153.0 app-server probes with synthetic localhost services verify approval before execution, denied calls executing nothing, unchanged saved settings, apps-disabled recovery, and literal schema transport. Related: openclaw#137167. Production net -87 lines. No new user option, database schema, storage format, or protocol version. Native administrative requirements remain authoritative; exposing effective app requirements is recorded as a separate follow-up in the PR.
Related: #137009
What Problem This Solves
Fixes an issue where users forking a canonical Codex message could fail because their completed message had no native-turn identity or inherit stale model selection, and where native per-account approval settings or a resumed thread could bypass the app policy selected in OpenClaw.
Why This Change Was Made
Codex 0.153 exposes the current loaded or latest persisted model directly on
Thread. Canonical forks now use that native fact instead of scanning historical model records. The rollout reader remains only for immutable tool metadata and bounded file/race checks. This removes 117 production lines from the reader while retaining symlink, hardlink, compressed-input, identity, and concurrent-change checks.Live UI proof also exposed a generic handoff ordering bug: a staged Gateway message was promoted after the plugin host captured its annotation capability. The host now commits approved input through the existing recorder before plugin handoff, binding native provenance to that exact user row. Retry suppression, content custody, and annotation authority remain unchanged.
Native account-link approval settings take precedence over app defaults. The app admission owner now clears and verifies those overrides alongside existing per-tool overrides for
ask. Normal starts, warm reuse, cold resumes, side questions, and scheduled intersections preserve a complete app allowlist; wholly disabled policies use Codex's native app switch. Cold resume no longer reconstructs a partial wire policy from positive binding metadata. Warm policy checks retain inventory/metadata caches and avoid unnecessary native reloads. Ordinary timeout fallback still disables apps; ask and scheduled verification stop on timeout.User Impact
Canonical message forks retain the verified native-turn identity of Gateway-originated messages and preserve Codex's selected native model and provider. This path requires Codex 0.153 metadata and reports an actionable error when unavailable; the general external-binary minimum remains 0.149. Canonical message forking is not in the latest stable release, so this removes an unshipped internal compatibility path.
askcannot be suppressed by a saved account-link reviewer/approval mode. Apps outside the admitted policy remain disabled after restart; side and scheduled runs retain their captured policy ceilings. No new operator option, database field, schema, or protocol version is introduced. Native settings must be readable before enabled policy admits app tools; per-account/per-tool approval overrides are intentionally cleared forask, while app/tool enablement and confirmed read-only tool overrides are preserved. Missing tool summaries retain the existing conservative cleanup.Evidence
Direct dependency inspection used Codex tag
rust-v0.153.0at41e22fee981a63b3698df7ed36bad393cda24715:Regression reproductions failed before the repair for staged-input annotation loss, stale model selection, account-link overrides, failed admission replay, cold/unloaded exclusion loss, unnecessary warm reload, and expired startup verification. Tests cover the corresponding fixes, original-import siblings, scheduled ceilings, binding ownership, and source-rollout races.
Real Codex 0.153 config RPC probes used disposable homes: linked approval overrides were cleared and read back; excluded apps remained disabled under the actual returned thread patch; an empty replay made zero discovery RPCs and disabled the native app feature. These probes used no credentials or inference.
Local
pnpm buildpassed. After the final mechanical module extraction, all 212 app admission/replay, side-question, and scheduled-policy tests passed again. Focused coverage passed for canonical descendants (68 tests), thread lifecycle/binding (385 tests), app admission/replay, scheduled ceilings, side questions, snapshot races, and host annotation. The staged-input regression failed before the repair and now verifies exactly one approved user message with native provenance, including suppressed retries.Authenticated live proof used real Codex 0.153.0 and
openai/gpt-5.6-lunain disposable homes. The Control UI successfully forked a canonical user message, preserved its draft, and completed a child turn. After joining Gateway shutdown and restarting it, a cold descendant fork and real turn also succeeded with the same native model/provider. The committed Gateway live test independently passed both warm/cold phases (1 passed, 2 filtered out, 34.84 seconds). Served UI and runtime source hashes were checked; test auth/state/processes were cleaned up. The video covers the UI portion; cold restart evidence comes from the real Gateway RPC assertions.Production is +540/−496 (net +44); tests/test support are +1463/−496 (net +967), and docs are +24/−13 (net +11). The model reader alone shrinks by 117 lines. Native approval cleanup and its diagnostic contract now share a focused owner, with no reverse import. The remaining growth enforces account-link approval precedence, complete policy admission, and the generic approved-input ownership boundary; the historical model scanner and partial cold-resume policy path are removed.
Changed-surface checks passed after cleaning existing lint debt in the canonical integration fixture; its full 68-case suite passed again. Independent Codex reviews are scoped-clean through P2, including the final test-only cleanup. CI caught a type-only reverse dependency in the initial extraction. Its diagnostic contract now lives with the cleanup owner; full architecture checks, typechecks, lint, and an additional independent review pass. Emitted runtime JavaScript is equivalent apart from an import-list trailing comma. The hosted Docker live/source run passed: Codex job, 2 tests passed and 1 opt-in case skipped in 71.73 seconds. It verified canonical warm/cold continuation plus the existing harness (resume/reset, subagents, image, MCP/cron, guardian, and session deletion). This lane stages source in a prepared image; the earlier UI proof used the built Gateway.
The branch was refreshed onto main
993ad304after CI exposed four stale update-routing assertions from main. Three expectation lines now retain the shared dispatcher’s trusted system actor and the exact delivery tuple; production authorization is unchanged. The repaired update and shared-dispatcher suites passed all 50 tests. Before the final review repairs, rebased canonical/lifecycle coverage passed 263 tests. The final owner checks cover 509 passing cases across seven files: the broader run passed all canonical/lifecycle/side/scheduled cases, then all 92 app-config cases passed after 15 old empty-policy expectations were updated. Full changed-surface checks passed; the final assertion/comment edits also passed targeted lint. Independent Codex review of the complete rebased branch and the final follow-up diff is scoped-clean through P2. Final candidate:eee7f4789000b61d0d9d220d591e29c2ed4fd0f8. Exact-head CI passed. A fresh build of this exact commit also passed, followed by an authenticated built-Gateway canonical warm/cold test: both phases continued on Codex 0.153.0 withopenai/gpt-5.6-luna; 1 test passed, 2 were filtered, 27.08 seconds total. Source, built artifacts, and log digests were verified, and isolated state/processes were cleaned up. The final startup lifecycle suite added 203 passing cases, bringing the focused total to 712 across eight files. The additional hosted Linux live rerun is still running and is not counted as passed.Both actionable findings and rank-up moves in the ClawSweeper review are addressed. App admission reads native settings lazily for eligible candidates; empty admission uses the shared native app-off patch. Four no-app/config-unavailable cases failed before the fix. Canonical forks now also verify the independently reported live child model; nested-mismatch and nested-null cases failed before the fix and now pass with the full 70-case canonical suite. Codex’s fork producer populates the nested model from the live child snapshot and the top-level model from initial session configuration.
The stored-data warning concerns a read-only external Codex rollout reader replacement, not a store migration: OpenClaw schemas, stored representations, and write paths are unchanged. Plain/compressed existing rollouts retain the same bounded metadata and identity/race checks. Native approval cleanup is the documented existing
askpolicy applied at its owner, with enablement and confirmed read-only overrides retained; no blanket native-settings reset is performed.Before: the canonical message cannot be forked because its local native identity is missing.
After: the fork preserves the draft and the real child turn completes.
codex-fork-video.webm