[bug] crystallize crashes on retry after partial approval - #140
[bug] crystallize crashes on retry after partial approval#140glorysr1209-png wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 59 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes a crash in session crystallization when retrying after partial approval. It extracts approved claim IDs from proposals using a new helper, derives the summary page from those claims instead of artifact IDs, and implements page upsert logic to conditionally overwrite or create the page. A new test validates retry behavior after transient approval failure. ChangesSession Crystallize Summary Page Upsert
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/vouch/sessions.py (1)
106-116: ⚡ Quick winReduce coupling to storage internals in the upsert path.
This block re-implements
KBStore.put_page's persistence (serialize +_embed_and_store) by reaching into private members, and independently hardcodes the on-disk claim path on Line 108. Two concerns:
- The hardcoded
claims/{cid}.yamlduplicatesstore._claim_path(cid)used byput_page. If that layout ever changes, the existence check silently filters all claims out, producing a summary page with an emptyclaimslist rather than failing — a silent data-quality regression.- The overwrite branch duplicates
put_page's serialize+embed flow, so future changes there (e.g. added validation) won't apply on retry. AKBStore.upsert_page(page)(orput_page(page, overwrite=True)) would keep create/update paths in lockstep. As a side note, constructing a freshPageon each overwrite also resetscreated_at; an upsert method could preserve it.♻️ Minimal in-file fix for the claim-path duplication
claims=[ - cid for cid in session_claim_ids - if (store.kb_dir / "claims" / f"{cid}.yaml").exists() + cid for cid in session_claim_ids + if store._claim_path(cid).exists() ],Encapsulating the overwrite-vs-create branch behind a
KBStoremethod would require a change insrc/vouch/storage.py.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/vouch/sessions.py` around lines 106 - 116, The upsert flow in sessions.py duplicates KBStore internals and hardcodes claim paths; replace the manual claim existence check and serialize/embed logic with a single KBStore method to avoid drift: add a new KBStore.upsert_page(page, overwrite=True) (or extend KBStore.put_page to accept overwrite flag) that internally uses store._claim_path(...) and preserves created_at, performs serialization and calls store._embed_and_store(...) as needed, then call that new method from sessions.py instead of inspecting store._page_path, writing the file, or checking claims directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/vouch/sessions.py`:
- Around line 106-116: The upsert flow in sessions.py duplicates KBStore
internals and hardcodes claim paths; replace the manual claim existence check
and serialize/embed logic with a single KBStore method to avoid drift: add a new
KBStore.upsert_page(page, overwrite=True) (or extend KBStore.put_page to accept
overwrite flag) that internally uses store._claim_path(...) and preserves
created_at, performs serialization and calls store._embed_and_store(...) as
needed, then call that new method from sessions.py instead of inspecting
store._page_path, writing the file, or checking claims directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 66b4e057-2177-4f8e-ba11-04d73710dccf
📒 Files selected for processing (2)
src/vouch/sessions.pytests/test_sessions.py
Delegate crystallize retry persistence to a store helper and use _claim_path for claim existence checks instead of hardcoded paths. Co-authored-by: Cursor <cursoragent@cursor.com>
|
the one thing worth double-checking: non-blocking: small process note: no thanks for tracking down the retry crash end-to-end and writing the flaky-approve test to nail it 🙏 |
Summary
Closes #139.
Upsert the session summary page on crystallize retry and rebuild claims from all approved session proposals.
Changes
test_crystallize_retry_after_partial_approval_updates_summary_page.Test plan
pytest tests/test_sessions.py -k crystallize_retrySummary by CodeRabbit