Skip to content

fix(cache): recover invalidation after failed prime - #1544

Merged
Soju06 merged 1 commit into
Soju06:mainfrom
mastertyko:fix/cache-invalidation-prime-recovery
Aug 4, 2026
Merged

fix(cache): recover invalidation after failed prime#1544
Soju06 merged 1 commit into
Soju06:mainfrom
mastertyko:fix/cache-invalidation-prime-recovery

Conversation

@mastertyko

Copy link
Copy Markdown
Contributor

Summary

Recover cache-invalidation delivery after a transient startup baseline-prime
failure, so the first successful background poll cannot acknowledge a peer
version without invalidating already-warm routing state.

The root cause was that an uninitialized poller treated its first successful
background read as a callback-less baseline. start() now ends baseline-only
acquisition before spawning the poll task, while an explicit prime() retry
before start() remains baseline-only.

Type of change

  • fix: — bug fix (no behavior change beyond the bug)
  • feat: — new user-facing feature or capability
  • refactor: — internal refactor (no behavior change, no API change)
  • docs: — documentation only
  • chore: / ci: / build: — tooling, CI, packaging
  • test: — test-only change
  • Breaking change

Linked issue: None — no matching upstream issue was found in the bounded related-work search.

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable — bug fix that matches the existing spec
  • Not applicable — docs / CI / chore only
  • This PR touches a codex-faithful path and preserves upstream-equivalent behavior

Change directory:
openspec/changes/recover-cache-invalidation-after-prime-failure/

Changes

  • Arm conservative callback delivery synchronously when background polling
    starts without a recorded version baseline.
  • Preserve callback-less semantics for an explicit prime() retry before
    background polling.
  • Add regressions for callback acknowledgement, a real warm upstream-route
    cache, account-routing refresh, and HTTP bridge-session reuse.
  • Update the query-caching and model-catalog-compat OpenSpec contracts.

Test plan

PYTHONPATH=. pytest \
  tests/unit/test_cache_invalidation_poller.py \
  tests/integration/test_cache_invalidation_bus.py \
  tests/integration/test_upstream_route_cache_invalidation.py \
  tests/integration/test_model_registry_replication.py \
  tests/integration/test_multi_replica.py -q -x
# 74 passed

ruff check <touched Python files>
ruff format --check <touched Python files>
ty check --python .venv <touched Python files>

openspec validate recover-cache-invalidation-after-prime-failure --strict
openspec validate --specs --strict
# 48 main specs passed

The full repository-wide pre-commit local-ci gate was intentionally not run
locally; the focused Sensitive routing/cache suite, scoped lint/format/type
checks, strict OpenSpec validation, and independent diff review were completed.
Repository CI remains the authoritative integration gate.

Screenshots / output

Not applicable. This changes backend poller lifecycle behavior and has no
dashboard-visible surface; the real routing-cache and bridge-reuse seams are
covered by integration tests.

Checklist

  • Title is in Conventional Commits format (<type>(<scope>)?: <subject>).
  • Linked the related issue where applicable; no matching issue was found.
  • Added or updated tests covering the change.
  • Ran the relevant focused local test/lint/type subset.
  • If touching specs: strict OpenSpec validation and verification are clean.
  • Simplicity gates reviewed: no settings, setup steps, README sections,
    environment examples, dashboard navigation, or UI defaults are added.
  • CHANGELOG is not edited by hand.

@mastertyko
mastertyko marked this pull request as ready for review July 30, 2026 11:08
@mastertyko

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 39283463e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Komzpa Komzpa added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels Jul 30, 2026
@Soju06
Soju06 merged commit ba5a283 into Soju06:main Aug 4, 2026
67 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants