fix(codex): beta blocker - keep context engine on canonical session key#84954
Conversation
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. Current main source clearly passes sandboxSessionKey into Codex context-engine lifecycle calls while the runtime policy resolver can derive per-peer Telegram direct-message keys; the linked issue and PR body provide logs for the observed stale LCM selection. 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 Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the split-key fix after maintainer beta-gate acceptance, keeping context/history identity on the canonical run session while sandbox/tool policy stays on the sandbox session key. Do we have a high-confidence way to reproduce the issue? Yes. Current main source clearly passes sandboxSessionKey into Codex context-engine lifecycle calls while the runtime policy resolver can derive per-peer Telegram direct-message keys; the linked issue and PR body provide logs for the observed stale LCM selection. Is this the best way to solve the issue? Yes. Separating contextSessionKey from sandboxSessionKey is the narrowest maintainable fix because it restores context continuity without changing sandbox/tool/runtime policy scoping. Label changes:
Label justifications:
Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 6dbd5bd4460e. |
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Velvet Patch Peep Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
0fea5e7 to
f7633bf
Compare
f7633bf to
13ba4ea
Compare
Ensure Codex context-engine history uses the run session key even when sandbox policy uses a per-peer key. Co-authored-by: Cursor <cursoragent@cursor.com>
169acca to
6cdccaa
Compare
|
Merged via squash.
Thanks @neeravmakwana! |
Summary
runtimePolicySessionKeyfor sandbox/runtime policy decisions, and Codex was reusing that key for context-engine history.contextSessionKeyderived from the canonical runsessionKey, and use it for context-engine/bootstrap/finalization surfaces.Motivation
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
agent:main:maineven when runtime policy derives a per-peer Telegram key..envand not printed; Telegram DM sender was allowlisted by numeric ID.sessionKey=agent:main:mainon dispatch, compaction checks, embedded pre-prompt diagnostics, and completion.sessionKey=agent:main:mainthrough queueing, run start, context diagnostics, and message completion. The focused Codex context-engine regression verifies bootstrap and assemble also receiveagent:main:mainwhensandboxSessionKeydiffers.plugins.slots.contextEngine, so the exact LCM bootstrap/assemble split is covered by the focused regression rather than the Telegram proof run.runtimePolicySessionKeycould be assigned tosandboxSessionKey, and Codex previously reusedsandboxSessionKeyfor context-engine calls.Root Cause (if applicable)
runCodexAppServerAttemptused the sandbox session key as the effectivesessionKeyfor context-engine and workspace-context surfaces. For Telegram DMs, that sandbox key can be a derived per-peer runtime policy key, not the canonical conversation key.sessionKeyandsandboxSessionKeyintentionally differ.Regression Test Plan (if applicable)
extensions/codex/src/app-server/run-attempt.context-engine.test.tssessionKey=agent:main:mainandsandboxSessionKey=agent:main:telegram:default:direct:12345still passagent:main:mainto context-engine bootstrap and assemble.User-visible / Behavior Changes
Telegram DM runs that derive per-peer runtime policy keys keep context/history selection on the canonical run session. No config, defaults, CLI flags, or generated files change.
Diagram (if applicable)
Security Impact (required)
NoNoNoNoNoYes, explain risk + mitigation: N/A.Security/runtime controls unchanged: sandbox resolution still receives
sandboxSessionKey; runtime policy, tool selection, channel authorization, Telegram allowlisting, and provider credentials handling are unchanged. This PR only separates the context-engine session key from the runtime policy key.Repro + Verification
Environment
channels.telegram.enabled=true,dmPolicy=allowlist, only the proof Telegram user ID inallowFrom; other channels disabled; token loaded from.envwithout printing itSteps
Expected
sessionKey=agent:main:main.sandboxSessionKeydiffers.Actual
Evidence
Exact checks run:
Results:
Human Verification (required)
sessionKeyandsandboxSessionKeydiffer; live Telegram DM dispatch through the patched gateway.sessionKey=agent:main:telegram...in runtime/context lines, and none were found for the proof turn.plugins.slots.contextEngineset to Lossless; this remains covered by the focused regression test.Review Conversations
Compatibility / Migration
YesNoNoRisks and Mitigations
Out of Scope
EmbeddedAttemptSessionTakeoverErrorseen after message-tool activity during live proof exploration.Made with Cursor