Task · CXO-0036

Bound the cross-response correlation index globally, not only per thread

Description

CXO-0028 froze the correlation index at 512 entries per thread and 24 hours of archive-clock age, but the number of threads is unbounded: every thread that ever records a tool call keeps a map entry until its entries age out, and the whole index is persisted in every checkpoint write. A burst of short-lived threads grows the checkpoint and the resident set without limit until 24 hours pass. CodeRabbit raised this in the wave 2 review and it was deferred because it changes the frozen D13 contract. The index lives in internal/turn/correlate.go and is persisted by internal/turn/state.go at stateVersion 5.

Acceptance Criteria

Definition of Done

Implementation Plan

Wave 3: execute the frozen lane ownership and decisions in codex/goal-2026-09-06-wave3.md. Root commits wave 0 before dispatch; L2/L7 depend on L1 and the recorded D15 verdict. Integrate, run the rewritten corpus gate once after wiring, review, push once, verify Watchtower and m7kni, then reconcile acceptance and resume boundaries.

Implementation Notes

Wave3 final source 3bc28996c78c3533ae30f370f01a247aa6dea3ac. One git push was rejected (fetch first); zero successful pushes. Remote advanced by Renovate at10:16:57Z. No second attempt under the one-push contract. Implemented cap4096 with oldest-newest/lexical eviction, active expiry, archive-minute inactive sweeps and immediate capacity enforcement. Synthetic10000-thread checkpoint bound4MiB and v6/v5-empty-index compatibility tests pass. Final just check exit0; CodeRabbit2 complete0findings. Source acceptance complete; deployment remains deferred by rejected push.

Final Summary

Source 3bc28996c78c3533ae30f370f01a247aa6dea3ac; no pushed SHA. Implemented cap4096 with oldest-newest/lexical eviction, active expiry, archive-minute inactive sweeps and immediate capacity enforcement. Synthetic10000-thread checkpoint bound4MiB and v6/v5-empty-index compatibility tests pass. Final just check exit0; CodeRabbit2 complete0findings. Source acceptance complete; deployment remains deferred by rejected push.

View the source file on GitHub