fix(codex/app-server): forward workspace bootstrap into developerInstructions#77372
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-reproducible: current main finalizes Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this PR or an equivalent narrow patch after live app-server proof confirms workspace persona files reach an actual Codex thread start/resume path and final checks are green. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main finalizes Is this the best way to solve the issue? Yes for the code direction: the Codex protocol has an explicit Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5969ac8ccf8b. |
72511bf to
fbd3446
Compare
|
Addressed [P3] from clawsweeper review. Rebased onto current |
1060519 to
99c68ba
Compare
99c68ba to
ecb9e0b
Compare
ecb9e0b to
af3ab09
Compare
af3ab09 to
6a7ddf1
Compare
2620592 to
ffdcb2d
Compare
The OpenClaw workspace bootstrap block (SOUL.md, IDENTITY.md, USER.md, TOOLS.md, BOOTSTRAP.md, MEMORY.md, HEARTBEAT.md) was only being merged into Codex's config.instructions. The Codex app-server runtime overlay consistently applies the explicit developerInstructions field, so persona and style guidance present in the workspace was failing to shape Codex behavior on session resume. Build the workspace bootstrap block before finalizing developerInstructions and join it into both: - the baseline developerInstructions (initial assignment), and - the context-engine developerInstructions (when context engine is active), preserving the existing config-engine projection addition. The existing config.instructions merge stays intact, so the bootstrap now reaches Codex through both paths and downstream hooks (resolveAgentHarnessBeforePromptBuildResult) see what Codex will actually receive. AGENTS.md remains excluded because Codex loads it natively. Update the existing 'passes OpenClaw bootstrap files through ...' test to also assert the developerInstructions field carries SOUL.md and the Codex AGENTS.md substitution note while still excluding the native AGENTS.md content. Fixes openclaw#77363.
ffdcb2d to
49b4b3a
Compare
Summary
Fixes #77363: under the native Codex app-server runtime, OpenClaw workspace bootstrap files such as
SOUL.md,IDENTITY.md,USER.md,TOOLS.md,BOOTSTRAP.md,MEMORY.md, andHEARTBEAT.mdwere loaded, but only merged into Codexconfig.instructions.Codex treats
config.instructionsas the system/base-instructions lane, whiledeveloperInstructionsis inserted as a developer-role message. That meant persona/style bootstrap could miss the behavior-shaping lane used by app-server turns.Fix
Build the workspace bootstrap block before finalizing
developerInstructions, then join it into:developerInstructions, anddeveloperInstructionswhen the context engine is active.The bootstrap is no longer duplicated into
config.instructions.AGENTS.mdremains excluded from the explicit bootstrap block because Codex loads it natively.Verification
pnpm exec oxfmt --check --threads=1 extensions/codex/src/app-server/run-attempt.ts extensions/codex/src/app-server/run-attempt.test.ts docs/plugins/codex-harness.md CHANGELOG.md— clean.pnpm test extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/run-attempt.context-engine.test.ts— 2 files passed, 62 tests passed.pnpm docs:check-mdx docs/plugins/codex-harness.md— passed.Real behavior proof
thread/startdeveloperInstructions, instead of only inconfig.instructions.origin/main, using the Codex app-server harness code path with a stub app-server request collector.pnpm test extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/run-attempt.context-engine.test.tsafter the fixup commit.The regression test writes
AGENTS.mdandSOUL.md, startsrunCodexAppServerAttempt, captures the actualthread/startJSON-RPC payload emitted by the harness, and verifies the payload contains"Soul voice goes here."indeveloperInstructionswhileconfig.instructionsremains unset.params.developerInstructionscontains the SOUL.md bootstrap and the Codex-native AGENTS.md substitution note, raw AGENTS.md content is still excluded, andparams.config?.instructionsisundefinedfor this bootstrap path.../codexsource contract was checked to confirmdeveloper_instructionsis the developer-role message lane.Closes
Fixes #77363