Skip to content

Commit 0f35ec2

Browse files
lastguru-netBeru
andauthored
fix(codex): disable native thread personality (#85891) (thanks @lastguru-net)
Behavior addressed: Native Codex app-server threads now disable Codex's built-in personality on thread/start, thread/resume, turn/start, bound conversation turns, and /btw side-thread forks so OpenClaw agent workspace identity stays authoritative. Real environment tested: Local OpenClaw source checkout plus GitHub CI on PR #85891. Exact steps or command run after this patch: pnpm test extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/side-question.test.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/app-server/schema-normalization-runtime-contract.test.ts; pnpm check:docs; pnpm prompt:snapshots:check; OPENCLAW_ADDITIONAL_BOUNDARY_SHARD=1/4 OPENCLAW_ADDITIONAL_BOUNDARY_CONCURRENCY=4 node scripts/run-additional-boundary-checks.mjs. Evidence after fix: Focused Codex test shard passed 4 files / 79 tests; docs check passed; prompt snapshots are current; CI passed all code/quality checks, with only Real behavior proof failing as unrelated proof-bot gating for this non-channel change. Observed result after fix: App-server request snapshots and unit tests include personality: "none" on native Codex start/resume/turn/fork paths. What was not tested: A live Codex app-server model run was not executed. Co-authored-by: Beru <beru@lastguru.lv>
1 parent fda0141 commit 0f35ec2

13 files changed

Lines changed: 70 additions & 17 deletions

File tree

docs/gateway/config-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ Replace the entire OpenClaw-assembled system prompt with a fixed string. Set at
575575

576576
### `agents.defaults.promptOverlays`
577577

578-
Provider-independent prompt overlays applied by model family on OpenClaw-assembled prompt surfaces. GPT-5-family model ids receive the shared behavior contract across PI/provider routes; `personality` controls only the friendly interaction-style layer. Native Codex app-server routes keep Codex-owned base/model/personality instructions instead of this OpenClaw GPT-5 overlay.
578+
Provider-independent prompt overlays applied by model family on OpenClaw-assembled prompt surfaces. GPT-5-family model ids receive the shared behavior contract across PI/provider routes; `personality` controls only the friendly interaction-style layer. Native Codex app-server routes keep Codex-owned base/model instructions instead of this OpenClaw GPT-5 overlay, and OpenClaw disables Codex's built-in personality for native threads.
579579

580580
```json5
581581
{

docs/plugins/codex-harness-runtime.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ native Codex turn receives Codex app-server developer instructions, while an
2727
explicit PI compatibility route keeps the normal OpenClaw/PI system prompt even
2828
when it uses Codex-flavored OpenAI auth or transport.
2929

30-
Native Codex keeps Codex-owned base/model/personality instructions and
31-
project-doc behavior according to the active Codex thread config. Lightweight
30+
Native Codex keeps Codex-owned base/model instructions and project-doc behavior
31+
according to the active Codex thread config. OpenClaw starts and resumes native
32+
Codex threads with Codex's built-in personality disabled so workspace
33+
personality files and OpenClaw agent identity stay authoritative. Lightweight
3234
OpenClaw runs still preserve their existing project-doc suppression. OpenClaw
3335
developer instructions cover OpenClaw runtime concerns such as source-channel
3436
delivery, OpenClaw dynamic tools, ACP delegation, adapter context, and the
@@ -115,19 +117,19 @@ They do not invoke OpenClaw plugin hooks.
115117

116118
Supported in Codex runtime v1:
117119

118-
| Surface | Support | Why |
119-
| --------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120-
| OpenAI model loop through Codex | Supported | Codex app-server owns the OpenAI turn, native thread resume, and native tool continuation. |
121-
| OpenClaw channel routing and delivery | Supported | Telegram, Discord, Slack, WhatsApp, iMessage, and other channels stay outside the model runtime. |
122-
| OpenClaw dynamic tools | Supported | Codex asks OpenClaw to execute these tools, so OpenClaw stays in the execution path. |
123-
| Prompt and context plugins | Supported | OpenClaw projects OpenClaw-specific prompt/context into the Codex turn while leaving Codex-owned base, model, personality, and configured project-doc prompts in the native Codex lane. Native Codex developer instructions accept only command guidance explicitly scoped to `codex_app_server`; legacy global command hints remain for non-Codex prompt surfaces. |
124-
| Context engine lifecycle | Supported | Assemble, ingest, and after-turn maintenance run around Codex turns. Context engines do not replace native Codex compaction. |
125-
| Dynamic tool hooks | Supported | `before_tool_call`, `after_tool_call`, and tool-result middleware run around OpenClaw-owned dynamic tools. |
126-
| Lifecycle hooks | Supported as adapter observations | `llm_input`, `llm_output`, `agent_end`, `before_compaction`, and `after_compaction` fire with honest Codex-mode payloads. |
127-
| Final-answer revision gate | Supported through native hook relay | Codex `Stop` is relayed to `before_agent_finalize`; `revise` asks Codex for one more model pass before finalization. |
128-
| Native shell, patch, and MCP block or observe | Supported through native hook relay | Codex `PreToolUse` and `PostToolUse` are relayed for committed native tool surfaces, including MCP payloads on Codex app-server `0.125.0` or newer. Blocking is supported; argument rewriting is not. |
129-
| Native permission policy | Supported through Codex app-server approvals and compatibility native hook relay | Codex app-server approval requests route through OpenClaw after Codex review. The `PermissionRequest` native hook relay is opt-in for native approval modes because Codex emits it before guardian review. |
130-
| App-server trajectory capture | Supported | OpenClaw records the request it sent to app-server and the app-server notifications it receives. |
120+
| Surface | Support | Why |
121+
| --------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
122+
| OpenAI model loop through Codex | Supported | Codex app-server owns the OpenAI turn, native thread resume, and native tool continuation. |
123+
| OpenClaw channel routing and delivery | Supported | Telegram, Discord, Slack, WhatsApp, iMessage, and other channels stay outside the model runtime. |
124+
| OpenClaw dynamic tools | Supported | Codex asks OpenClaw to execute these tools, so OpenClaw stays in the execution path. |
125+
| Prompt and context plugins | Supported | OpenClaw projects OpenClaw-specific prompt/context into the Codex turn while leaving Codex-owned base, model, and configured project-doc prompts in the native Codex lane. OpenClaw disables Codex's built-in personality for native threads so agent workspace personality files remain authoritative. Native Codex developer instructions accept only command guidance explicitly scoped to `codex_app_server`; legacy global command hints remain for non-Codex prompt surfaces. |
126+
| Context engine lifecycle | Supported | Assemble, ingest, and after-turn maintenance run around Codex turns. Context engines do not replace native Codex compaction. |
127+
| Dynamic tool hooks | Supported | `before_tool_call`, `after_tool_call`, and tool-result middleware run around OpenClaw-owned dynamic tools. |
128+
| Lifecycle hooks | Supported as adapter observations | `llm_input`, `llm_output`, `agent_end`, `before_compaction`, and `after_compaction` fire with honest Codex-mode payloads. |
129+
| Final-answer revision gate | Supported through native hook relay | Codex `Stop` is relayed to `before_agent_finalize`; `revise` asks Codex for one more model pass before finalization. |
130+
| Native shell, patch, and MCP block or observe | Supported through native hook relay | Codex `PreToolUse` and `PostToolUse` are relayed for committed native tool surfaces, including MCP payloads on Codex app-server `0.125.0` or newer. Blocking is supported; argument rewriting is not. |
131+
| Native permission policy | Supported through Codex app-server approvals and compatibility native hook relay | Codex app-server approval requests route through OpenClaw after Codex review. The `PermissionRequest` native hook relay is opt-in for native approval modes because Codex emits it before guardian review. |
132+
| App-server trajectory capture | Supported | OpenClaw records the request it sent to app-server and the app-server notifications it receives. |
131133

132134
Not supported in Codex runtime v1:
133135

docs/providers/openai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ See [Video Generation](/tools/video-generation) for shared tool parameters, prov
551551

552552
OpenClaw adds a shared GPT-5 prompt contribution for GPT-5-family runs on OpenClaw-assembled prompt surfaces. It applies by model id, so PI/provider routes such as legacy pre-repair refs (`openai-codex/gpt-5.5`), `openrouter/openai/gpt-5.5`, `opencode/gpt-5.5`, and other compatible GPT-5 refs receive the same overlay. Older GPT-4.x models do not.
553553

554-
The bundled native Codex harness does not receive this OpenClaw GPT-5 overlay through Codex app-server developer instructions. Native Codex keeps Codex-owned base, model, personality, and project-doc behavior; OpenClaw contributes only runtime context such as channel delivery, OpenClaw dynamic tools, ACP delegation, workspace context, and OpenClaw skills.
554+
The bundled native Codex harness does not receive this OpenClaw GPT-5 overlay through Codex app-server developer instructions. Native Codex keeps Codex-owned base, model, and project-doc behavior, while OpenClaw disables Codex's built-in personality for native threads so agent workspace personality files stay authoritative. OpenClaw contributes only runtime context such as channel delivery, OpenClaw dynamic tools, ACP delegation, workspace context, and OpenClaw skills.
555555

556556
The GPT-5 contribution adds a tagged behavior contract for persona persistence, execution safety, tool discipline, output shape, completion checks, and verification on matching OpenClaw-assembled prompts. Channel-specific reply and silent-message behavior stays in the shared OpenClaw system prompt and outbound delivery policy. The friendly interaction-style layer is separate and configurable.
557557

extensions/codex/src/app-server/protocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export type CodexThreadStartParams = JsonObject & {
8080
cwd?: string;
8181
model?: string;
8282
modelProvider?: string | null;
83+
personality?: string | null;
8384
approvalPolicy?: string | JsonObject;
8485
approvalsReviewer?: string | null;
8586
sandbox?: string;
@@ -95,6 +96,7 @@ export type CodexThreadResumeParams = JsonObject & {
9596
threadId: string;
9697
model?: string;
9798
modelProvider?: string | null;
99+
personality?: string | null;
98100
approvalPolicy?: string | JsonObject;
99101
approvalsReviewer?: string | null;
100102
sandbox?: string;
@@ -150,6 +152,7 @@ export type CodexTurnStartParams = JsonObject & {
150152
sandboxPolicy?: CodexSandboxPolicy;
151153
serviceTier?: CodexServiceTier | null;
152154
effort?: string | null;
155+
personality?: string | null;
153156
environments?: CodexTurnEnvironmentParams[] | null;
154157
collaborationMode?: {
155158
mode: string;

extensions/codex/src/app-server/side-question.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,14 @@ describe("runCodexAppServerSideQuestion", () => {
385385
"developerInstructions",
386386
"ephemeral",
387387
"model",
388+
"personality",
388389
"sandbox",
389390
"threadId",
390391
"threadSource",
391392
]);
392393
expect(forkParams?.threadId).toBe("parent-thread");
393394
expect(forkParams?.model).toBe("gpt-5.5");
395+
expect(forkParams?.personality).toBe("none");
394396
expect(forkParams?.approvalPolicy).toBe("on-request");
395397
expect(forkParams?.sandbox).toBe("workspace-write");
396398
expect(forkParams?.ephemeral).toBe(true);
@@ -435,6 +437,7 @@ describe("runCodexAppServerSideQuestion", () => {
435437
input: [{ type: "text", text: "What changed?", text_elements: [] }],
436438
cwd: "/tmp/workspace",
437439
model: "gpt-5.5",
440+
personality: "none",
438441
effort: null,
439442
collaborationMode: {
440443
mode: "default",

0 commit comments

Comments
 (0)