Skip to content

fix(codex): prevent approval promotion from blocking unattended runs - #116117

Merged
steipete merged 2 commits into
mainfrom
fix/codex-approval-promotion-unattended
Jul 30, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/codex-approval-promotion-unattended

Conversation

@steipete

@steipete steipete commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where registering any before_tool_call policy could make Codex approval promotion block otherwise allowed tool calls. Unattended cron and hook runs then waited for a human approval that their initiating surface could not provide, while owner CLI turns could have workspace-local apply_patch calls rejected even when the OpenClaw policy allowed them.

Why This Change Was Made

OpenClaw now records when it synthesized Codex's untrusted policy solely to enforce OpenClaw tool policy. For that promoted path, an OpenClaw allow decision answers the matching Codex request with a one-call acceptance; explicit operator-configured Codex approval policies continue to use the human approval route.

Automatic acceptance is deliberately a closed set containing only command execution and file-change approval methods. Permission-granting requests and unknown future methods always remain human-gated; a hook allow covers the concrete call that was evaluated, not a wider future permission scope.

Approval provenance now follows command calls through the native PreToolUse relay as well as direct file-change approvals. If a policy explicitly returns requireApproval, the shared approval-surface resolver keeps interactive clients on the existing request/wait path, but cron, heartbeat-hook, and non-interactive CLI runs fail immediately with a typed plugin-approval-unavailable diagnostic instead of parking for the approval timeout.

The implementation is AI-assisted and was reviewed with the repository autoreview workflow. No changelog, config, protocol, or storage schema changed.

User Impact

Unattended Codex-backed agent runs can execute commands that OpenClaw policy allows without a second human gate. Workspace-local memory and source edits can proceed through apply_patch under an allow-all hook. Policies that genuinely require a person still wait on interactive surfaces and fail fast with an actionable reason everywhere else.

Evidence

  • node scripts/run-vitest.mjs extensions/codex/src/app-server/approval-bridge.test.ts extensions/codex/src/app-server/run-attempt-connection.test.ts extensions/codex/src/app-server/run-attempt.native-hook-relay.test.ts src/agents/agent-tools.before-tool-call.e2e.test.ts src/agents/harness/native-hook-relay.approval-wait.test.ts — 210 focused tests passed after rebasing onto current origin/main.
  • The run-attempt regression promotes never to untrusted, auto-accepts an allowed command and workspace file-change request, and proves a cron requireApproval response returns decline in under one second with plugin-approval-unavailable.
  • Interactive reviewer-device coverage proves the existing plugin.approval.request / plugin.approval.waitDecision path is preserved.
  • Permission-grant coverage proves both promoted and full-auto policies still take plugin.approval.request / plugin.approval.waitDecision; an unknown method also takes the human route and remains protocol-declined.
  • node scripts/check-changed.mjs -- <16 touched files> — passed on Blacksmith Testbox in https://github.com/openclaw/openclaw/actions/runs/30497907503; formatting, SDK/boundary guards, dead exports, all typechecks, lint, schema guards, database-first guards, and import-cycle checks were green.
  • Follow-up changed gate passed on Blacksmith Testbox in https://github.com/openclaw/openclaw/actions/runs/30499627562.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted — clean after the permission-boundary ruling; no accepted/actionable findings, overall confidence 0.94.
  • Upstream Codex contract checked at openai/codex commit 15d7d2a7337eef83daa3cf7dd6691aa7c5a8cdfa: codex-rs/protocol/src/protocol.rs:912 defines untrusted as prompting for non-known-safe commands; codex-rs/core/src/safety.rs:46 makes apply_patch ask before writable-root evaluation under that policy; codex-rs/app-server/README.md:1497 specifies that the app-server client answers those requests with accept or decline.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: codex size: M maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 23:08
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 29, 2026, 7:42 PM ET / 23:42 UTC.

ClawSweeper review

What this changes

The PR lets OpenClaw policy-approved Codex command and workspace file-change requests proceed without blocking unattended runs, while retaining the human approval route for permission grants and unsupported request methods.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 5 items remain

