[codex] isolate heartbeat context-engine session keys#84248
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. at source level: current main mints a fresh isolated heartbeat session id but passes the stable 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 detailsBest possible solution: Land the identity split after redacted lifecycle/compaction proof shows a real context engine receiving the fresh key and the remaining CI finishes cleanly. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main mints a fresh isolated heartbeat session id but passes the stable Is this the best way to solve the issue? Yes for the code direction: a context-engine-only key is the narrow fix that preserves stable routing while isolating context state. It is not merge-ready until proof covers the changed lifecycle/compaction path and remaining CI completes. Label changes:
Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a002c416c7af. |
dfc8c99 to
882d88b
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
Summary
:heartbeatrouting key everywhere, so context-engine lifecycle hooks could still associate later ticks with prior heartbeat state.SessionKey, but forward a fresh per-tickcontextEngineSessionKeyonly through context-engine bootstrap, assemble, ingest, and compaction paths.:heartbeat-run:<sessionId>keys for context-engine state, and the embedded runner/auto-reply flow threads that override through lifecycle and recovery paths with regression coverage.:heartbeatkey, and non-heartbeat runs still default to the existingsessionKeybehavior.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Motivation
Real behavior proof (required for external PRs)
Behavior addressed:
isolatedSession=trueheartbeat runs should keep the stable deliverySessionKeywhile using a fresh context-engine-only session identity on each isolated tick.Real environment tested: Local OpenClaw source checkout in a Codex worktree, using a temporary workspace and session store, with the production
runHeartbeatOnce()path invoked twice underisolatedSession=trueandheartbeat.target=noneto avoid outbound delivery.Exact steps or command run after this patch:
Evidence after fix (console output):
Observed result after fix: Both isolated runs used the stable routing key
agent:main:main:heartbeat, while the context-engine-only key changed between runs, proving the heartbeat tick kept stable delivery routing without reusing the prior tick's context-engine identity.What was not tested: Live gateway/channel delivery, end-to-end overflow looping against a real provider, and non-PI harnesses.
Root Cause (if applicable)
runHeartbeatOnce()created a fresh isolated session id, but still passed the stable<base>:heartbeatkey into the auto-reply and embedded-runner context-engine lifecycle, so any context engine keyed bysessionKeycould replay earlier heartbeat state.:heartbeatkey convergence and did not assert a separate fresh identity for context-engine lifecycle/compaction paths.afterTurn, ingest, and compaction maintenance paths.Regression Test Plan (if applicable)
src/infra/heartbeat-runner.isolated-key-stability.test.tssrc/agents/pi-embedded-runner/run/attempt.spawn-workspace.context-engine.test.tssrc/agents/pi-embedded-runner/tool-result-context-guard.test.tssrc/agents/pi-embedded-runner/run.overflow-compaction.test.tssrc/auto-reply/reply/agent-runner-execution.test.ts:heartbeatrouting convergence only.User-visible / Behavior Changes
isolatedSession=truenow honor the documented fresh-session contract for context-engine state while keeping the existing stable heartbeat routing key.Diagram (if applicable)
N/A.
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
node scripts/run-vitest.mjsSteps
Expected
<base>:heartbeat, but context-engine lifecycle/compaction paths do not reuse prior heartbeat state.Actual
contextEngineSessionKeyvalues across isolated ticks and stable outbound routing keys.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
:heartbeatrouting key; non-heartbeat paths still default to the existingsessionKeycontract.Review Conversations