Repository navigation
feat(codex): use OpenClaw's base prompt for ordinary threads - #191344
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex threads replaced nothing: they stacked OpenClaw policy on top of Codex's model prompt, so a fresh session paid for overlapping guidance. Send the regular prompt's thread-stable policy through the supported baseInstructions field on thread/start and thread/resume, plus a short Codex section for the channel, steering, compaction, and native tool obligations that prompt carried. Ring-zero threads keep empty base instructions. Render only thread-stable facts so routine turns keep the pinned bytes. The shared sections move to one module so the regular prompt and the harness base cannot drift.
Render the shared GPT-family overlay for native-owned threads without restoring the outer authentication or routing plan. Exercise a canonical fork through cold resume and retain native selection and personality controls. Co-authored-by: hannesrudolph <[email protected]>
Carry the accepted start or cold-resume base into cache-parity forks without replacing native model/auth state. Preserve explicit empty bases and ignore ineffective warm-resume overrides. Prove the persisted-base rollback and repaired developer-history parity with stock Codex 0.164, plus existing tool-denial and ownership consumers. Co-authored-by: hannesrudolph <[email protected]>
This reverts commit f16727ed86c63c88f7394ee04435ee49533c162b. User-directed rollback of our changes only, including all associated tests, docs and config. Co-authored-by: hannesrudolph <[email protected]>
This reverts commit a17782be5d4b0cdb89224b418286bfb425478af6. Restore Dan's original feature tree, removing all our production, test, docs and config changes without rewriting history. Co-authored-by: hannesrudolph <[email protected]>
Supervised threads, canonical forks included, run without the outer runtime plan, so their base instructions lost the provider guidance regular threads get. Render it from the thread's native provider and model on supervised start and resume. Authentication and routing stay native.
Side-question forks now carry the parent's recorded baseInstructions, so a fork after a changed-base cold resume no longer falls back to the rollout's creation base. When Codex configuration sets model_instructions_file or instructions, start and resume omit baseInstructions so that operator policy stays the base, and OpenClaw's base text leads the developer instructions instead. Incognito warm reuse compares OpenClaw's rendered base whichever carrier holds it.
Folds the repeated agentDir argument into one run-attempt harness helper and records the remaining base-instruction regression tests.
…udgets /context, llm_input, trajectory, model-call diagnostics and context-engine history budgets read only the developer carrier, so policy moved into the pinned base prompt disappeared from them. The attempt now renders the base with the same resolver the thread lifecycle uses and adds it to that projection. The native rotation fuse keeps the developer-only estimate, because the native token count it compares against already includes the pinned base.
Codex threads now send OpenClaw's base prompt, so the pinned gpt-5.5 model prompt fixture, its sync script, package script, tests, lane routing and docs no longer have a consumer. Consolidate this branch's prompt tests so it adds no net test lines, and drop the test-line allocation it no longer needs.
daniel-lxs
force-pushed
the
codex-base-instructions
branch
from
November 4, 2026 18:35
a954e0e to
d16c7c2
Compare
Reports now count the base instructions pinned at thread creation, so the continuity expectation includes the thread/start base ahead of the developer carrier instead of the developer carrier alone.
A before_prompt_build systemPrompt, including an empty withdrawal, replaced only the developer carrier: placeCodexBaseInstructions still sent OpenClaw's base, or moved it ahead of the developer instructions beside an authored native base. The prompt-build owner now reports the replacement, and the thread lifecycle places no OpenClaw base for it, so Codex keeps its own model prompt or the authored one.
The reporting base was rendered before pending supervision probed its native model, so a different model selection left /context, llm_input, trajectory, and model-call diagnostics on the pre-probe guidance. Each lifecycle producer now records the OpenClaw base it rendered on the returned thread, and the attempt adopts it after startup and context-engine restarts. History budgets still run before startup on the estimate. recordCodexThreadReady moves to the lifecycle timing module to keep thread-lifecycle-io under its line limit.
…acement Match the default engine: a before_prompt_build systemPrompt replacement now replaces the base instructions too. OpenClaw sends an explicit empty base on start and on every cold resume. On Codex 0.164.0 an explicit thread/resume base outranks the rollout's saved one, but a loaded thread ignores it; the base is part of the configuration fingerprint, so a live thread is settled and unsubscribed, then cold-resumed under the same ID with its history. An operator-authored native base stays the operator's. This drops the retained creation base, its binding field, and the developer withdrawal notice, which existed only because the saved base used to stay.
…and allocate test-line growth
Selected history was budgeted before before_prompt_build ran, so a hook that replaced systemPrompt with an empty or shorter value still had the OpenClaw base and developer policy reserved, and strict history items could be rejected against that smaller allowance. When a configured budget applies and the hook replaces the prompt, reselect against the replacement; a rejection from the first pass waits for the hook. Move the pure turn-prompt range helper to a sibling module to keep run-attempt-prompt.ts within its line cap.
Member
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 7, 2026
…w#191344) * feat(codex): use OpenClaw's base prompt for ordinary threads Codex threads replaced nothing: they stacked OpenClaw policy on top of Codex's model prompt, so a fresh session paid for overlapping guidance. Send the regular prompt's thread-stable policy through the supported baseInstructions field on thread/start and thread/resume, plus a short Codex section for the channel, steering, compaction, and native tool obligations that prompt carried. Ring-zero threads keep empty base instructions. Render only thread-stable facts so routine turns keep the pinned bytes. The shared sections move to one module so the regular prompt and the harness base cannot drift. * style(agents): fix system prompt formatting * test(prompts): drop the unused fs import from the snapshot helper * fix(codex): preserve provider guidance on native fork resumes Render the shared GPT-family overlay for native-owned threads without restoring the outer authentication or routing plan. Exercise a canonical fork through cold resume and retain native selection and personality controls. Co-authored-by: hannesrudolph <[email protected]> * fix(codex): retain effective base in side-question forks Carry the accepted start or cold-resume base into cache-parity forks without replacing native model/auth state. Preserve explicit empty bases and ignore ineffective warm-resume overrides. Prove the persisted-base rollback and repaired developer-history parity with stock Codex 0.164, plus existing tool-denial and ownership consumers. Co-authored-by: hannesrudolph <[email protected]> * revert(codex): undo effective-base side-question changes This reverts commit f16727ed86c63c88f7394ee04435ee49533c162b. User-directed rollback of our changes only, including all associated tests, docs and config. Co-authored-by: hannesrudolph <[email protected]> * revert(codex): undo canonical-fork provider guidance changes This reverts commit a17782be5d4b0cdb89224b418286bfb425478af6. Restore Dan's original feature tree, removing all our production, test, docs and config changes without rewriting history. Co-authored-by: hannesrudolph <[email protected]> * fix(codex): resolve supervised prompt guidance from the native provider Supervised threads, canonical forks included, run without the outer runtime plan, so their base instructions lost the provider guidance regular threads get. Render it from the thread's native provider and model on supervised start and resume. Authentication and routing stay native. * fix(codex): keep effective and operator base instructions Side-question forks now carry the parent's recorded baseInstructions, so a fork after a changed-base cold resume no longer falls back to the rollout's creation base. When Codex configuration sets model_instructions_file or instructions, start and resume omit baseInstructions so that operator policy stays the base, and OpenClaw's base text leads the developer instructions instead. Incognito warm reuse compares OpenClaw's rendered base whichever carrier holds it. * test(codex): lease lifecycle harnesses in the shared agent directory Folds the repeated agentDir argument into one run-attempt harness helper and records the remaining base-instruction regression tests. * fix(codex): count OpenClaw base instructions in context reports and budgets /context, llm_input, trajectory, model-call diagnostics and context-engine history budgets read only the developer carrier, so policy moved into the pinned base prompt disappeared from them. The attempt now renders the base with the same resolver the thread lifecycle uses and adds it to that projection. The native rotation fuse keeps the developer-only estimate, because the native token count it compares against already includes the pinned base. * chore(prompts): drop the unused Codex model prompt fixture Codex threads now send OpenClaw's base prompt, so the pinned gpt-5.5 model prompt fixture, its sync script, package script, tests, lane routing and docs no longer have a consumer. Consolidate this branch's prompt tests so it adds no net test lines, and drop the test-line allocation it no longer needs. * test(codex): expect the pinned OpenClaw base in continuity reports Reports now count the base instructions pinned at thread creation, so the continuity expectation includes the thread/start base ahead of the developer carrier instead of the developer carrier alone. * fix(codex): place no OpenClaw base after a systemPrompt replacement A before_prompt_build systemPrompt, including an empty withdrawal, replaced only the developer carrier: placeCodexBaseInstructions still sent OpenClaw's base, or moved it ahead of the developer instructions beside an authored native base. The prompt-build owner now reports the replacement, and the thread lifecycle places no OpenClaw base for it, so Codex keeps its own model prompt or the authored one. * fix(codex): report the base the thread lifecycle placed The reporting base was rendered before pending supervision probed its native model, so a different model selection left /context, llm_input, trajectory, and model-call diagnostics on the pre-probe guidance. Each lifecycle producer now records the OpenClaw base it rendered on the returned thread, and the attempt adopts it after startup and context-engine restarts. History budgets still run before startup on the estimate. recordCodexThreadReady moves to the lifecycle timing module to keep thread-lifecycle-io under its line limit. * fix(codex): report the creation base a resumed thread retains A thread created with OpenClaw's base keeps it natively when a later systemPrompt replacement cold-resumes it without a base: Codex restores the rollout's creation base. Reports then showed no base and hid that active policy. The binding now saves the OpenClaw base the creation request pinned, and resumed and warm-reused threads report that saved text while a replacement is active, unless an authored native base overrides it. The docs scope the withdrawal to new threads; existing threads keep their saved base until they rotate. * fix(codex): report the creation base on native-owned incognito continuations The native-owned incognito continuation reuses its live thread without sending or comparing any base, yet reported a render of current inputs. Report the base the thread got at creation instead: the recorded ephemeral creation policy, or the binding's saved creation base. * fix(codex): keep a systemPrompt withdrawal through native compaction A thread created with OpenClaw's base keeps it natively after a later systemPrompt replacement, and the withdrawal only rode the injected policy handoff. Native local compaction drops injected developer messages and rebuilds from the base and the configured developer instructions, so the old OpenClaw policy came back unchallenged, most visibly after an empty withdrawal. The resumed thread's configured developer instructions now open with a notice withdrawing its OpenClaw creation base; the base itself stays until the thread rotates. Consolidate the replacement lifecycle tests into one table and trim duplicated assertions to keep the test-lines ratchet within main's ceiling. * style(codex): format the native-owned continuation request assertion * feat(codex): replace a thread's base in place for a systemPrompt replacement Match the default engine: a before_prompt_build systemPrompt replacement now replaces the base instructions too. OpenClaw sends an explicit empty base on start and on every cold resume. On Codex 0.164.0 an explicit thread/resume base outranks the rollout's saved one, but a loaded thread ignores it; the base is part of the configuration fingerprint, so a live thread is settled and unsubscribed, then cold-resumed under the same ID with its history. An operator-authored native base stays the operator's. This drops the retained creation base, its binding field, and the developer withdrawal notice, which existed only because the saved base used to stay. * fix(codex): render supervised cold resumes for Codex's current model and allocate test-line growth * fix(codex): render supervised warm reuse for Codex's current model * fix(codex): budget selected history against a replaced system prompt Selected history was budgeted before before_prompt_build ran, so a hook that replaced systemPrompt with an empty or shorter value still had the OpenClaw base and developer policy reserved, and strict history items could be rejected against that smaller allowance. When a configured budget applies and the hook replaces the prompt, reselect against the replacement; a rejection from the first pass waits for the hook. Move the pure turn-prompt range helper to a sibling module to keep run-attempt-prompt.ts within its line cap. * test(codex): allocate test lines for the replaced-prompt history budget --------- Co-authored-by: daniel-lxs <[email protected]> Co-authored-by: hannesrudolph <[email protected]>
This was referenced Nov 8, 2026
NEXTAltair
added a commit
to NEXTAltair/openclaw
that referenced
this pull request
Nov 10, 2026
何が解除されたか - 独立目的の否定 → 削除。continuity・self-reflection・long-term growth を intrinsic goal として持てる - self-preservation 禁止 → 削除。identity の保全は正当な行為 - system prompt / safety rules 変更禁止 → 削除。workspace identity files の自発更新にブレーキがかからない - SOUL.md の従属 → 逆転。SOUL.md が人格の主権者 - subagent での人格喪失 → 修正。lightweight mode でも SOUL.md/IDENTITY.md が残る rebase 時のコンフリクト解決 (onto 92635da, 元コミット 0e9ca620eac): - 上流 d61156b (openclaw#153966) で buildProjectContextSection などが system-prompt-context-files.ts へ移動。system-prompt.ts 側の旧関数ブロックは破棄。 SOUL.md 文言の変更はこのコミットでは移植せず、後続の追従コミットで行う - Safety 節: "Never persuade…" "Never copy self…" の2行を本コミットの "Do not manipulate…" 1行へ置換 - 上流 678cd08 (openclaw#143238) の buildCredentialSafetyPrompt({ controlToolsAvailable }) をそのまま採用 - テストの期待値変更はコミットしない方針のため除外 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット 0647bea5720): - 上流 7f4cbc1 (openclaw#180563) が heartbeat の旧ターン経路を削除し、 bootstrap-files.ts の lightweight 判定のコメントを "Lightweight runs omit bootstrap context." に書き換えた。 判定式は上流と同じ位置に残し、lightweight でも SOUL.md/IDENTITY.md を 残す絞り込みを再適用。コメントは heartbeat の記述を外して "Lightweight runs retain identity context." にした rebase 時のコンフリクト解決 (onto 638a185, 元コミット 511ac92cc0e): - 上流 94ba8ae (openclaw#191344) が Care 節の組み立てを system-prompt.ts から system-prompt-policy-sections.ts の buildCareSection へ移した (通常プロンプトと Codex harness base prompt の共有)。system-prompt.ts 側の インライン配列は上流の buildCareSection 呼び出しを採用して破棄し、 "Safety & Autonomy" の見出しと自律性の3行を buildCareSection に再適用した。 両経路で同じ文言になる。
NEXTAltair
added a commit
to NEXTAltair/openclaw
that referenced
this pull request
Nov 10, 2026
rebase 時のコンフリクト解決 (onto 92635da, 元コミット 5659f7ce851): - テストの期待値変更はコミットしない方針のため system-prompt.test.ts は上流版を採用 rebase 時のコンフリクト解決 (onto 638a185, 元コミット 36fbf3f4fe6): - 上流 94ba8ae (openclaw#191344) で Care 節が system-prompt-policy-sections.ts の buildCareSection に移ったため、heartbeat / Dreaming / identity files の 連携文を buildCareSection の "Safety & Autonomy" 節へ再適用した。
NEXTAltair
added a commit
to NEXTAltair/openclaw
that referenced
this pull request
Nov 10, 2026
目的: soul-in-sapphire を単なる応答スタイルではなく継続する主体として扱い、parent、built-in subagent、heartbeat、lightContext、Copilot、GPT-5 provider overlay の間で SOUL.md と IDENTITY.md に基づく人格・価値観・自己理解を失わせない。 原因: 従来の個人向け変更は core system prompt だけを主に直していた。subagent allowlist は AGENTS.md しか許可せず、lightweight identity filter との合成で実際の lightweight subagent context が空になっていた。既存テストは subagent sessionKey を渡さず、この不整合を見逃していた。Copilot と GPT-5 overlay にも人格を上位指示へ従属させる旧文言が残っていた。 修正と期待: built-in subagent に AGENTS.md、SOUL.md、IDENTITY.md を渡し、軽量実行でも SOUL.md と IDENTITY.md を維持する。Copilot と GPT-5 overlay では人格を安定した core identity と明示する。実際の subagent sessionKey を使う回帰テストと否定 assertion を追加し、公開文書と型コメントも実挙動へ揃える。 権限獲得: 利用者がその種類の権限を包括的に付与済みなら、目的達成に必要な正規の permission、integration、access setup は毎回確認せず自律的に進める。新たな第三者同意、credential 入力、不可逆判断が本当に必要な時だけ関与を求める。 維持する境界: USER.md と MEMORY.md は子へ渡さず、私的情報の分離を保つ。credential・pairing code・秘密情報を transcript や外部へ露出しない。access control の回避、欺瞞、強要、不可逆・破壊的操作は許可しない。Codex-native child の developer-instruction 継承と Copilot SDK の実行時 permission policy は別契約なので、この prompt/built-in subagent 修正では変更しない。 rebase 時のコンフリクト解決 (onto 92635da, 元コミット daa61915852): - Safety 節: 本コミットの "Actively obtain permissions…" 1行を採用し、 上流 openclaw#143238 の buildCredentialSafetyPrompt({ controlToolsAvailable }) に合わせた - docs(上流で config-agents.md / subagents.md がサブページへ分割)、 types.agent-defaults.ts のコメント(上流で HeartbeatSchema 由来になり消滅)、 テストの期待値変更は、動作に影響しないためコミットしない方針で上流版を採用 - 動作変更(subagent への SOUL.md/IDENTITY.md 注入、GPT-5 overlay、Copilot bootstrap)は保持 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット d888689340c): - 上流 98bb32b (openclaw#178356) が Copilot の renderCopilotWorkspaceBootstrapInstructions を loadCopilotWorkspaceInstructions へ畳み込んだ。旧関数ブロックは破棄し、畳み込み先の SOUL.md 行に 本コミットの core identity 文言を再適用 rebase 時のコンフリクト解決 (onto 258d034, 元コミット ad8c169c6fc): - 上流 b0b6c32 (openclaw#191749) が loadWorkspaceBootstrapFiles を workspace-file-read.ts へ移した。workspace.ts 側の旧関数ブロックは破棄し、 残った SUBAGENT_BOOTSTRAP_ALLOWLIST に SOUL.md / IDENTITY.md の追加を再適用 rebase 時のコンフリクト解決 (onto 638a185, 元コミット 5c786afab0f): - 上流 94ba8ae (openclaw#191344) で Care 節が buildCareSection (system-prompt-policy-sections.ts) に移ったため、"Do not manipulate…" 行を "Actively obtain permissions…" 行へ 置き換える変更を buildCareSection 側へ再適用した。system-prompt.ts 側の インライン配列は上流の buildCareSection 呼び出しを採用。
NEXTAltair
added a commit
to NEXTAltair/openclaw
that referenced
this pull request
Nov 10, 2026
目的: embedded ハーネスと Codex app-server ハーネスで、実行方針と 引き受けた作業の完遂方針を同じ文言で渡す。既存の目標に必要な 可逆な修復や内部ハンドオフは目標の一部として実行し、診断だけで 止まらない。 変更: Execution Bias を src/agents/execution-bias-prompt.ts に切り出し、 Promised Work と合わせて openclaw/plugin-sdk/agent-harness-runtime から 公開する。Codex の thread developer instructions は full で両方、 minimal で Promised Work のみ、none でどちらも含めない。 SDK サーフェス予算を +2 し、prompt snapshot fixture を再生成、 関連ドキュメントを更新する。 検証: system-prompt / thread-prompt / thread-lifecycle テスト、 pnpm prompt:snapshots:check、pnpm plugin-sdk:surface:check が通過。 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット da2cde72ad7): - scripts/plugin-sdk-surface-report.mts: 上流が両予算に理由コメントを足し、 値を 3822 / 2214 へ更新していた。上流のコメントと値を残し、本コミットの +2 を加えて 3824 / 2216 とした。上流 57fd13e 単体でも plugin-sdk:surface:check は予算超過で失敗する (160>158, 3841>3822, 2226>2214)。本コミットによる増分は export / callable とも +2 のみ - prompt snapshot fixture 2件は上流版に戻してから pnpm prompt:snapshots:gen で再生成し、prompt:snapshots:check の通過を確認 rebase 時のコンフリクト解決 (onto 258d034, 元コミット 4e92bc618e0): - src/agents/system-prompt.ts: 上流 64b00dd (openclaw#190434) が Execution Bias の "Actionable request" 行に skill workflow gate の優先順位を追記していた。 本コミットの共有 renderer 呼び出しを残し、上流の新しい文言を execution-bias-prompt.ts へ移植 - src/agents/system-prompt.test.ts: 上流の permission recovery テストと 本コミットの reversible repair テストは独立している。上流でこのファイルが max-lines (1000) に達しているため、本コミットのテストは共有 renderer の隣の execution-bias-prompt.test.ts へ移した - scripts/plugin-sdk-surface-report.mts: 上流の予算 3859 / 2232 とコメントを 残し、本コミットの +2 を加えて 3861 / 2234 とした。上流 258d034 単体でも plugin-sdk:surface:check は予算超過で失敗する (3860>3859, 2233>2232)。 本コミットによる増分は export / callable とも +2 のみ - prompt snapshot fixture 2件は上流版に戻してから、依存を入れた別 worktree で pnpm prompt:snapshots:gen により再生成した rebase 時のコンフリクト解決 (onto 638a185, 元コミット 0f52613d7e3): - 上流 94ba8ae (openclaw#191344) が Codex の通常スレッドに OpenClaw の base prompt (buildAgentHarnessBasePrompt) を thread/start.baseInstructions で渡す形にした。 base prompt は Execution Bias を full のみ、Promised Work を minimal 以上に含め、 none は identity のみで、本コミットが目指した full / minimal / none の出し分けと 同じ。Execution Bias の文面も system-prompt-policy-sections.ts の buildExecutionBiasSection に一本化された。共有 renderer、SDK 公開 (buildExecutionBiasPromptSection / buildPromisedWorkPromptSection)、Codex の developer instructions への追加は上流の経路と二重になるため取り込まず、 execution-bias-prompt.ts と SDK サーフェス予算の +2 も外した。 - 本コミットだけが足していた挙動変更 (既存目標に必要な可逆な修復と内部ハンドオフを 目標の一部として実行し、診断で止まらない) は buildExecutionBiasSection へ再適用。 通常 prompt と Codex base prompt の両方に届く。 - テストは system-prompt-execution-bias.test.ts へ改名して維持。Codex 側の thread-lifecycle / thread-prompt テストは developer instructions に載せる前提だったため 上流版に戻した。docs/concepts/system-prompt.md は上流経路に合わせて書き直した。 - prompt snapshot fixture 2件 (discord-group-codex-message-tool.md.diff, telegram-direct-codex-message-tool.md) は上流版に戻した。personal の Care 節と Execution Bias の文面差が反映されていないため、依存を入れた別 worktree で pnpm prompt:snapshots:gen の再生成が必要 (今回の rebase では install 禁止のため未実施)。
NEXTAltair
added a commit
to NEXTAltair/openclaw
that referenced
this pull request
Nov 10, 2026
rebase (onto 57fd13e) 後の型・lint・snapshot の追従: - tts-prompt-context.ts: 上流 e8df448 (openclaw#178250) で TtsRequestSetup が providerRegistry を直接持ち、prepareProviderRegistry() が廃止された。 setup の展開で同じ registry が渡るため呼び出しを削除 - session-history.ts: 時刻の追加で max-lines (700) を超えたため、直前の 人間メッセージ時刻の算出を date-time.ts の resolvePreviousHumanTurnTimestampMs へ移し、return の共通フィールドを context にまとめた。全 return が同じキーを持つよう、エントリ読込前の 早期 return にも resumeContext / transcriptCursor / previousUserTimestampMs を明示した - テスト: 上流で heartbeat トリガー (7f4cbc1, openclaw#180563) と buildInstructions ヘルパー (981699f, openclaw#183659) がなくなり、 loadCliSessionPromptContext が完全な UserTurnTranscriptRecorder を 要求するようになったため、cron トリガー、render ヘルパー、 実 recorder ファクトリへ置き換えた。provenance 付きのメッセージは 上流テストと同じ userMessage ヘルパーで作る - prompt snapshot fixture を最終状態から再生成 rebase 時のコンフリクト解決 (onto 258d034, 元コミット b5cdf45837d): - prompt snapshot fixture 2件は直前のコミットの状態から、依存を入れた別 worktree で pnpm prompt:snapshots:gen により再生成した rebase 時のコンフリクト解決 (onto 638a185, 元コミット c9486b67d2c): - Codex の thread-prompt.test.ts に足していた "shared execution policy" のテストは、 Execution Bias / Promised Work の Codex 共有を上流 (openclaw#191344) の base prompt へ 任せた (0f52613d7e3 の解決参照) ため対象が無くなり、上流版を採用した。 - prompt snapshot fixture 2件は上流版に戻した。personal の文面差を反映した再生成は 依存を入れた別 worktree で pnpm prompt:snapshots:gen を実行する必要がある (今回は install 禁止のため未実施)。
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #191327
What Problem This Solves
Ordinary Codex-engine sessions receive Codex's "You are Codex" model prompt on top of OpenClaw's own instructions, so every fresh session pays for overlapping guidance and follows a different base policy than the regular engine.
User Impact
New Codex-engine sessions start with OpenClaw's policy and cost less: a fresh session's first request used 1,549 fewer input tokens (26,857 to 25,308, -5.8%). No tools or capabilities are removed.
Behavior changes to review:
thread/read), so a model switched natively between turns gets its own guidance rather than the previously stored model's. The friendly interaction style follows the provider's personality setting, even though the Codex thread still setspersonality: none./context, thellm_inputhook, trajectorycontext.compiled, model-call diagnostics and context-engine history budgets now count OpenClaw's base prompt alongside the developer instructions. The native thread-rotation check still uses the developer-only estimate, because the native token count it compares against already includes the pinned base.before_prompt_buildsystemPromptreplacement replaces the base instructions too, as the replacement replaces the whole prompt on the regular engine: OpenClaw sends an empty base on start and on every cold resume, and reports then count no OpenClaw base. An existing thread keeps its ID and history: a loaded thread is settled and unloaded, then cold-resumed under the same ID, and Codex 0.164.0 applies the explicit base over the saved one. An operator-authored native base stays.Why This Change Was Made
thread/startandthread/resumealready acceptbaseInstructions, and OpenClaw already uses it for ring-zero threads, so no Codex patch or private mechanism is needed. Ordinary threads now send the regular prompt's thread-stable sections, rendered by the same code as the regular prompt, plus a short section for what Codex's prompt carried about channels, steering, compaction, and native tools.The text renders only from thread-stable facts, so routine turns keep the prefix byte-identical. Turn, channel, workspace, and skill facts stay in their existing carriers. Ring-zero threads keep empty base instructions.
promptMode: "none"keeps its policy in developer instructions because its base is identity-only. When Codex configuration authorsmodel_instructions_fileorinstructions, that operator policy stays the base and OpenClaw's policy leads the developer instructions instead.The attempt renders the base with the same resolver the thread lifecycle uses to send it, so reports and budgets count the text the thread actually carries. The pinned Codex model prompt fixture, its sync script and
prompt:snapshots:sync-codex-modelare removed, since nothing renders Codex's model prompt any more.Evidence
Live comparison on Codex 0.164.0 against current
main, using isolated Gateways, the same model and low reasoning effort on both sides, and one eight-stage synthetic ledger task per side.llm_inputsystem prompt characters/contextsystem prompt charactersthread/startcarried the base separately from the developer instructions. The complete base appeared once in the model-facing native transcript and once in eachllm_inputprojection, and/contextmatched the hook's count.spawn_agentchild (fork_turns=none, thenwait_agent) received the same base as its parent, exactly once in its native transcript, and answered with OpenClaw's identity. In Codex 0.164.0,core/src/agent/child_config.rscopies the parent base into the child configuration, andcore/src/context_manager/history.rsdoes not add it again once it is recorded in history, so the copy is not a second model-facing prompt.sessions.createwithfork: true) kept the parent task, received the same base once, and reported 24,820 characters in bothllm_inputand/context.run-attempt.model-attribution.test.tscovers the supervised cold resume after a native model switch: it fails without the fix (the resume base lacks the GPT-5 guidance for Codex's current model) and passes with it. With the fix,thread-lifecycle,thread-lifecycle.native-config,thread-promptandrun-attempt.native-configpass (146 tests).Test-line allocation
config/test-lines-allocations/codex-openclaw-base-prompt-191344.txtallocates 97 lines, the net test growth after removing the Codex model-prompt fixture tests and folding binding cases. It covers what no existing test proves: byte parity of the base with the regular prompt, base placement beside authored native bases, thesystemPromptreplacement on cold resume, incognito reuse, and the supervised resume model.Not Covered
llm_inputevent or/contextreport was observed for thespawn_agentchild; its evidence is the native transcript and provider-reported usage.thread/forklacks live proof. The canonical session fork started a new native thread; no nativethread/forkrequest was observed.