Keep open for human merge review. The prior P1 concern is addressed by the new closed set of two concrete auto-approval methods, but this still changes the Codex/OpenClaw approval security boundary and the visible PR evidence is tests and CI rather than a redacted after-fix runtime transcript; the existing maintainer label also requires explicit maintainer handling.

Priority: P1
Reviewed head: 3bf2f889b7e7b6c0ceec24b19ef9760359364b72
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a focused, security-conscious shape and regression coverage, but missing real behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body provides focused tests and CI, but no redacted after-fix app-server or agent runtime output showing the approval behavior in a real setup; add redacted terminal output, logs, or a recording before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body provides focused tests and CI, but no redacted after-fix app-server or agent runtime output showing the approval behavior in a real setup; add redacted terminal output, logs, or a recording before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Closed auto-approval surface: The branch limits the OpenClaw-policy promotion path to item/commandExecution/requestApproval and item/fileChange/requestApproval; permission grants are excluded from that set.
Explicit-policy ownership remains separate: The branch records whether untrusted was synthesized from configured never plus an OpenClaw tool policy, and tests distinguish that from an operator-configured untrusted policy.
Unattended approval handling: The branch propagates trigger and initiating-surface context through the native relay, then fails unavailable plugin approvals instead of waiting on an approval surface that cron, heartbeat, or non-interactive CLI runs cannot provide.
Findings None None.
Security None None.

How this fits together

Codex app-server emits approval requests while an OpenClaw agent run is executing tools. The approval bridge consults OpenClaw policy and either responds to the concrete request, opens an interactive approval flow, or returns an actionable failure when the initiating run cannot be reviewed.

flowchart LR
  A[Agent run trigger] --> B[Codex app-server approval request]
  B --> C[OpenClaw tool policy]
  C --> D{Concrete allowed call?}
  D -->|Yes| E[One-call approval response]
  D -->|No or approval required| F{Interactive surface available?}
  F -->|Yes| G[Plugin approval request and wait]
  F -->|No| H[Typed unavailable diagnostic]
Loading

Decision needed

Question Recommendation
Should an OpenClaw before_tool_call allow decision be authorized to answer Codex command and workspace file-change approval requests only when OpenClaw synthesized the untrusted policy? Accept the narrow ownership model: Approve the two-method auto-accept path after reviewing redacted real-run evidence that provenance is limited to the synthesized-policy case.

Why: The implementation is deliberately narrow and tested, but it changes which policy layer has final authority to accept a native coding-runtime action; that trust-boundary choice requires maintainer intent beyond correctness review.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body provides focused tests and CI, but no redacted after-fix app-server or agent runtime output showing the approval behavior in a real setup; add redacted terminal output, logs, or a recording before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - An OpenClaw policy allow now becomes a protocol-level Codex acceptance for two request methods; merge review should confirm that the recorded promotion provenance cannot be set for an explicitly operator-configured approval policy.
  • Resolve merge risk (P1) - The PR body supplies focused tests and CI but no redacted after-fix app-server or agent-run transcript showing both an allowed unattended call and the fail-fast unavailable-approval outcome in a real setup.
  • Complete next step (P2) - A maintainer must review the approval ownership boundary and the contributor must provide real behavior proof; there is no discrete mechanical defect to send to an automated repair lane.
Agent review details

Security

None.

PR surface

Source +104, Tests +318. Total +422 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 12 122 18 +104
Tests 4 321 3 +318
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 443 21 +422

Review metrics

Metric Value Why it matters
Auto-approval scope 2 concrete request methods auto-accepted; permission grants excluded The bounded method set is the core security control for changing approval ownership.

Merge-risk options

Maintainer options:

  1. Add real approval-path evidence (recommended)
    Before merge, attach a redacted app-server or agent-run transcript that shows an allowed unattended command or file change accepts once and a genuine requireApproval path fails fast without a review surface.
  2. Accept test-only proof
    A maintainer may accept the focused regression coverage and CI as sufficient for this security-boundary change, while explicitly owning the absence of a real-run transcript.

Technical review

Best possible solution:

