Skip to content

fix(embeddings): preserve recipe snapshot in status reads (#3951) - #3951

Merged
Sinity merged 2 commits into
masterfrom
feature/fix/suite-embedding-consistency
Aug 11, 2026
Merged

fix(embeddings): preserve recipe snapshot in status reads (#3951)#3951
Sinity merged 2 commits into
masterfrom
feature/fix/suite-embedding-consistency

Conversation

@Sinity

@Sinity Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Archive embedding status now evaluates exact session counts with the same resolved recipe the payload reports. The regression test covers the public payload route across a genuine split archive.

Problem

_archive_embedding_status_payload() resolved the configured model for its payload but delegated exact state counting to a helper that could reload ambient configuration. A model change could therefore let the status payload describe one recipe while classifying completed and terminal rows with another.

Solution

polylogue/storage/embeddings/status_payload.py resolves one EmbeddingRecipe through the existing duck-typed configuration seam and passes it to the exact archive-state read. tests/unit/storage/test_embedding_freshness_invariant.py materializes an archive under voyage-4, resolves status under voyage-5, and requires the status payload to report that session pending. The contracts fixture also uses the current voyage-4-lite default while explicit recipe-change coverage remains on voyage-4 and voyage-5.

Verification

  • direnv exec . devtools test tests/unit/storage/test_embedding_contracts.py tests/unit/storage/test_embedding_freshness_invariant.py -> 64 passed
  • direnv exec . devtools verify --quick -> successful, including ruff, mypy, generated renders, layering, and policy checks
  • The pre-push hook reran devtools verify --quick at 5d58a78b7 successfully before publication.

Anti-vacuity: the regression does not mock count_archive_embedding_session_state; it uses embedding_status_payload with an actual index.db plus sibling embeddings.db, so omitting the recipe argument restores ambient voyage-4 classification and fails the required pending count.

Bead disposition

Self-contained scope. No Beads were assigned or mutated.

Summary by CodeRabbit

  • Bug Fixes
    • Embedding status counts now accurately reflect the configured model and dimensions.
    • Session freshness and pending-embedding results remain correct when embedding configurations change.
    • Updated embedding validation to use the current Voyage-4 Lite model baseline.

Sinity and others added 2 commits August 11, 2026 19:12
Problem: exact status counts reloaded ambient configuration, so they could evaluate completed and terminal rows with a different recipe than the payload.\n\nWhat changed: pass the resolved EmbeddingRecipe through the exact-state read and align non-drift fixtures with the current default while preserving explicit recipe-change coverage.\n\nVerification: ran the focused embedding freshness, contracts, readiness, and CLI status selections with one pytest worker.\n\nCo-authored-by: Codex <noreply@openai.com>
Problem: archive status counts can disagree with the configured recipe when
an exact read falls back to ambient configuration.

What changed: retain the duck-typed config seam while resolving the recipe,
and prove the public status payload reports vectors as pending after a model
change.

Verification: direnv exec . devtools test
 tests/unit/storage/test_embedding_contracts.py
 tests/unit/storage/test_embedding_freshness_invariant.py
and direnv exec . devtools verify --quick.

Co-authored-by: Codex <noreply@openai.com>
@Sinity Sinity changed the title fix(embeddings): preserve recipe snapshot in status reads fix(embeddings): preserve recipe snapshot in status reads (#3951) Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e78e6484-a14b-4832-ad24-19ce95c0adf5

📥 Commits

Reviewing files that changed from the base of the PR and between c27af7d and 5d58a78.

📒 Files selected for processing (3)
  • polylogue/storage/embeddings/status_payload.py
  • tests/unit/storage/test_embedding_contracts.py
  • tests/unit/storage/test_embedding_freshness_invariant.py

📝 Walkthrough

Walkthrough

The status payload now resolves the configured embedding recipe and applies it when counting archive session states. Tests cover model alignment and freshness invalidation after a configuration change.

Changes

Embedding status freshness

Layer / File(s) Summary
Resolve recipe and filter archive counts
polylogue/storage/embeddings/status_payload.py
The status payload constructs an EmbeddingRecipe from the configured model and dimensions. Archive session-state counts now use that recipe.
Validate recipe freshness behavior
tests/unit/storage/test_embedding_contracts.py, tests/unit/storage/test_embedding_freshness_invariant.py
Tests use voyage-4-lite and verify that sessions materialized with Voyage-4 become pending when Voyage-5 is configured.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the embedding status fix and the preservation of the recipe snapshot.
Description check ✅ Passed The description covers the change, problem, solution, verification, and self-contained scope, with only minor deviation from the matrix format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/suite-embedding-consistency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity

Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 5d58a78b7c

ℹ️ 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".

@Sinity
Sinity merged commit 8b69a6b into master Aug 11, 2026
2 checks passed
@Sinity
Sinity deleted the feature/fix/suite-embedding-consistency branch August 11, 2026 17:42
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.

1 participant