Skip to content

fix(codex): native children fail with remote app-servers - #166400

Merged
Kimiyu-186 merged 5 commits into
mainfrom
codex/remote-native-hook-relay-1418
Oct 7, 2026
Merged

Kimiyu-186 merged 5 commits into
mainfrom
codex/remote-native-hook-relay-1418

Conversation

@Kimiyu-186

@Kimiyu-186 Kimiyu-186 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native Codex children cannot call OpenClaw hooks when the Codex app-server and Gateway run on separate hosts: the inherited hook command refers to the Gateway's local relay database, which is absent on the Harness.

Related: openclaw/openclaw-enterprise#1418. Companion OCE routing and runtime pin: openclaw/openclaw-enterprise#1574.

User Impact

Remote Codex sessions can spawn a native child, wait for it, and receive its result while retaining Gateway hook enforcement. Shared developer instructions, including the shared persona, remain inherited by native children. This uses stock Codex 0.160.0 and requires no Codex change.

Why This Change Was Made

An explicitly configured HTTPS callback delivers hook requests to the existing Gateway relay. The Gateway projects a per-relay, per-generation capability through the app-server filesystem API and removes it when the owner retires. The callback authenticates that capability and runs the existing hook/policy path; it does not grant operator RPC access. Remote callback failure does not fall back to local state or operator credentials. Local app-server connections keep their existing relay path.

The remote credential is readable by the Harness user and is scoped accordingly; this is not protection from a fully compromised Harness impersonating its own hooks.

