Skip to content

fix: keep Codex delegation when image generation is denied - #124598

Merged
obviyus merged 4 commits into
openclaw:mainfrom
Marvinthebored:fix/codex-image-deny
Aug 16, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
Marvinthebored:fix/codex-image-deny

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #124541

AI-assisted: yes (Codex implementation and review; Claude Opus 5 independent red-team). I reviewed the final diff and understand the behavior and security boundary.

What Problem This Solves

Fixes an issue where users denying image_generate would lose unrelated Codex native tools, including multi-agent delegation.

Why This Change Was Made

Core now passes audited exact deny names to native harnesses, and the Codex harness maps image_generate to the pinned native features.image_generation=false override on both thread start and resume. Unknown, wildcard, allowlist, and undeclared denies remain fail-closed; managed Codex requirements that force image generation on are rejected before a thread is created.

User Impact

Users can deny image generation without disabling Codex delegation or other unrelated native capabilities. The denied OpenClaw tool and its Codex-native equivalent both remain unavailable.

Evidence

  • Regression fail-before: the new managed-policy test reached thread/start (unexpected method: thread/start), proving image_generation=true could bypass the targeted deny. It now passes and rejects the conflict before thread creation.
  • Warm-transition regression: a normal retained thread is followed by the real OpenClaw pluginHarnessToolPolicySafeDeniedTools=["image_generate"] handoff. The lifecycle reads managed requirements, rejects warm reuse because the final-config fingerprint changed, unsubscribes the loaded thread, and cold-resumes it with features.image_generation=false.
  • Focused tests: agent harness selection 115/115; Codex harness 32/32; Codex thread requests 143/143; managed-requirement regression 1/1.
  • Plugin contracts: 42 files, 1,039 tests passed.
  • node --import tsx scripts/check.mts --timed: all preflight, production/script/test typecheck, lint, format, and policy lanes passed.
  • node --import tsx scripts/build-all.mts: complete production and Control UI build passed.
  • Plugin SDK surface check passed with all 144 public subpaths verified.
  • Final adversarial reviews: Codex GPT-5.6 Sol and Claude Opus 5 both reported no actionable findings.

Pinned Codex contract

Directly inspected openai/codex at the dependency's exact rust-v0.147.0 commit be6e8eac029b:

Real app-server behavior

Ran a redacted, isolated codex app-server 0.147.0 session against the installed pinned package, without changing or restarting the production gateway. The thread used features.image_generation=false while leaving native multi-agent enabled. The live app-server event stream showed a real child spawn and wait completion:

{
  "serverVersion": "0.147.0",
  "model": "gpt-5.4",
  "appliedConfig": {
    "features.image_generation": false,
    "features.multi_agent": true,
    "features.multi_agent_v2": false
  },
  "events": [
    { "event": "item/started", "tool": "spawnAgent", "status": "inProgress" },
    { "event": "item/completed", "tool": "spawnAgent", "status": "completed", "receiverCount": 1 },
    { "event": "item/started", "tool": "wait", "status": "inProgress", "receiverCount": 1 },
    { "event": "item/completed", "tool": "wait", "status": "completed", "childStatus": "completed", "childMessage": "PROBE_CHILD_OK" }
  ],
  "final": "DELEGATION_OK=true\nIMAGE_GEN_AVAILABLE=false"
}

The exact pinned source and its regression establish the image namespace removal; the real app-server trace establishes that delegation remains operational under the same feature override.

Warm retained-thread transition

ClawSweeper's second review raised a possible warm-session bypass. The retained-thread contract already fails closed on this transition:

  1. buildThreadResumeParams includes the current OpenClaw deny handoff in the would-be resume config.
  2. fingerprintCodexThreadConfig hashes that complete config.
  3. consumeCodexAppServerLiveThread requires exact equality with the retained fingerprint.
  4. Adding the deny changes the fingerprint, so the lifecycle unsubscribes the loaded thread and cold-resumes it with the new config.

