add claude citations HUD-985#365
Conversation
0c5d261 to
80707e1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80707e139b
ℹ️ 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".
| source = cit.get("source") or cit.get("document") or "" | ||
| if not source: | ||
| return None |
There was a problem hiding this comment.
Accept Claude citation source aliases during recovery
_normalize_citation currently derives source only from source/document and then rejects falsy values, so recovered JSON citations that use Claude-style keys like document_index or document_title (or numeric source: 0) are discarded as invalid. In citations-required scenarios this causes _recover_citations_from_content to fail and leaves response.citations empty even when the model did provide citation data in the payload.
Useful? React with 👍 / 👎.
Note
Medium Risk
Changes model response parsing and scenario prompt metadata to thread citation enablement and citation payloads end-to-end, which can affect final answer shape and remote scenario behavior. Risk is moderate due to added parsing/fallback logic around JSON content and metadata transport differences.
Overview
Adds end-to-end citation support for Claude and scenario-driven runs.
Claude responses now normalize and emit inline citations from text blocks, and tool results can be wrapped as sibling citable document blocks (including PDFs) when
scenario_enable_citationsis set. The base agent loop also attempts to recover missing citations by parsing a JSON (or fenced ```json) final answer payload and normalizing citation fields.Remote scenario setup now propagates
enable_citationsvia prompt metadata (_meta) and becomes more robust to transports that place metadata under_metaor__pydantic_extra__; chat history export now includes assistantcitationswhen present, with new tests covering these paths.Written by Cursor Bugbot for commit cbd5a0f. This will update automatically on new commits. Configure here.