Parent wake/restart semantics (#166349) and persistent child activity history (#166350) are separate follow-ups. This PR does not change those contracts or claim to fix existing duplicate background notifications.

Evidence

  • Latest main integration (c6698b1e9b2, PR head 68cf8c9aa38): regenerated the conflicting config documentation digest; config baseline validation, extension production typecheck, and 33 focused configuration/relay/warm-thread tests passed (5 files, 92.11 seconds total).
  • After integrating main 699a3c58bf2: 12 focused hook files, 156 tests passed. Coverage includes callback authorization, policy denial, TLS, credential projection, owner retirement, and normal/incognito warm-turn refresh.
  • Full check-changed validation against main 699a3c58bf2 passed on 5ba8d5e5b76, including types, lint, docs, ratchets, and security boundary guards.
  • Before this main integration, built and deployed OC 43a7333aa04 with the OCE companion in a full local installation with dedicated Codex and codex_pat. Verified native spawn/wait/result, shared persona in the child developer instructions, a successful native child command, and a subsequent turn on the same parent thread retaining context.
  • Through the deployed OCE HTTPS route: invalid token, mismatched relay/target, stale generation, and retired capability were rejected (403/410 as appropriate).
  • Verified packaged source identities and the unchanged official Codex 0.160.0 binary. The API-key-specific Kubernetes fixture and AWS rollout were not run for this change.

The userinfo rejection tests construct URLs through the standard URL API with explicitly synthetic fields, covering username-only, password-only, and combined userinfo. The focused configuration suite passes all 7 tests (10.70 seconds including the repository wrapper); formatting and the pinned TruffleHog 3.97.4 scan of the complete test source pass with zero findings. No scanner policy or production behavior changed.

…ook-relay-1418

# Conflicts:
#	docs/.generated/config-baseline.counts.json
#	docs/.generated/config-baseline.sha256
#	src/cli/native-hook-relay-cli.ts
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling extensions: codex size: XL labels Oct 7, 2026
@Kimiyu-186
Kimiyu-186 marked this pull request as ready for review October 7, 2026 02:58
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: d5d928aadf5e386e0a8ae1dab9cff0c7b9797052
  • Maintainer: @Kimiyu-186
  • Repository role: maintain

These security sensitive changes were made:

  • src/gateway/server-http.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@Kimiyu-186

Kimiyu-186 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated: the fixture qualification request is superseded. The test now constructs userinfo through the standard URL API using explicitly synthetic fields and separately asserts rejection of username-only, password-only, and combined userinfo. All 7 configuration tests pass; the complete updated test source passes pinned TruffleHog 3.97.4 with zero findings. Production code and scanner policy are unchanged. A fresh review is being requested for the updated head.

@Kimiyu-186

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 5:49 PM ET / 21:49 UTC.

ClawSweeper review

What this changes

The PR lets native Codex child processes call Gateway hooks across hosts using an explicitly configured HTTPS callback and a scoped credential file.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR remains useful: current main lacks the remote callback transport, and no blocking introduced defect was found. The verified maintain-access author also makes this ineligible for automatic closure.

Priority: P2
Reviewed head: d5d928aadf5e386e0a8ae1dab9cff0c7b9797052

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with focused lifecycle and authorization coverage, useful deployment observations, and no blocking introduced finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified maintain-access author is exempt from ordinary contributor proof. The captured body nevertheless reports deployed native spawn/wait/result success and wrong-target, invalid-token, stale-generation, and retired-capability rejection through the HTTPS route; source preserves final live-authority checks. No unresolved authority-chain proof gap or authoritative stored-data migration was identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified maintain-access author is exempt from ordinary contributor proof. The captured body nevertheless reports deployed native spawn/wait/result success and wrong-target, invalid-token, stale-generation, and retired-capability rejection through the HTTPS route; source preserves final live-authority checks. No unresolved authority-chain proof gap or authoritative stored-data migration was identified.
Evidence reviewed 10 items Pinned introduced change: Reviewed the merge-base-to-head production changes, tests, configuration, documentation, and Gateway routing. The stale test merge was not used to infer removal of current-main behavior.
Still necessary on main: Current main's command builder emits the Gateway-local state database path and has no remote-credential argument. A broader current-main search found no remote credential path, remote callback enablement, or native-hook HTTP endpoint; the new client and endpoint files are also absent from the latest release tree.
Release boundary check: Neither newly introduced remote transport file appears in the v2026.9.8 tree. This establishes file-level release absence, not a claim that every remote deployment scenario was tested.
Findings None None.
Security None None.

How this fits together

The Codex plugin installs hook commands that native parent and child processes use to request OpenClaw policy evaluation. The new transport carries those requests from a remote Codex host to the existing Gateway relay owner.

flowchart TD
  A[Remote callback configuration] --> B[Codex plugin]
  B --> C[Scoped credential file]
  C --> D[Native child hook command]
  D --> E[Gateway HTTPS callback]
  E --> F[Token and live owner checks]
  F --> G[Existing hook policy]
  G --> H[Allow or deny result]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +475, Tests +694, Docs +27, Generated 0. Total +1196 across 35 files.

View PR surface stats
Area Files Added Removed Net
Source 23 501 26 +475
Tests 9 697 3 +694
Docs 1 28 1 +27
Config 0 0 0 0
Generated 2 3 3 0
Other 0 0 0 0
Total 35 1229 33 +1196

Review metrics

Metric Value Why it matters
Opt-in configuration 1 configuration object with 2 required fields; 1 CLI flag The callback requires explicit URL and credential-directory configuration while existing local deployments retain their transport.
Production versus tests production net +475 lines; tests and test support net +694 lines Production growth is justified by remote credential projection, HTTPS transport, authorization, and lifecycle integration.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/protocol.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep remote transport opt-in, with the existing relay owner enforcing policy and lifetime and the deployment supplying a private credential directory and HTTPS routing.

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

Yes, source establishes the failure mechanism: remote hook commands reference the Gateway-local database and loopback relay. No current-main runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes, the opt-in transport reuses the existing policy and lifetime owners instead of introducing a second authorization path, and preserves the default local behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs native-child hook execution in dedicated remote Codex deployments with a bounded, opt-in change.
  • add merge-risk: 🚨 security-boundary: The callback exposes restricted hook authority across hosts; the maintain-access author's accepted Harness-user trust scope remains bounded by token, generation, target, and live-owner checks.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified maintain-access author is exempt from ordinary contributor proof. The captured body nevertheless reports deployed native spawn/wait/result success and wrong-target, invalid-token, stale-generation, and retired-capability rejection through the HTTPS route; source preserves final live-authority checks. No unresolved authority-chain proof gap or authoritative stored-data migration was identified.

Label justifications:

  • P2: This repairs native-child hook execution in dedicated remote Codex deployments with a bounded, opt-in change.
  • merge-risk: 🚨 security-boundary: The callback exposes restricted hook authority across hosts; the maintain-access author's accepted Harness-user trust scope remains bounded by token, generation, target, and live-owner checks.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified maintain-access author is exempt from ordinary contributor proof. The captured body nevertheless reports deployed native spawn/wait/result success and wrong-target, invalid-token, stale-generation, and retired-capability rejection through the HTTPS route; source preserves final live-authority checks. No unresolved authority-chain proof gap or authoritative stored-data migration was identified.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head production changes, tests, configuration, documentation, and Gateway routing. The stale test merge was not used to infer removal of current-main behavior. (d5d928aadf5e)
  • Still necessary on main: Current main's command builder emits the Gateway-local state database path and has no remote-credential argument. A broader current-main search found no remote credential path, remote callback enablement, or native-hook HTTP endpoint; the new client and endpoint files are also absent from the latest release tree. (src/agents/harness/native-hook-relay-command.ts:72, d4a2e61910a4)
  • Release boundary check: Neither newly introduced remote transport file appears in the v2026.9.8 tree. This establishes file-level release absence, not a claim that every remote deployment scenario was tested. (fc23bc864e45)
  • Callback authority chain: The callback checks the relay token, provider and target, registration identity before and after awaiting the body, and exact remote generation. Invocation then uses the existing foreground or retained-child authority checks, including revalidation after asynchronous policy work before returning an allow result. (src/agents/harness/native-hook-relay-bridge.ts:293, d5d928aadf5e)
  • Credential lifecycle and compatibility: Credential projection serializes writes and removals, captures the app-server client, checks current authority before delivery, and prevents an old projection from deleting its successor. The remote option is additive; absent configuration retains the local transport. No existing authoritative stored-data schema or format is rewritten. (extensions/codex/src/app-server/native-hook-relay-remote.ts:50, d5d928aadf5e)
  • Recorded deployment evidence and accepted trust scope: The captured PR body reports a deployed run at 43a7333 with stock Codex 0.160.0: native spawn/wait/result, a successful child command, inherited developer instructions, and a subsequent parent turn. It also reports deployed HTTPS rejection of invalid tokens, target mismatches, stale generations, and retired capabilities with 403/410 outcomes. The maintain-access author's stated design explicitly accepts that the Harness OS user can read its own restricted hook credential; it grants no operator RPC authority. Kubernetes and AWS rollout coverage is expressly unclaimed. (43a7333aa04c)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Bek: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@Kimiyu-186

Copy link
Copy Markdown
Contributor Author

The data-model migration checklist is not applicable to this change. In extensions/codex/src/app-server/protocol.ts, the only additions are TypeScript request contracts for fs/writeFile and fs/remove; neither is persisted application state. Both RPCs and these fields already exist in stock Codex 0.160.0 (protocol, request types).

The new credential file is a disposable projection owned by a live relay generation, written on preparation and removed on retirement. No existing database schema, session record, or authoritative stored format changes. Without the opt-in callback configuration, the existing local transport is retained. The recorded full local deployment used the unchanged Codex 0.160.0 binary and exercised this write/remove path. This agrees with the review’s own compatibility evidence that no authoritative stored-data format is rewritten.

Disposition: no migration or migration code is required. Current-head required CI is green, and the completed review reports no actionable code or security findings.

@Kimiyu-186
Kimiyu-186 merged commit 90d30a1 into main Oct 7, 2026
154 of 155 checks passed
@Kimiyu-186
Kimiyu-186 deleted the codex/remote-native-hook-relay-1418 branch October 7, 2026 22:05
MarMarLabs added a commit to MarMarLabs/openclaw that referenced this pull request Oct 7, 2026
25 upstream commits, none of them in extensions/feishu. openclaw#166400 adds
three settings to the Codex plugin manifest, which moves the plugin
config baseline from 4524 to 4527 entries.

docs/.generated/config-baseline.counts.json and config-baseline.sha256
conflicted only because both sides regenerate them. The merge took
upstream's copies and regenerated all three generated files from this
merge. build:docker ran in a separate detached checkout of this commit.
Counts are core 2495, channel 3876 and plugin 4527. The core and plugin
hashes match upstream/main, and the channel hash is the same as the
previous branch head. The generated metadata differs from upstream/main
only by the two Feishu markdown.tables entries. The three generated-file
checks pass there.

config/test-mock-exports-baseline.txt and
test/vitest/vitest.extension-database-workers-paths.mjs changed on both
sides and merged without conflict. Each keeps upstream's change and this
branch's one line.

Feishu: 102 files and 1523 tests in the extension project, 17 files and
218 tests in the database-workers project, all passing. The forwarder
test and the routing guards pass, 503 tests. tsgo:core, tsgo:extensions,
tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines,
assertion-safety, database-worker, test-timeout-race and
test-mock-exports ratchets against upstream/main, oxlint and oxfmt on
the 43 changed code files all pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation extensions: codex gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL 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