Commit ddff5f64808 adds a regression through the actual safe-deny input—not a synthetic config patch—and asserts the observable request sequence:

thread/start
configRequirements/read
thread/unsubscribe
thread/resume  config.features.image_generation=false

Focused verification after adding this coverage: lifecycle bindings 112/112, thread lifecycle 143/143, harness selection 115/115, and Codex harness 32/32. Claude Opus 5 independently audited the fingerprint/ownership flow and found no warm-reuse bypass; it also required the regression to exercise the real safe-deny input, which the final test does.

Maintainer validation (2026-08-16)

Maintainer decision: approved the narrow optional Plugin SDK handoff. A harness that declares an audited exact safe deny must receive that prepared fact and enforce any native equivalent; all undeclared, unknown, wildcard, finite-allowlist, and mixed unsafe policies remain fail-closed.

Independent exact-head proof:

  • Regression provenance: with current tests and pre-fix production restored, the Codex owner-boundary regression failed because features.image_generation remained true.
  • Focused exact-head tests: harness selection 115/115; Codex harness/lifecycle/bindings 287/287.
  • Full local check: preflight guards, production/scripts/test TypeScript, Oxlint, Oxfmt, and policy guards passed.
  • Pinned dependency source: directly inspected openai/codex be6e8eac029b; image_generation is stable/default-on, false removes the image_gen namespace, and configRequirements/read exposes managed feature requirements.
  • Exact-head CI: run 31954907753 passed with 143 successful checks, 38 intentional skips, and zero failures.

Per the maintainer fast-lane order, final Telegram user proof ran after the passing local ClawSweeper gate and is attached below.

Fresh and retained OpenClaw proof

Ran the pushed exact head 2c61c18 through the real local OpenClaw agent entrypoint with tools.deny: ["image_generate"], openai/gpt-5.6-sol, and the Codex harness. No mock provider or direct app-server override was used.

  • Fresh turn: OpenClaw selected agentHarnessId=codex; native rollout called spawn_agent and wait_agent; visible result was FRESH_DELEGATION_OK / IMAGE_GEN_AVAILABLE=false.
  • Retained turn: the same OpenClaw session f4850185-f602-4560-99d9-34ded865f23a retained Codex thread 01a00b33-4d81-70c3-b1a5-0af6a70bdb58; its original rollout appended a second spawn_agent and wait_agent sequence; visible result was RETAINED_DELEGATION_OK / IMAGE_GEN_AVAILABLE=false.
  • The state DB still bound that same Codex thread after the second turn. The pinned Codex source inspection above independently proves features.image_generation=false removes the image_gen namespace.

This exercises the actual OpenClaw policy-to-plugin-to-Codex path for both a fresh and retained session.

Final Telegram real-user proof

Ran the canonical Telegram userbot runner last, with a fresh isolated Gateway and no mock provider (mockRequests=0).

  • Current main eb174bcaffd: with tools.deny: ["image_generate"], Telegram returned MAIN_DELEGATION_UNAVAILABLE (Bot API message 48849, 13.151s).
  • Exact PR head 2c61c18f4d72540b6d23406e4f62c6c024a279e4: OpenClaw selected openai/gpt-5.6-sol through the Codex harness; the parent rollout invoked native spawn_agent and wait_agent, the child returned CHILD_PR_OK, and Telegram returned PR_DELEGATION_OK IMAGE_GEN_AVAILABLE=false (Bot API message 48853, 9.188s).
  • The Telegram event stream and both parent/child Codex rollouts were retained as evidence. Native Desktop recording was unreachable because the skill prerequisite scripts/e2e/telegram-desktop-recorder.ts is absent on both current main and this PR; no PR code was changed for that infrastructure gap.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: S labels Aug 16, 2026
@Marvinthebored
Marvinthebored marked this pull request as ready for review August 16, 2026 13:30
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 11:50 AM ET / 15:50 UTC.

ClawSweeper review

