Skip to content

bug(runtime): cross-model Codex checkpoint reuse is unreachable — the freshness timestamp only updates on a manual model refresh #6402

Open

Description

@ggbdpq

What happened

#6362's cross-model Codex checkpoint reuse authorizes a checkpoint by comparing the connection's codexCompactionHash — but that hash only exists when codexCompactionMetadataFetchedAt is fresh (5-minute window), and that timestamp is only written by the explicit connection.models.fetch / onboarding operation. Backend creation, session start, and every turn send leave it untouched.

Consequence: in an ordinary session (never manually refreshed), freshCodexCompactionHash always returns undefined, so cross-model reuse never triggers and — worse — a compaction that happened outside the window cannot stamp a hash, which permanently pins that checkpoint to same-model-only via the legacy branch (a later directory refresh cannot rescue it; history-compact-checkpoint.ts requires the hash to have been stamped). The feature the #6362 title promises ("reuse compatible Codex checkpoints across models") is unreachable in normal sessions; the new tests pin this behavior as intended, which is why it slipped through.

Direction is conservative (never produces a wrong prefix), but the promised capability is effectively dead code outside the 5-minute post-refresh window.

Deterministic reproduction

In a session whose connection has never had an explicit connection.models.fetch in the last 5 minutes, run a compaction and switch Codex models: on main no checkpoint is ever authorized for cross-model reuse (freshCodexCompactionHash returns undefined in every attempt). The fix PR pins the refreshed-on-activation semantics with a test.

Root cause

codexCompactionMetadataFetchedAt is wired only from resolved.connection.modelsFetchedAt, which only the explicit fetch operation writes.

Suggested fix

Refresh the metadata timestamp when a Codex backend is created or a session is activated on it (the host-side wiring point that already receives the model catalog), so the freshness window reflects "the catalog this connection is actually using" rather than "the last time the user clicked refresh".

Source

Found by an AI-assisted read-only audit (GLM-5.3-Flash via ZCode) over main@112883c85 while auditing #6362; the gate, the wiring point, and the uncapped sibling walk were re-verified line by line before filing.

Activity

  1. ggbdpq commented on Oct 27, 2026

    @ggbdpq
    ContributorAuthor

    take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions