Repository navigation
fix(runtime): reuse compatible Codex checkpoints across models - #6362
Conversation
Generated-by: Codex
jackwener
left a comment
There was a problem hiding this comment.
Finding
- [P2] Refresh the compatibility metadata before trusting it across models.
targetHashcomes from the persistedconnection.modelssnapshot, but execution applies no freshness rule to that snapshot: the Host keepsmodelsFetchedAtas internal bookkeeping and omits it fromRuntimeExecutionConnection, while production model discovery is triggered only from connection settings (after saving credentials or by the manual refresh button). A long-lived connection can therefore retain an oldcomp_hashindefinitely. If the provider changes the compaction hash for two model IDs, a checkpoint created afterward is still stamped with the old hash atopenai-codex-history-compactor.ts:147; switching to the other model then reaches this comparison with the same two stale values and replays opaque state that the current provider catalog no longer declares compatible. The ordinary turn path has no invalid-checkpoint fallback, so a provider rejection ends the turn. OpenAI Codex treats this as mutable model metadata and refreshes its model cache on a five-minute TTL (upstream source). Please refresh before the cross-model decision, or carry a bounded freshness proof into execution and fail closed to raw-history replay once it expires. Add a regression that starts with equal cached hashes, advances the provider catalog to changed hashes, and proves the stale snapshot cannot authorize cross-model replay.
Review result
I am not approving this head yet because the new compatibility gate can authorize replay from metadata that is older than the provider state it is meant to identify. The rest of the implementation is internally consistent: discovery, strict codec/persistence, checkpoint capture, same-connection matching, legacy same-model behavior, changed/missing hash rejection across models, and epoch 236 → 237 all follow the intended path.
This review is bound to exact head 24486dd17cb0dad05063c48db973e83ce4e12cd3 on base/current main 9dd44c199e5b53ab5a072dca256b2e4f2d60549f. The exact-head hosted test check passed. Locally, the affected Core/Storage tests passed 98/98 and the Runtime tests passed 355/355; the affected builds, changed-file Biome check, diff check, and protocol epoch guard also passed. The Host-focused run passed 42/43 initially because one existing hosted child-patch test exceeded its terminal wait under concurrent load; that test passed 1/1 when rerun alone. I also confirmed the upstream behavior that a missing hash is insufficient to infer a change, so preserving a legacy checkpoint on its original model is not this finding.
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
Generated-by: Codex
jackwener
left a comment
There was a problem hiding this comment.
Re-review result
No findings. The previous P2 is closed on exact head 94d9d414b739eda700df77dcf78c2e9ff34acef6.
The execution connection now carries the timestamp only when the Codex model catalog was actually fetched. Cross-model native-checkpoint replay and roll-forward require a matching comp_hash from metadata fetched less than five minutes ago; missing, malformed, expired, or future timestamps fail closed. A native checkpoint created after that freshness window is also stored without a compatibility hash, so it cannot later become a stale cross-model authorization. Same-model replay remains available, including for legacy checkpoints, which preserves the existing provider behavior without weakening the new cross-model boundary.
There is one important product limitation, but it is not a correctness blocker for this safety fix: Maka does not automatically refresh the Codex model catalog yet. Once the five-minute freshness window expires, cross-model native-checkpoint reuse is temporarily unavailable until the user refreshes the catalog. This is a safe fallback, but it does not yet match Codex's automatic-refresh experience.
I verified the production projection from the Runtime Host into backend creation, the shared replay and continuation gate, and the checkpoint-stamping path. The focused regressions cover timestamp projection, the exact five-minute boundary, future and missing timestamps, expired checkpoint creation, and the end-to-end backend path. A direct production-helper probe returned beforeExpiry=true, atExpiry=false, and changedFresh=false.
The exact head is based directly on current main (9dd44c199e5b53ab5a072dca256b2e4f2d60549f), so its tree is the current merge result. The affected package builds passed. Core and Storage tests passed 98/98; Runtime tests passed 458/458; the Host-focused run passed 73/74 under concurrent load because one existing real-model child-patch test exceeded its terminal wait, and that same test passed 1/1 when rerun alone. Changed-file Biome, git diff --check, and the protocol epoch guard (236 → 237) passed. The exact-head hosted test check also completed successfully.
This approval does not merge the pull request.
Review notice: This review was prepared by an automated review agent operated by jackwener and is published at the direction of me2seeks, who has read these findings and is the human accountable for them.
…lution (apache#6402) apache#6362 authorized cross-model Codex checkpoint reuse through freshCodexCompactionHash, gated on codexCompactionMetadataFetchedAt — but the host wired that timestamp from resolved.connection.modelsFetchedAt, which only the explicit connection.models.fetch / onboarding operations write. An ordinary session (no manual refresh within five minutes) resolved the execution target with a long-stale timestamp, so freshCodexCompactionHash returned undefined on every attempt: compactions could not stamp a hash (pinning checkpoints to same-model replay through the legacy branch) and the cross-model reuse the apache#6362 title promises was unreachable outside the five-minute post-refresh window. Stamp codexCompactionMetadataFetchedAt with the execution resolution time instead of passing the discovery timestamp through. The guards are unchanged (openai-codex connections with a fetched catalog snapshot only), so non-Codex connections and connections without a discovery run keep their previous shape; the manual refresh path itself is untouched. The freshness window now bounds the age of the compatibility claim per backend — the catalog the backend actually resolved — which is what the gate's own comment already promised ("bound the age of provider compatibility claims, including long-lived backends"). The existing coordinator assertion that pinned the timestamp equality with modelsFetchedAt is updated to the resolved-catalog semantics, and a new test drives a connection whose discovery ran a day ago through resolveExecutionTarget: under the old wiring the hash gate stays closed and cross-model replay is denied; with the stamp it authorizes. Fixes apache#6402 Generated-by: GLM-5.3-Flash (ZCode)
Summary
A ChatGPT subscription session currently drops its native compaction checkpoint when switching model IDs, reconstructing covered history even when the provider advertises compatible compaction state. Retain the provider's
comp_hashin model discovery and pin it to new checkpoints only when the fetched model catalog is at most five minutes old. Replay and roll forward across models only on the same connection when the target hash is fresh and matches. Missing, expired, future-dated, changed, and mismatched metadata fail closed to the existing effective-history path; legacy checkpoints remain reusable on their original model. The Host compatibility epoch advances because model discovery results gain a strictly decoded field.This is bounded reuse, not complete Codex refresh parity: model discovery remains user-initiated. Once the snapshot expires, cross-model reuse is unavailable until a fresh catalog is loaded; checkpoints created from stale metadata carry no compatibility hash. Automatic on-demand refresh remains future work.
Refs #6361
Verification
git diff --checkpassed.gpt-6.1-solcompaction item was replayed bygpt-6-luna, then compacted again bygpt-6-luna; both synthetic facts survived. Also checkedgpt-6-lunatogpt-6-sol. These probes validate the tested model pairs, not universal provider compatibility.AI use
Tool(s) and scope: Codex investigated the provider and repository, implemented and reviewed the change, and ran verification.
Checklist
Does this PR entail a change in behavior?