What this changes

The PR forwards exact safe tool denies into the Codex harness so denying image generation disables its native equivalent while preserving native delegation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep this PR open for manual security-boundary review. The code and supplied real behavior proof support the intended fix, but it adds an experimental Plugin SDK enforcement handoff and relies on the pinned Codex feature contract, which could not be directly inspected under the required sibling-source gate.

Priority: P1
Reviewed head: 2c61c18f4d72540b6d23406e4f62c6c024a279e4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong supplied real behavior proof and focused owner-boundary tests support a good patch, pending the dependency and SDK-contract owner decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body contains redacted fresh and retained OpenClaw plus Telegram before/after live-output evidence showing delegation succeeds with image generation disabled.
Patch quality 🐚 platinum hermit (4/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body contains redacted fresh and retained OpenClaw plus Telegram before/after live-output evidence showing delegation succeeds with image generation disabled.
Evidence reviewed 7 items Current-main regression surface: Current main omits image_generate from Codex’s audited safe-deny list, so the reported exact deny is still classified as a native-surface restriction.
Prepared policy handoff: The branch collects only known, declared safe deny names and forwards them alongside the existing restricted-surface fact.
Codex enforcement and conflict guard: The branch maps the prepared image deny to features.image_generation=false and rejects a managed requirement that forces that feature on.
Findings None None.
Security Needs attention Verify the pinned native feature contract: This line relies on Codex honoring features.image_generation=false as a complete removal of native image generation while delegation remains enabled; the required direct source checkout was unavailable for independent verification.

How this fits together

OpenClaw resolves conversation tool policy before calling an agent harness. The Codex extension translates the prepared policy facts into app-server thread configuration, which determines available native tools for fresh and resumed sessions.

flowchart LR
A[Conversation tool policy] --> B[Harness policy resolution]
B --> C[Safe deny handoff]
C --> D[Codex thread configuration]
D --> E[Native Codex tool surface]
E --> F[Delegation and image behavior]
Loading

Decision needed

Question Recommendation
Should OpenClaw accept pluginHarnessToolPolicySafeDeniedTools as a public enforcement obligation after direct verification that pinned Codex 0.147 removes native image generation when features.image_generation=false? Approve the narrow contract after source verification: Have the plugin/security owner verify the pinned Codex source and record acceptance of the documented exact-deny enforcement obligation.

Why: This is a compatibility-sensitive Plugin SDK contract and a native deny boundary; the required direct dependency-source check could not be completed locally.

Before merge

  • Resolve security concern: Verify the pinned native feature contract - This line relies on Codex honoring features.image_generation=false as a complete removal of native image generation while delegation remains enabled; the required direct source checkout was unavailable for independent verification.
  • Resolve merge risk (P1) - Merging creates a public Plugin SDK enforcement handoff: harnesses that declare safe denies must now honor an exact operator-policy list rather than only declaring compatibility.
  • Resolve merge risk (P1) - The preserved native surface depends on the pinned Codex interpretation of features.image_generation=false; required direct source inspection of that dependency was unavailable.
  • Complete next step (P2) - No mechanical repair is indicated; the remaining action is direct dependency-contract verification and owner acceptance of the SDK/security boundary.

Findings

  • [medium] Verify the pinned native feature contract — extensions/codex/src/app-server/thread-requests.ts:429
Agent review details

Security

Needs attention: The code has no source-proven patch defect, but this is a native tool-deny boundary whose pinned dependency contract still requires direct owner verification.

PR surface

Source +53, Tests +138, Docs +2. Total +193 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 79 26 +53
Tests 4 141 3 +138
Docs 1 7 5 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 227 34 +193

Review metrics

Metric Value Why it matters
Production versus test LOC production +79/-26 (net +53); tests +141/-3; docs +7/-5 The positive production delta implements a new core-to-plugin policy handoff and native enforcement guard, so its public-contract justification needs owner confirmation.
Plugin SDK policy surface 1 optional prepared-policy parameter added This adds a generic harness input with compatibility implications for bundled and external harness implementations.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124541
Summary: This PR is the candidate fix for the reported Codex image-deny and delegation regression.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Verify and accept the exact-deny contract (recommended)
    Before merge, directly inspect the pinned Codex source and record owner acceptance of the new Plugin SDK enforcement obligation.
  2. Keep the conservative policy
    If the upstream feature contract or public SDK obligation is not accepted, retain native-surface isolation for this deny.

Technical review

Best possible solution:

Record plugin/security-owner acceptance of the public handoff after directly verifying the pinned Codex feature behavior, then merge the focused owner-boundary repair if that contract holds.

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

Yes, source-reproducible: current main omits image_generate from the safe list, and the policy resolver therefore marks the native surface restricted for that exact deny. The PR body also supplies a before/after real-user trace, but it was not rerun locally.

Is this the best way to solve the issue?

Unclear: forwarding an audited prepared fact is the clean owner-boundary shape, but direct verification of the pinned Codex feature contract and approval of the public Plugin SDK obligation remain necessary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5f561999a9d8.

Labels

Label justifications:

  • P1: The reported deterministic behavior removes native delegation from affected Codex agent workflows.
  • merge-risk: 🚨 compatibility: The branch changes the experimental public agent-harness parameter contract and its documented enforcement semantics.
  • merge-risk: 🚨 security-boundary: The branch preserves native tools under a deny policy and relies on a Codex-native feature disablement to keep image generation unavailable.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body contains redacted fresh and retained OpenClaw plus Telegram before/after live-output evidence showing delegation succeeds with image generation disabled.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains redacted fresh and retained OpenClaw plus Telegram before/after live-output evidence showing delegation succeeds with image generation disabled.

Evidence

Security concerns:

  • [medium] Verify the pinned native feature contract — extensions/codex/src/app-server/thread-requests.ts:429
    This line relies on Codex honoring features.image_generation=false as a complete removal of native image generation while delegation remains enabled; the required direct source checkout was unavailable for independent verification.
    Confidence: 0.93

What I checked:

Likely related people:

  • keshavbotagent: Commit 3807eb9 is the prior Codex policy-preservation change in the affected harness path. (role: introduced adjacent safe-deny behavior; confidence: high; commits: 3807eb9c5825; files: extensions/codex/harness.ts, src/agents/harness/selection.ts)
  • Peter Steinberger: Current-main blame attributes the relevant harness lines to a recent current-main commit; shallow promisor history prevents a stronger ownership conclusion. (role: recent current-main contributor; confidence: medium; commits: 81d44365ae2e; files: extensions/codex/harness.ts, src/agents/harness/selection.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Directly inspect the pinned Codex source for the feature-disable contract.
  • Record plugin/security-owner acceptance of the public safe-deny enforcement handoff.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-16T13:36:04.772Z sha aed6775 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-16T14:02:55.138Z sha aed6775 :: needs real behavior proof before merge. :: [P1] Rotate or isolate a warm thread when the image deny changes
  • reviewed 2026-08-16T14:35:15.986Z sha ddff5f6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-16T14:51:43.348Z sha 061ca55 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-16T15:16:54.426Z sha 2c61c18 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-16T15:39:34.598Z sha 2c61c18 :: needs maintainer review before merge. :: none

@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. and removed P2 Normal backlog priority with limited blast radius. labels Aug 16, 2026
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 16, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 16, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@obviyus obviyus self-assigned this Aug 16, 2026
@obviyus
obviyus merged commit 2404d41 into openclaw:main Aug 16, 2026
212 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…claw#124598)

Forward exact audited tool denies into agent harnesses so Codex can disable native image generation without dropping delegation. Fail closed when managed policy forces image generation and rotate retained threads when effective native config changes.

Co-authored-by: Marvinthebored <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Denying image_generate disables unrelated Codex native tools and multi-agent

2 participants