Keep the narrow two-method policy-owned acceptance path, retain human gating for permission and unknown requests, and add a redacted real-run transcript before a maintainer accepts the approval-boundary change.

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

Yes, from source and focused regression coverage: a synthesized untrusted policy routes otherwise allowed Codex requests into approval handling, and unattended runs lack a review surface. The visible evidence does not include an independently observed live run.

Is this the best way to solve the issue?

Yes, conditionally: carrying explicit provenance and accepting only concrete command/file requests is narrower than globally auto-approving Codex or broadening permission grants. The remaining question is maintainer acceptance of that cross-runtime approval ownership boundary.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label justifications:

  • P1: The bug can stall unattended Codex-backed agent workflows that have no human approval surface.
  • merge-risk: 🚨 security-boundary: The PR changes when OpenClaw policy may produce a Codex approval response for command and file mutations.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides focused tests and CI, but no redacted after-fix app-server or agent runtime output showing the approval behavior in a real setup; add redacted terminal output, logs, or a recording before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • steipete: The only direct provenance available in the supplied review context is the two commits implementing the approval-ownership and permission-boundary changes; broader local history inspection was unavailable in this read-only environment. (role: recent Codex approval-path contributor; confidence: medium; commits: 4281c0b88411, 3bf2f889b7e7; files: extensions/codex/src/app-server/approval-bridge.ts, extensions/codex/src/app-server/run-attempt-connection.ts, src/agents/agent-tools.before-tool-call.approval.ts)

Rank-up moves

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

  • Attach a redacted after-fix runtime transcript for one allowed unattended action and one unavailable approval-required action.
  • Obtain maintainer confirmation that OpenClaw may own acceptance only for the synthesized-policy, two-method path.

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 (1 earlier review cycle)
  • reviewed 2026-07-29T23:14:05.852Z sha 4ff8886c4e75adb07d48f34c845bcce431c5fa94 :: needs real behavior proof before merge. :: [P1] Limit promoted auto-acceptance to policy-owned request methods

@steipete steipete self-assigned this Jul 29, 2026
@steipete
steipete force-pushed the fix/codex-approval-promotion-unattended branch from 4ff8886 to 3bf2f88 Compare July 29, 2026 23:37
@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up move disposition for head 3bf2f889b7e7b6c0ceec24b19ef9760359364b72:

  • Maintainer confirmation: applied. The owner ruling explicitly accepts OpenClaw approval ownership only for synthesized-policy command execution and file-change requests; permission and unknown/grant-shaped methods remain human-gated.
  • Redacted live runtime transcript: skipped at operator direction. The operator explicitly directed landing after the closed-method regressions, ruling-aware autoreview, and exact-head CI. Proof is 210 focused tests, the Blacksmith changed gate (run 30499627562), clean autoreview (0.94), and exact-head CI run 30500108469; its unrelated TUI PTY shard passed on the single permitted rerun.

No ClawSweeper findings or security concerns remain on this head.

@steipete
steipete merged commit a19132e into main Jul 30, 2026
195 of 198 checks passed
@steipete
steipete deleted the fix/codex-approval-promotion-unattended branch July 30, 2026 00:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to licheer-zte/openclaw that referenced this pull request Jul 30, 2026
…id-retention

* origin/main: (83 commits)
  refactor(channels): own account config mutations (openclaw#115970)
  fix(discord): keep activity receipts in adopted threads (openclaw#116119)
  fix(feishu): preserve card actions through mention gating (openclaw#116105)
  perf(gateway): cache lazy server methods import (openclaw#116060)
  refactor: keep update timing constants private
  fix: reject stale update reconciliation
  refactor: keep update status response private
  fix: bound update status reconciliation
  fix: preserve uncertain update outcomes
  refactor: keep update reconciliation within size budgets
  fix: release update reconciliation on access loss
  docs: note control ui update reconciliation
  test: cover both managed update response orders
  fix: reconcile ambiguous gateway updates
  fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117)
  fix(daemon): require system-scope ownership before removing the user unit
  fix(daemon): only treat same-canonical-name user+system units as dueling
  fix(daemon): detect and resolve dueling user+system systemd gateway units
  fix(macos): back off approval socket retries (openclaw#116125)
  test: add stalled provider response body timeout coverage
  ...
vincentkoc added a commit to yetval/openclaw that referenced this pull request Jul 30, 2026
* origin/main: (23 commits)
  refactor(channels): own account config mutations (openclaw#115970)
  fix(discord): keep activity receipts in adopted threads (openclaw#116119)
  fix(feishu): preserve card actions through mention gating (openclaw#116105)
  perf(gateway): cache lazy server methods import (openclaw#116060)
  refactor: keep update timing constants private
  fix: reject stale update reconciliation
  refactor: keep update status response private
  fix: bound update status reconciliation
  fix: preserve uncertain update outcomes
  refactor: keep update reconciliation within size budgets
  fix: release update reconciliation on access loss
  docs: note control ui update reconciliation
  test: cover both managed update response orders
  fix: reconcile ambiguous gateway updates
  fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117)
  fix(daemon): require system-scope ownership before removing the user unit
  fix(daemon): only treat same-canonical-name user+system units as dueling
  fix(daemon): detect and resolve dueling user+system systemd gateway units
  fix(macos): back off approval socket retries (openclaw#116125)
  test: add stalled provider response body timeout coverage
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
…penclaw#116117)

* fix(codex): honor hook approval ownership

* fix(codex): keep permission grants human-gated
nvtoroy added a commit to nvtoroy/openclaw that referenced this pull request Aug 10, 2026
…1009)

Adds plugins.entries.codex.config.appServer.nativeHookRelay = { enabled? } -
a single narrowly scoped opt-out wiring the existing internal relay options of
the run-attempt and side-question paths to plugin config. Without the key the
parse layer returns the historical { enabled: true } byte-for-byte.

The parse layer carries no policy logic. A single guard
(resolveCodexNativeHookRelayForApprovalPolicy) applies the safety floor in
both run paths after runtime policy resolution, keyed on the EFFECTIVE
approval policy - the resolved value, which can force a prompting policy over
a configured "never" (unknown-model or exec-mode reviewer forcing, forced
guardian reviewer, forced danger-full-access sandbox), and on the
side-question path is the bound thread's policy when a persistent binding
carries one:

- effective "never" AND no active OpenClaw before-tool policy
  (hasBeforeToolCallPolicy(): before_tool_call hook or trusted-tool policy -
  the same predicate the relay's own local-work gate uses) -> the opt-out is
  honored verbatim: full kill-switch (features.hooks=false, cleared hook
  arrays on both harness paths) - the constrained-host case from openclaw#91009,
  including stock yolo deployments with no approvalPolicy key.
- otherwise (a prompting/forced effective policy, or an active before-tool
  policy under explicit "never") -> enabled:false narrows to the required
  before-tool policy relay (events: ["pre_tool_use"]) and logs a one-line
  deduped warning naming the actual reason. The floor mirrors
  loopDetectionPreToolUseRelay's contract ("before-tool plugin hooks and
  trusted-tool policy still install their required relay").

Event scoping stays an internal option of the run paths with upstream's own
semantics (openclaw#116117, "honor hook approval ownership"); it is deliberately not
exposed to operator config. The
relay object is strict at BOTH boundaries: the plugin manifest
(additionalProperties: false) rejects unknown keys at load time with a named
config error, and the zod parser stays strict as defense in depth; covered at
the manifest/loader boundary against the real manifest.

The approval transport is out of this key's reach by construction: approvals
ride the app-server approval bridge over JSON-RPC and fall back to the
in-process before_tool_call hook when the relay is absent. The forced-policy
case is pinned by an integration test through
resolveCodexAppServerRuntimeOptions; a manifest/zod parity test covers the
schema. An opt-in live capture lane
(gateway-codex-harness.native-hook-relay-proof.live.test.ts) reproduces the
wire evidence against a real codex app-server and asserts the captured
thread/start and thread/fork hook overlays per mode and per path.
nvtoroy added a commit to nvtoroy/openclaw that referenced this pull request Sep 11, 2026
…1009)

Adds plugins.entries.codex.config.appServer.nativeHookRelay = { enabled? } -
a single narrowly scoped opt-out wiring the existing internal relay options of
the run-attempt and side-question paths to plugin config. Without the key the
parse layer returns the historical { enabled: true } byte-for-byte.

The parse layer carries no policy logic. A single guard
(resolveCodexNativeHookRelayForApprovalPolicy) applies the safety floor in
both run paths after runtime policy resolution, keyed on the EFFECTIVE
approval policy - the resolved value, which can force a prompting policy over
a configured "never" (unknown-model or exec-mode reviewer forcing, forced
guardian reviewer, forced danger-full-access sandbox), and on the
side-question path is the bound thread's policy when a persistent binding
carries one:

- effective "never" AND no active OpenClaw before-tool policy
  (hasBeforeToolCallPolicy(): before_tool_call hook or trusted-tool policy -
  the same predicate the relay's own local-work gate uses) -> the opt-out is
  honored verbatim: the opt-out overlay clears OpenClaw's four session-layer
  hook arrays and writes disabled hooks.state markers for its session-layer
  command keys, leaving features.hooks and independent user/project/plugin/
  managed Codex hooks untouched (review finding: features.hooks=false would
  disable the whole hook engine pre-discovery; the overlay also deliberately
  OMITS features.hooks rather than asserting true, because it merges last and
  would otherwise re-enable hooks for ring-zero callers). The harness-
  restricted sandbox path keeps full suppression via its own builder. This is
  the constrained-host case from openclaw#91009, including stock yolo deployments.
- otherwise (a prompting/forced effective policy, or an active before-tool
  policy under explicit "never") -> enabled:false narrows to the required
  before-tool policy relay (events: ["pre_tool_use"]) and logs a one-line
  deduped warning naming the actual reason. The floor mirrors
  loopDetectionPreToolUseRelay's contract ("before-tool plugin hooks and
  trusted-tool policy still install their required relay").

Event scoping stays an internal option of the run paths with upstream's own
semantics (openclaw#116117, "honor hook approval ownership"); it is deliberately not
exposed to operator config. The
relay object is strict at BOTH boundaries: the plugin manifest
(additionalProperties: false) rejects unknown keys at load time with a named
config error, and the zod parser stays strict as defense in depth; covered at
the manifest/loader boundary against the real manifest.

The approval transport is out of this key's reach by construction: approvals
ride the app-server approval bridge over JSON-RPC and fall back to the
in-process before_tool_call hook when the relay is absent. The forced-policy
case is pinned by an integration test through
resolveCodexAppServerRuntimeOptions; a manifest/zod parity test covers the
schema. An opt-in live capture lane
(gateway-codex-harness.native-hook-relay-proof.live.test.ts) reproduces the
wire evidence against a real codex app-server and asserts the captured
thread/start and thread/fork hook overlays per mode and per path.

Rebased onto app-server 0.153.4 main. Three adaptations were needed. (1) The
managed-only hook attestation added since the merge base gates
assertCodexNativeHookRelayAllowed on nativeHookRelayRequired, which read the
RAW operator relay config; a narrowed opt-out would therefore have skipped
attestation while still installing the enforcing relay, failing open on
allowManagedHooksOnly installs. It now reads the guarded shape, so the
narrowing arms the assert instead of disarming it (regression test added).
(2) openclaw#128464 removed resolveCodexAppServerForOpenClawToolPolicy and its
never->untrusted promotion; the effective policy now comes from
applyCodexSessionPermissionPolicy, which never consults
hasBeforeToolCallPolicy() and resolves permission mode "full" to "never". The
guard's two-predicate design is unchanged, but its rationale comment now cites
session permission modes and config-runtime's forced policies. (3) Loop
detection became explicit opt-in and the selected-but-no-work PreToolUse
marker was removed, so the live proof lane now enables tools.loopDetection so
its "installed" expectations still hold and attestation is exercised;
deliberately loop detection rather than a global before_tool_call hook, which
would narrow the disabled-never mode and stop the lane proving the full
kill-switch.

Re-based again onto current main. The three adaptations above still hold; the
refresh only followed upstream moves. The reference table the relay row lives in
was split out to docs/plugins/codex-harness-reference/app-server-transport.md.
CodexPluginConfig is now derived from the zod schema, so the relay field comes
from config-parsing and CodexNativeHookRelayOptions moved to the leaf
config-contracts.shared.ts (config-contracts re-exports it) to keep the module
graph acyclic. Live-shard membership is now discovery-driven, so the proof lane
needs no shard-list edit; it still routes to native-live-src-gateway-core. On
the side-question path the guard keys on appServer.approvalPolicy, the same
value the relay's own event scoping uses, rather than the MCP-elicitation-
widened policy introduced since, which grants elicitation only and opens no
tool-approval path.

Coverage extended to the canonical fork preparation path (openclaw#134660).

Proof-lane refresh: request/test timeouts resized to real backend latency, the two approval modes migrated off the retired "untrusted" policy to on-request with an explicit approvalsReviewer: "user" so the escalation escapes the in-process auto_review subagent and is observable on the wire, and all captures re-recorded on codex 0.153.4 / gpt-5.6-terra.

The proof lane also covers existing-session transitions (mode `transition`): one
gateway, one session and one native thread across three real turns while an
operator flips `nativeHookRelay.enabled` off and back on between them. Phase 1
opens the thread with `thread/start` and installs the relay; the flip changes the
merged thread config, so the warm live-thread path's config fingerprint no longer
matches and each later turn is served by a cold `thread/resume` carrying the whole
rebuilt config - the opt-out overlay in phase 2, the relay restored byte-for-byte
in phase 3, on the same thread id. Every phase also asserts that each `hooks.state`
key the overlay writes names OpenClaw's own `<session-flags>` layer and that
`features.hooks` is never written false, which is the mechanical form of "the
opt-out cannot reach a hook it did not install": Codex discovers hooks per config
layer and keys their state by source path.

Re-based onto current main once more; five adaptations, none of them behavior on
the configured path. (1) The cyber-refusal escalation added to `runAttempt` since
the last rebase now runs both its attempts with the resolved relay options rather
than the hardcoded literal, so an escalated retry carries the same kill-switch
decision as the first try. (2) The plugin entry no longer imports the
`app-server/config.js` barrel eagerly, so the harness reads
`resolveCodexAppServerNativeHookRelay` from the `config-parsing.js` leaf it already
loads; importing the barrel would have pulled the app-server runtime graph into
plugin registration (registration-imports.test.ts pins that boundary).
(3) `config-contracts.ts` no longer re-exports `CodexNativeHookRelayOptions`: every
consumer reads the canonical `config-contracts.shared.ts`, and the re-export had no
callers. (4) The live proof lane moved to `src/gateway/test/` and split per topic -
the five static modes, the existing-session transition, and a shared
`*.test-helpers.ts` that owns the gateway bootstrap both use: `src/gateway/*.test.ts`
sits at the 720-root tsgo core-test shard cap, and the single file had outgrown the
1000-line test ceiling. The new attestation suite joins the codex attempt-extra
vitest project so every full-suite test file keeps exactly one owner. (5) The
kill-switch raises the plugin config-surface budget by the two entries it adds
(`nativeHookRelay` and its `enabled` flag) in
docs/.generated/config-baseline.counts.json.

Rebased onto current main again (8b343fc). One further adaptation, in the
tests only: openclaw#145105 made `readCodexCyberAttemptVerdict` read `result.terminal.kind`
directly, so an attempt result without a `terminal` now throws where it previously
read as "not refused". The stub results in this change's own harness and plugin
tests, which only pin the relay options `runAttempt` forwards, carry the same
`{ terminal: { kind: "ok" } }` shape upstream gave its fixtures in that commit.
The escalation invariant is unchanged and still holds: both attempts run through
one `runAttemptOnModel` closure over the resolved relay options, so a retry can
never widen the kill-switch decision the first attempt ran under.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant