Skip to content

fix(codex): revoked or reassigned requesters can still start native Codex turns - #176352

Merged
steipete merged 1 commit into
mainfrom
codex/stab-codex-native-authority
Oct 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/stab-codex-native-authority

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Codex native thread and turn dispatch proceeding after the requester's prepared policy is revoked or its parent lineage is reassigned.

User Impact

Revoked or reassigned requesters are rejected before new native effects, including /btw; unchanged authorized requesters continue normally. No configuration change or migration is required.

Why This Change Was Made

The existing native execution-policy owner captured execution-host fields but omitted the requester policy and lineage, and native write admission did not consume its retained source assertion. Retain those fields and use the same source at thread start/resume, turn dispatch, and /btw startup, hook, fork, and turn boundaries. Completed-answer settlement and cleanup retain their existing authority.

This extracts only the native-authority fix from #174774. It keeps the existing V2 contracts and introduces no SDK, protocol, schema, cache, or web-search preparer changes. Production is +31/−11 lines (net +20) across four files; the growth is the explicit requester fields and effect checks, partly offset by removing duplicate /btw wrappers. Tests are +274 lines: the regression is +262 and the provider-review fixture gains its required typed native policy (+12). Routing is +1 and docs +5.

Evidence

The same production-path regression ran with unchanged main production code and then with only the four-file fix applied. The test uses persisted requester updates, real host/lifecycle admission, and physical JSON-RPC writes to a synthetic server. Counts below are native thread requests / native turn requests during the tested operation; resume and /btw setup is excluded.

Scenario Unchanged main With fix
Allowed start, resume, and /btw (3 cases) 1 / 1, completed 1 / 1, completed
Revoked/reassigned before thread start (2) 1 / 1, completed 0 / 0, rejected
Revoked/reassigned before thread resume (2) 1 / 1, completed 0 / 0, rejected
Revoked/reassigned before turn dispatch (2) 1 / 1, completed 1 / 0, rejected
Revoked/reassigned before /btw fork (2) 1 / 1, completed 0 / 0, rejected
Revoked/reassigned before /btw turn (2) 1 / 1, completed 1 / 0, rejected

Before: 10 failed, 3 passed, 75.93s wall. After: 13 passed, 76.08s wall. Each run used OPENCLAW_VITEST_RUNTIME=node pnpm test extensions/codex/src/app-server/run-attempt.native-authority.test.ts --maxWorkers=1 with isolated temporary state. The after run spent 65.53s in Vitest; 40% was actual test time. The real storage/lifecycle/wire boundary is necessary to detect this bypass; a policy-only unit test cannot prove that no request was sent. CI timing is not yet available.

The regression disables hosted web search and revokes native exec policy, isolating native admission from the separate web-search preparation defect. It does not prove hosted-search execution, re-resolve every ancestor policy edit, or cancel a turn already accepted by Codex. No live OpenClaw provider inference or Gateway was used.

Sibling suites pass individually: native execution policy (8), side question (48), and provider review (14). Core types, Codex package/source types, scoped type-aware lint, core boundary lint, docs sanity, formatting, and madge pass. The final control reruns reproduce 10 failures / 3 allowed passes before the fix and all 13 passes afterward. The committed-branch security autoreview is scoped-clean at P0–P2 with zero findings; simplification and deslop are complete.

Retain requester policy and parent lineage in the existing prepared native
execution policy, then consume that authority at thread, turn, and side-question
native effect boundaries. Keep answer settlement and cleanup on their existing
authority.

Cover allowed, revoked, and reassigned requesters through real lifecycle and
JSON-RPC wire admission, including thread resume and side-question dispatch.
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T19:23:42.890279Z e31748c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: M labels Oct 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR rechecks prepared requester policy and lineage before native Codex thread, turn, and side-question effects.

Example: A prepared requester gains inheritedToolDeny: ["exec"] before turn/start.

  • Before: The native turn request is still written.
  • After: The operation rejects before writing turn/start.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused authority harness satisfies the applicable security proof boundary, but evidence remains an in-process synthetic-server run rather than a shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (logs): For this maintainer-authored authority fix, the supplied production-path harness exercises persisted requester revocation and reassignment through real lifecycle admission and serialized JSON-RPC writes, reporting allowed completion and forbidden rejection before I/O across start, resume, /btw fork, and turn dispatch; it claims no live Gateway, provider inference, ancestor-policy refresh, or cancellation of accepted turns.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A revoked or reassigned requester can still initiate native Codex operations using previously prepared authority.
Reason: The maintainer-authored direction restores the existing authority contract without adding configuration, protocol fields, or persistent state.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a current native-dispatch authority bypass, and inspection found no introduced correctness defect.

Priority: P1
Reviewed head: e31748c6a1ec8485f442364408c37a07a061e498

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Codex plugin translates OpenClaw session requests into native JSON-RPC operations; retained session authority governs whether those operations may reach Codex.

flowchart LR
  A[Session requester] --> B[Prepared native policy]
  B --> C[Thread or side question preparation]
  C --> D[Live source assertion]
  D --> E[JSON RPC writer]
  E --> F[Codex app server]
Loading

Technical review

Best possible solution:

Use the existing prepared-policy source to reject changed requester authority immediately before each new native effect.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes the missing requester predicates and dispatch checks, and the supplied production-path regression reports matching before/after failures; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch is a focused repair: it extends the existing authority owner, uses the physical writer's admission callback, and preserves completed-answer settlement and cleanup.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0960eff1598b.

Provenance checked

  • Prepared native execution policy keeps the original intent (6af860c: Retain the selected session policy and physical source through asynchronous preparation with synchronous effect guards.)
  • Side-question authority callbacks keeps the original intent (cbc53ac: Move session reads and authority preparation into workers while retaining current authority at dispatch.)
  • Native turn selection and continuation keeps the original intent (94b54e9: Reject stale native thread selections while preserving cleanup ownership for accepted requests.)
  • Thread startup and resume keeps the original intent (c26e46b: Preserve native thread continuity after interrupted compaction through the existing recovery owner.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 94b54e9 adds extensions/codex/src/app-server/run-attempt-turn-request.ts:142 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 94b54e94f496; files: extensions/codex/src/app-server/run-attempt-turn-request.ts)

PR surface

Source +20, Tests +275, Docs +5. Total +300 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 31 11 +20
Tests 3 275 0 +275
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 311 11 +300

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +31/-11; tests +274 The production growth retains requester fields and adds effect checks; the regression covers distinct start, resume, fork, and turn admission boundaries.

Labels

Label changes:

  • add P1: Current native dispatch can proceed after requester policy revocation or lineage reassignment.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Current native dispatch can proceed after requester policy revocation or lineage reassignment.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 18, 2026, 3:36 PM ET / 19:36 UTC.

@steipete
steipete merged commit 1398ba9 into main Oct 18, 2026
129 of 130 checks passed
@steipete
steipete deleted the codex/stab-codex-native-authority branch October 18, 2026 19:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 18, 2026
Resolve requester web-search policy in core's existing prepared-capability
scope and carry it as optional attempt data. Codex consumes the prepared
value without a synchronous session-policy read and retains runtime caps.
This prevents healthy turns failing during another agent's deletion.

Use known native model references for supervised sessions so provider and
model restrictions survive the handoff. Pending supervision without a
selected model retains its existing policy-resolution path.

Keep the synchronous resolver and harness registration contracts intact.
Native source-authority revalidation remains separate in #176352.

The real builder regression covers persisted denial with topology dirty
before preparation and during tool construction; both policy values stay
false. Cover native model preparation and preserve no-field runtime caps.
steipete added a commit that referenced this pull request Oct 19, 2026
Carry the exact model tuple and consumed requester policy/lineage facts with
core's optional prepared web-search result. Reject stale preparation through
the existing native execution-policy owner before thread or turn writes,
including ID lookups refreshed at physical native admission.

Skip unused search preparation during compaction, preserving the separate
execution and sandbox-policy owners. Keep existing SDK callers compatible.

Include the native requester-admission prerequisite from #176352. Recording
native-transport regressions cover unchanged policy, model changes, late
revocation/reassignment, revocation before capture, and missing-ID insertion.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…enclaw#176352)

Retain requester policy and parent lineage in the existing prepared native
execution policy, then consume that authority at thread, turn, and side-question
native effect boundaries. Keep answer settlement and cleanup on their existing
authority.

Cover allowed, revoked, and reassigned requesters through real lifecycle and
JSON-RPC wire admission, including thread resume and side-question dispatch.
steipete added a commit that referenced this pull request Oct 19, 2026
* fix(codex): prepare web search policy before harness dispatch

Resolve requester web-search policy in core's existing prepared-capability
scope and carry it as optional attempt data. Codex consumes the prepared
value without a synchronous session-policy read and retains runtime caps.
This prevents healthy turns failing during another agent's deletion.

Use known native model references for supervised sessions so provider and
model restrictions survive the handoff. Pending supervision without a
selected model retains its existing policy-resolution path.

Keep the synchronous resolver and harness registration contracts intact.
Native source-authority revalidation remains separate in #176352.

The real builder regression covers persisted denial with topology dirty
before preparation and during tool construction; both policy values stay
false. Cover native model preparation and preserve no-field runtime caps.

* fix(codex): bind prepared search policy to requester facts

Carry the exact model tuple and consumed requester policy/lineage facts with
core's optional prepared web-search result. Reject stale preparation through
the existing native execution-policy owner before thread or turn writes,
including ID lookups refreshed at physical native admission.

Skip unused search preparation during compaction, preserving the separate
execution and sandbox-policy owners. Keep existing SDK callers compatible.

Include the native requester-admission prerequisite from #176352. Recording
native-transport regressions cover unchanged policy, model changes, late
revocation/reassignment, revocation before capture, and missing-ID insertion.

* test(codex): use the public fixture boundary for native search proof

Load the native-search fixture through the existing lazy Codex test API and validate literal native binding fields against their actual contract. Fix the boundary and test-type failures from CI run 39184092677 without changing production policy behavior.

* fix(codex): retain requester ID authority through native writes

Reject native hosted-search writes when requester ID selection changes after policy preparation. Retain ID selection and absence in the existing session current-check owner, including pending worker publications, and remove the adapter's separate asynchronous ID path.

* fix(sessions): preserve worker authority for ID-selected compaction

Classify durable ID-selection publication guards as worker-compatible while
keeping memory-backed selection native. Preserve the existing live ID,
publication, physical-source, and requester checks at native writes.

Manual cold-transcript compaction no longer requires unrelated search
preparation. Cover the ID-selected path and inject conversation revocation
through the prepared restoration assertion without weakening its checks.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…aw#174774)

* fix(codex): prepare web search policy before harness dispatch

Resolve requester web-search policy in core's existing prepared-capability
scope and carry it as optional attempt data. Codex consumes the prepared
value without a synchronous session-policy read and retains runtime caps.
This prevents healthy turns failing during another agent's deletion.

Use known native model references for supervised sessions so provider and
model restrictions survive the handoff. Pending supervision without a
selected model retains its existing policy-resolution path.

Keep the synchronous resolver and harness registration contracts intact.
Native source-authority revalidation remains separate in openclaw#176352.

The real builder regression covers persisted denial with topology dirty
before preparation and during tool construction; both policy values stay
false. Cover native model preparation and preserve no-field runtime caps.

* fix(codex): bind prepared search policy to requester facts

Carry the exact model tuple and consumed requester policy/lineage facts with
core's optional prepared web-search result. Reject stale preparation through
the existing native execution-policy owner before thread or turn writes,
including ID lookups refreshed at physical native admission.

Skip unused search preparation during compaction, preserving the separate
execution and sandbox-policy owners. Keep existing SDK callers compatible.

Include the native requester-admission prerequisite from openclaw#176352. Recording
native-transport regressions cover unchanged policy, model changes, late
revocation/reassignment, revocation before capture, and missing-ID insertion.

* test(codex): use the public fixture boundary for native search proof

Load the native-search fixture through the existing lazy Codex test API and validate literal native binding fields against their actual contract. Fix the boundary and test-type failures from CI run 39184092677 without changing production policy behavior.

* fix(codex): retain requester ID authority through native writes

Reject native hosted-search writes when requester ID selection changes after policy preparation. Retain ID selection and absence in the existing session current-check owner, including pending worker publications, and remove the adapter's separate asynchronous ID path.

* fix(sessions): preserve worker authority for ID-selected compaction

Classify durable ID-selection publication guards as worker-compatible while
keeping memory-backed selection native. Preserve the existing live ID,
publication, physical-source, and requester checks at native writes.

Manual cold-transcript compaction no longer requires unrelated search
preparation. Cover the ID-selected path and inject conversation revocation
through the prepared restoration assertion without weakening its checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant