Repository navigation
Keep Codex runtime context out of user history - #84790
TurboTheTurtle wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. source-level. Current main visibly constructs PR rating Rank-up moves:
What the crustacean ranks mean
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Use a Codex-supported, non-persisted path for transient reference context, or split trusted OpenClaw-owned instructions from user-editable reference data and merge only after maintainers explicitly accept the prompt-boundary and upgrade tradeoff with real fresh-session plus stale-bound-session proof. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main visibly constructs Is this the best way to solve the issue? No. The stale-history cleanup is useful, but relying on an unproven Label justifications:
Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 8284c035a096. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Acknowledged on the ClawSweeper review. I am not going to request re-review on this PR with only the existing harness output, because the review identified two blockers that proof alone would not honestly clear:
Next action should be a code follow-up for those two points, then real after-fix proof from a multi-turn Codex app-server run and, ideally, a compact/replay path. |
|
@clawsweeper re-review Follow-up pushed in
Local validation: focused app-server tests 226 passed, |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Follow-up pushed in
Validation: focused app-server tests |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing this for now since I do not have stronger real-behavior proof for the prompt/protocol boundary concerns, and I do not want to keep an older PR open that is not realistically merge-ready in its current shape. Thanks for the review and context. |
Fixes #84662.
Summary
turn/start.inputuser textcollaborationMode.settings.reference_contextas non-authoritative reference data instead ofdeveloper_instructionsOpenClaw runtime context for this turn:user-message wrappers, and start a fresh native Codex thread when a bound thread would otherwise replay themReal behavior proof
Behavior or issue addressed: Codex app-server turns should receive the actual user request as user input, while OpenClaw runtime/workspace context stays out of user history and stale mirrored-history wrappers do not get replayed into resumed native Codex threads.
Real environment tested: Local OpenClaw checkout in
/tmp/openclaw-pr-84790on macOS at commitffe4c44b65, using the repository's Codex app-server runtime builders, mirrored session-history reader, Vitest app-server harness, prompt snapshot generator, TypeScript test config, the local standalonecodex-cli 0.124.0protocol generator, and the officialopenai/codexrust-v0.132.0generated protocol source.Exact steps or command run after this patch:
node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/src/app-server/session-history.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/run-attempt.test.tsnode /Users/andy/src/openclaw/node_modules/.bin/tsgo -p test/tsconfig/tsconfig.extensions.test.json --pretty false --declaration false --singleThreaded --checkers 1node /Users/andy/src/openclaw/node_modules/.bin/oxfmt --check --threads=1 extensions/codex/src/app-server/session-history.ts extensions/codex/src/app-server/session-history.test.ts extensions/codex/src/app-server/run-attempt.ts extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/thread-lifecycle.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/protocol.ts test/helpers/agents/happy-path-prompt-snapshots.ts test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-direct-codex-message-tool.md test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/discord-group-codex-message-tool.md test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-heartbeat-codex-tool.md && git diff --checknode --import /Users/andy/src/openclaw/node_modules/tsx/dist/loader.mjs scripts/generate-prompt-snapshots.ts --checkgh api 'repos/openai/codex/contents/codex-rs/app-server-protocol/schema/typescript/Settings.ts?ref=rust-v0.132.0' --jq '.content' | base64 --decode | sed -n '1,60p'tmpdir=$(mktemp -d /tmp/codex-live-protocol-XXXXXX); codex app-server generate-ts --experimental --out "$tmpdir"; codex --version; sed -n '1,80p' "$tmpdir/Settings.ts"; sed -n '70,90p' "$tmpdir/v2/TurnStartParams.ts"Evidence after fix:
Test Files 3 passed (3),Tests 226 passed (226).All matched files use the correct formatandgit diff --checkclean.Prompt snapshots are current (7 files).rust-v0.132.0generatedSettings.tscontains onlymodel,reasoning_effort, anddeveloper_instructions; there is noreference_contextfield.codex-cli 0.124.0app-server generate-ts --experimentalproduced the sameSettings.tsshape, whilev2/TurnStartParams.tsconfirmscollaborationMode?: CollaborationMode | nulland documentscollaboration_mode.settings.developer_instructionsas the supported turn-scoped collaboration-mode channel.turn/start.inputas the user request only, noreference_contextkey, andcollaborationMode.settings.developer_instructionscarrying anOpenClaw Current-Turn Reference Contextblock wrapped in<openclaw_reference_context>.OpenClaw runtime context for this turn:plusCurrent user request: prior real request, writes an existing native Codex binding, runsrunCodexAppServerAttempt, and verifies nothread/resumerequest is sent, a freshthread/startis sent, theturn/startinput containsprior real requestandnew request, and the stale runtime-context marker is absent from user input.Observed result after fix: Current-turn OpenClaw runtime context is no longer serialized into Codex user input or stale user-history projection. It is sent through the generated Codex-supported turn-scoped
collaborationMode.settings.developer_instructionspath with an explicit untrusted-reference wrapper, and stale history entries that already contain the old wrapper are stripped before mirrored history projection. If such stale history exists with a saved native thread binding, the app-server clears the binding and starts a new native Codex thread instead of resuming a thread that could replay the old privileged-looking user message.What was not tested: I did not run a live Discord/Telegram production turn against the installed OpenClaw gateway from this PR branch. A standalone local
codex app-servermodel-completion probe could initialize and start a thread, but the local standalonecodexauth currently fails model calls with401 Unauthorized: Missing bearer or basic authentication, so I did not claim a completed live model response as proof.Validation
node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/src/app-server/session-history.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/run-attempt.test.tsnode /Users/andy/src/openclaw/node_modules/.bin/tsgo -p test/tsconfig/tsconfig.extensions.test.json --pretty false --declaration false --singleThreaded --checkers 1node /Users/andy/src/openclaw/node_modules/.bin/oxfmt --check --threads=1 extensions/codex/src/app-server/session-history.ts extensions/codex/src/app-server/session-history.test.ts extensions/codex/src/app-server/run-attempt.ts extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/thread-lifecycle.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/protocol.ts test/helpers/agents/happy-path-prompt-snapshots.ts && git diff --checknode --import /Users/andy/src/openclaw/node_modules/tsx/dist/loader.mjs scripts/generate-prompt-snapshots.ts --checkIf this PR is squash-merged or reworked, please preserve author attribution or include:
Co-authored-by: Andy Ye <[email protected]>