fix: roll back unauthorized Global Ask turns (v2.20.3) - #374
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
| answer_evidence = await read_authorized_ask_evidence( | ||
| conn, | ||
| cited_post_ids=cited_ids, | ||
| corporate_entity_ids=account.corporate_entity_ids, | ||
| knowledge_cutoff=knowledge_cutoff, | ||
| ) |
There was a problem hiding this comment.
📝 Info: Reauthorization read now runs inside the write transaction
The final read_authorized_ask_evidence executes inside the API-owned conn.transaction() while the session row is held under for update (post_chat_ingestion.py). It is read-only and under READ COMMITTED still observes concurrently committed visibility changes, so the race check is preserved; the session lock is just held marginally longer.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Reviewed exact current head Exact-head validation:
No current bug/security review finding requires a patch. Please obtain formal approval and terminal-success Checks for |
79c40bc
into
feat/ask-session-storage-key-v2202
) This integration branch diverged from the line that originally shipped #399/#374 before either landed, so it never picked up the fix: a cited post whose authorization changed between source selection and commit (visibility flip, corporate-entity move, etc.) would have its facts served in the Global Ask answer and its citation row persisted even though the request had no business seeing it anymore. Restored _ensure_citations_visible (row-share-locked re-check inside persist_turn's own transaction) and GlobalAskEvidenceChanged -> 503 wiring in ask_agent, byte-identical to the already-reviewed #399 fix. Added a regression test that forces the race from inside the fake chat client and confirmed it fails on the pre-fix code (leaks the revoked post's facts with a 200) before passing on the restored fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011EP69xAyLaJxa6oaF6D9eq
Buyer impact
A Global Ask answer that loses citation authorization during the final check must not poison the existing session. This stacked PR keeps the generic 503 boundary, rolls back only the rejected turn/citations, and lets the same session continue safely.
Change
/api/askcited-answer path.Exact stack
feat/ask-session-storage-key-v2202at0a5a5799b444c44dc2952edc7227b1b96b97457e.f6ce19f8e10aa7ec2b0a95f3adbbea816bd39594.Verification
git diff --check: passed.Hosted Checks, independent approval, and merge remain external gates. Do not self-approve, force-push, or merge past protection.