Skip to content

feat(codex): share native threads across Codex clients#99821

Merged
steipete merged 10 commits into
mainfrom
codex/codex-coexistence
Jul 4, 2026
Merged

feat(codex): share native threads across Codex clients#99821
steipete merged 10 commits into
mainfrom
codex/codex-coexistence

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Closes #99781

What Problem This Solves

OpenClaw's Codex harness isolates each agent in a private Codex home, so threads created in Codex Desktop or the CLI are invisible to OpenClaw, and OpenClaw-created threads are invisible to native Codex clients.

Why This Change Was Made

Adds an opt-in appServer.homeScope: "user" mode that connects the stdio app-server to the native user Codex home and authentication. An owner-only codex_threads tool lists, reads, forks, renames, archives, and restores native threads; continuation is fork-first so two clients never write the same thread concurrently.

The existing per-agent isolated home remains the default. Shared-user-home mode is intentionally rejected for remote WebSocket transports.

User Impact

Operators can opt a Codex-backed OpenClaw agent into the same thread store used by Codex Desktop and the CLI, inspect and manage those native threads from OpenClaw, and attach a safe native fork to the current OpenClaw session.

Evidence

  • Live cross-process proof: three independent bundled Codex app-server processes create/list/read/fork/rename/archive/unarchive through one shared native home (OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_CODEX_THREAD_COEXISTENCE=1 node scripts/test-live.mjs -- extensions/codex/src/native-thread-coexistence.live.test.ts).
  • Focused Vitest proof: 239 tests passed across the Codex extension, plugin context, and descriptor cache shards.
  • Testbox changed-surface gate: core/extensions typechecks, lint, import cycles, database-first guards, and architecture checks passed.
  • Full Testbox production build passed (corepack pnpm build).
  • Fresh Codex autoreview accepted one fork-source finding; the fix and regression test were added, and the final rerun reported no actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 2:38 AM ET / 06:38 UTC.

Summary
This PR adds a default-off Codex appServer.homeScope: "user" mode, an owner-only codex_threads tool, native-home docs/config metadata, Codex protocol typings, and focused/live tests for cross-client thread sharing.

PR surface: Source +462, Tests +623, Docs +54. Total +1139 across 27 files.

Reproducibility: yes. for the review findings: source inspection shows sparse fork attachments can be cleared by lifecycle fingerprint checks, and sandboxed sessions still block the tool's thread/fork call. The requested native-home sharing itself is a feature, not a current-main bug reproduction.

Review metrics: 2 noteworthy metrics.

  • Codex app-server config surface: 1 added (appServer.homeScope). This knob changes which Codex home and auth store a local app-server process uses, so upgrade and security boundaries matter before merge.
  • Native thread tool actions: 6 added (list, read, fork, rename, archive, unarchive). These actions expose owner-controlled inspection and mutation of native Codex thread state shared with Desktop and CLI clients.

Stored data model
Persistent data-model change detected: serialized state: extensions/codex/src/native-thread-tool.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #99781
Summary: This PR is the implementation candidate for the linked native Codex thread coexistence feature request.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🦪 silver shellfish
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Persist lifecycle-compatible binding metadata when attaching a forked native thread.
  • Allow or safely route codex_threads fork operations in sandboxed OpenClaw sessions.
  • [P1] Add current-head redacted terminal output, logs, or a successful linked artifact for the live shared-home scenario.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR reports live terminal/Testbox proof, but the linked Testbox runs inspected through GitHub are cancelled and the proof does not cover the current head commit. 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.

Risk before merge

  • [P1] User-home mode intentionally lets owner turns use the operator's native Codex home, including native auth, config, plugins, skills, and thread history, so maintainers need to accept that security boundary before merge.
  • [P1] The new tool mutates native Codex thread state and OpenClaw session bindings, and the current attach metadata and sandboxed fork defects would break the advertised fork-and-continue path.
  • [P1] The PR adds a compatibility-sensitive Codex app-server config surface; the isolated agent home must remain the upgrade-safe default and user-home behavior needs current-head proof.
  • [P1] Current-head real behavior proof is incomplete: the linked Testbox proof runs inspected by gh run view are cancelled, and the successful CI proof predates the latest head commit.

Maintainer options:

  1. Fix integration blockers and refresh proof (recommended)
    Repair lifecycle-compatible fork attachment, allow or safely route sandboxed forks, and add current-head redacted live proof before any merge decision.
  2. Accept the native-home boundary
    Maintainers can intentionally accept that default-off user-home mode grants owner turns access to native Codex auth, config, plugin, skill, and thread state after the blockers are fixed.
  3. Pause if Codex should stay isolated
    If bundled Codex should not share the operator's native home, pause or close this direction and keep per-agent isolation as the only supported OpenClaw mode.

Next step before merge

  • [P1] This protected PR changes native Codex auth/session boundaries and still needs contributor proof plus maintainer acceptance after the code blockers are repaired.

Security
Cleared: No supply-chain or secret-handling defect was found; the default-off native Codex home boundary remains a maintainer merge-risk decision.

Review findings

  • [P2] Persist lifecycle metadata when attaching forks — extensions/codex/src/native-thread-tool.ts:307-316
  • [P2] Allow sandboxed fork attachments — extensions/codex/src/native-thread-tool.ts:290-295
Review details

Best possible solution:

Fix the attach metadata and sandboxed fork blockers, refresh current-head live proof, keep isolated per-agent homes as the default, and then have maintainers explicitly accept or reject the native-home auth/session boundary.

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

Yes for the review findings: source inspection shows sparse fork attachments can be cleared by lifecycle fingerprint checks, and sandboxed sessions still block the tool's thread/fork call. The requested native-home sharing itself is a feature, not a current-main bug reproduction.

Is this the best way to solve the issue?

No as submitted: the default-off bundled-plugin direction is plausible, but the PR needs lifecycle-compatible binding, sandbox-safe fork handling, current-head proof, and maintainer acceptance of the native-home boundary.

Full review comments:

  • [P2] Persist lifecycle metadata when attaching forks — extensions/codex/src/native-thread-tool.ts:307-316
    When attach=true, this writes only the fork id, cwd, model, and provider into the session binding. The next lifecycle pass compares fingerprints such as web search, MCP, environment, runtime, plugin apps, and dynamic tools before resuming, so this sparse binding can be cleared and the next turn starts a fresh thread instead of continuing the fork.
    Confidence: 0.93
  • [P2] Allow sandboxed fork attachments — extensions/codex/src/native-thread-tool.ts:290-295
    The fork action goes through codexControlRequest with the active sessionKey and sessionId, but the sandbox guard still treats thread/fork as blocked-native-bypass. Owners using an OpenClaw sandbox will hit the guard before Codex is contacted, so the documented fork-and-attach path fails for sandboxed agents.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: The PR adds appServer.homeScope, a compatibility-sensitive app-server config surface that changes Codex home and auth behavior when enabled.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR reports live terminal/Testbox proof, but the linked Testbox runs inspected through GitHub are cancelled and the proof does not cover the current head commit. 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.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove merge-risk: 🚨 auth-provider: Current PR review merge-risk labels are merge-risk: 🚨 compatibility, merge-risk: 🚨 session-state, merge-risk: 🚨 security-boundary.
  • remove status: ⏳ waiting on author: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P3: This is a default-off opt-in feature/config expansion rather than a shipped regression or blocked core runtime path.
  • merge-risk: 🚨 compatibility: The PR adds appServer.homeScope, a compatibility-sensitive app-server config surface that changes Codex home and auth behavior when enabled.
  • merge-risk: 🚨 session-state: The PR lets OpenClaw list, fork, attach, rename, archive, and restore native Codex threads shared with Desktop and CLI clients.
  • merge-risk: 🚨 security-boundary: User-home mode intentionally gives OpenClaw access to the operator's native Codex home, config, plugins, skills, auth, and thread store.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR reports live terminal/Testbox proof, but the linked Testbox runs inspected through GitHub are cancelled and the proof does not cover the current head commit. 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

PR surface:

Source +462, Tests +623, Docs +54. Total +1139 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 14 484 22 +462
Tests 10 628 5 +623
Docs 3 65 11 +54
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 27 1177 38 +1139

What I checked:

Likely related people:

  • steipete: Recent current-main history includes Codex thread lifecycle, plugin descriptor, plugin context, and agent tool surface work adjacent to this PR. (role: recent Codex/plugin-tool contributor; confidence: high; commits: c52583a02270, ab2f6f564272, 02182d5a3031; files: extensions/codex/src/app-server/thread-lifecycle.ts, src/agents/agent-tools.ts, src/agents/openclaw-tools.plugin-context.ts)
  • vincentkoc: Recent current-main commits touch Codex thread lifecycle, binding rotation, network proxy profiles, auth provider aliases, and app-server config. (role: recent Codex app-server lifecycle/config contributor; confidence: high; commits: 77012f980785, 10b8b32380ea, 5c3469549159; files: extensions/codex/src/app-server/thread-lifecycle.ts, extensions/codex/src/app-server/config.ts, extensions/codex/src/app-server/auth-bridge.ts)
  • kevinslin: Recent current-main commits changed Codex app-server plugin approvals, destructive approval modes, and SecretRef config in the same compatibility-sensitive config surface. (role: recent Codex app-server config contributor; confidence: medium; commits: d9b5afad180b, c5d34c8376f8, 741f7080a7f0; files: extensions/codex/src/app-server/config.ts, extensions/codex/src/app-server/thread-lifecycle.ts, extensions/codex/src/app-server/sandbox-guard.ts)
  • pashpashpash: History shows adjacent Codex app-server launch work that preserved user HOME while keeping app-server CODEX_HOME isolated per agent. (role: introduced adjacent home-handling behavior; confidence: medium; commits: 74860e93fd6e, cc95d4dd28eb; files: extensions/codex/src/app-server/auth-bridge.ts)
  • joshavant: Recent current-main history changed Codex native sandbox and node-exec policy boundaries that this PR's sandboxed fork behavior crosses. (role: recent native execution boundary contributor; confidence: medium; commits: e0405ecc9bd6, ba06376c7955; files: extensions/codex/src/app-server/sandbox-guard.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5258a980c8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +307 to +308
await writeCodexAppServerBinding(sessionFile, {
threadId: forkThreadId,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Persist fork attachments with resume metadata

When codex_threads forks with attach=true, this writes only the thread id/cwd/model fields into the session binding. On the next Codex harness turn, startOrResumeThread compares binding metadata such as webSearchThreadConfigFingerprint and clears bindings whose fingerprint is missing or different before it ever calls thread/resume, so the advertised attach path silently starts a new thread instead of continuing the fork. Populate the same compatibility fingerprints/metadata used by normal lifecycle writes, or add a lifecycle path that treats this attach as an intentional resume.

Useful? React with 👍 / 👎.

modelProvider?: string;
modelId?: string;
requesterSenderId?: string | null;
senderIsOwner?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Forward owner state into plugin-only tool builds

This new owner bit does not reach all plugin tool factory calls: when a run has a narrow allowlist containing only plugin tools, createOpenClawCodingTools takes the pluginToolsOnly branch and passes requesterSenderId but not senderIsOwner into resolveOpenClawPluginToolsForOptions. In that context owner-gated factories like the new codex_threads factory see no owner and return null, so owners lose the tool whenever it is explicitly allowlisted without core OpenClaw tools. Pass options.senderIsOwner through that branch as well.

Useful? React with 👍 / 👎.

@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. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 404e1590b5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
const response = await request(
pluginConfig,
CODEX_CONTROL_METHODS.forkThread,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow codex_threads fork in sandboxed sessions

When this tool runs from a sandboxed OpenClaw session, the fork goes through codexControlRequest and requestOptions() includes the active sessionKey/sessionId; extensions/codex/src/app-server/sandbox-guard.ts:62 still classifies thread/fork as blocked-native-bypass, so resolveCodexNativeSandboxBlock throws before Codex is contacted. That makes the documented safe path—fork a native thread and attach it to the current OpenClaw session—fail for owners whose agent uses OpenClaw sandboxing; add a safe control-plane fork path or pass sandbox-aware parameters that the guard can allow.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Jul 4, 2026
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head proof for 404e1590b5081edf79b9cd8062688835846ab3d2:

  • Focused Codex plugin tests: 175/175 passed on Blacksmith Testbox tbx_01kwnsdg79jp2qt0ax7hdz01sx (run).
  • Live coexistence: OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_CODEX_THREAD_COEXISTENCE=1 node scripts/test-live.mjs -- extensions/codex/src/native-thread-coexistence.live.test.ts passed on Testbox tbx_01kwnsgz9gkc1j676wf03hqj2d (run) and locally after the final cleanup fix. The scenario creates/materializes a native thread in one app-server process, reads/forks/renames/archives/unarchives it from a second, then verifies the fork from a third.
  • Boundary/docs gates: pnpm lint:plugins:no-extension-test-core-imports, pnpm docs:map:check, git diff --check, and scoped oxlint passed.
  • Fresh Codex autoreview: clean; no accepted/actionable findings. Its one initial cleanup-retry finding was fixed, the live test rerun, and autoreview rerun clean.
  • Hosted CI: 68 passing checks, zero failures, zero pending; CI workflow 28696423067 succeeded and the PR is merge-clean.

Intentional safety boundary: shared native CODEX_HOME is opt-in and owner-only; OpenClaw continues a selected Codex thread by forking and attaching the fork instead of becoming a concurrent writer to a thread that Codex Desktop/CLI may already own.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f50b5191c6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!sessionId) {
return undefined;
}
const storePath = runtime.agent.session.resolveStorePath(undefined, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve attachments from configured session store

When an installation uses a non-default session.store, this resolves the current session against the default per-agent store instead of context.config.session.store (the existing session readers, e.g. extensions/codex/src/conversation-binding.ts:883, pass the configured store). In that configuration codex_threads either cannot find the entry or writes the fork binding beside the wrong default transcript path, so attach=true appears to succeed but the next Codex harness turn reads the real session file and starts/resumes without the fork.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3060c19d01

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 69 to +70
if (params.authProfileId === null) {
return isolatedStartOptions;
return scopedStartOptions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep user-home Codex auth from inherited API keys

When appServer.homeScope is "user", resolveCodexAppServerClientStartContext passes authProfileId: null, so this branch returns before the existing withClearedEnvironmentVariables(...CODEX_API_KEY, OPENAI_API_KEY...) protection runs. In a Gateway process that already has OPENAI_API_KEY or CODEX_API_KEY for other OpenClaw/OpenAI usage, a shared-user-home app-server spawned against a ChatGPT-authenticated native ~/.codex can still inherit those API-key env vars and run under API-key auth instead of the user's native Codex account, which contradicts the new shared-home/native-auth mode and can bill or route through the wrong account. Clear inherited API-key env vars for user-home native auth unless the key is explicitly configured for this app-server launch.

Useful? React with 👍 / 👎.

@steipete
steipete requested a review from a team as a code owner July 4, 2026 08:22
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime security Security documentation labels Jul 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9e5670f69

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const requestedStartOptions =
options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start;
const usesNativeAuth =
options?.authProfileId === null || requestedStartOptions.homeScope === "user";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve native auth for user-home OpenAI turns

When homeScope: "user" is used with an agent routed through provider openai, this marks the app-server startup as native-auth but then returns authProfileId: undefined; the thread lifecycle only suppresses modelProvider: "openai" when isCodexAppServerNativeAuthProfile(...) sees a real native auth profile (extensions/codex/src/app-server/thread-lifecycle.ts:1792). Since the Codex harness explicitly supports openai as well as codex (extensions/codex/harness.ts:16), those user-home turns still send the public OpenAI provider override instead of letting Codex use the native user account/config promised by the new mode. Carry a native-auth/home-scope marker into model-provider selection, or otherwise omit the override for user-home native auth.

Useful? React with 👍 / 👎.

@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for the resynced exact head 75618c2115475faa41de3f71aaf3cfa19c9005d2:

  • Exact-head hosted CI completed successfully: run 28700644834, including build, type/lint, contracts, QA smoke, all selected test shards, docs, dependency, boundary, and security gates. Blacksmith Testbox, ARM Testbox, and build Testbox also passed.
  • Focused Codex/owner-context proof: 173 tests passed across the native thread tool, dynamic-tool owner propagation, coding-tool construction, and embedded-runner context paths. The pre-sync final feature commit after that run was documentation-only; the guarded sync then rebased the unchanged feature tree onto current main and reran the full exact-head matrix.
  • Live macOS Gateway proof: an owner turn used codex_threads to list, read, fork, rename, archive, restore, and reread a native Codex thread. A separate native Codex CLI process then resumed the OpenClaw-created fork successfully.
  • Full production build passed on the live host.
  • Final-head docs proof: pnpm docs:list, pnpm docs:check-mdx, pnpm docs:check-links (5,660 checked, zero broken), pnpm format:docs:check, and git diff --check passed.
  • Fresh structured Codex autoreview: no accepted/actionable findings remain.

The existing isolated per-agent Codex home remains the default. Shared user-home mode is explicit, local-stdio-only, owner-only for thread management, and documented with its native credential/state and cross-process writer boundaries.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: line Channel integration: line channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser app: ios App: ios app: web-ui App: web-ui scripts Repository scripts channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch labels Jul 4, 2026
@steipete
steipete merged commit 3d6a221 into main Jul 4, 2026
198 of 201 checks passed
@steipete
steipete deleted the codex/codex-coexistence branch July 4, 2026 08:43
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 5, 2026
* feat(codex): share native threads across clients

* test(codex): track coexistence temp dirs

* fix(codex): preserve native source on thread forks

* test(codex): use public temp fixtures

* fix(codex): preserve owner context for deferred tools

* fix(codex): forward owner identity to dynamic tools

* fix(codex): forward owner status to harness attempts

* docs(security): document shared Codex home

* docs(security): document shared Codex home

* docs(security): document shared Codex home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: line Channel integration: line channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: twitch Channel integration: twitch channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser docs Improvements or additions to documentation extensions: codex feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. gateway Gateway runtime maintainer Maintainer-authored PR 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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security Security documentation size: XL 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.

Codex coexistence: access native threads from OpenClaw

1 participant