Skip to content

add claude citations HUD-985#365

Merged
lorenss-m merged 2 commits into
l/api-docsfrom
feat/add-claude-citations
Mar 11, 2026
Merged

add claude citations HUD-985#365
lorenss-m merged 2 commits into
l/api-docsfrom
feat/add-claude-citations

Conversation

@ryantzr1
Copy link
Copy Markdown
Contributor

@ryantzr1 ryantzr1 commented Mar 11, 2026

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_citations is 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_citations via prompt metadata (_meta) and becomes more robust to transports that place metadata under _meta or __pydantic_extra__; chat history export now includes assistant citations when present, with new tests covering these paths.

Written by Cursor Bugbot for commit cbd5a0f. This will update automatically on new commits. Configure here.

@ryantzr1 ryantzr1 force-pushed the feat/add-claude-citations branch from 0c5d261 to 80707e1 Compare March 11, 2026 08:11
@ryantzr1 ryantzr1 marked this pull request as ready for review March 11, 2026 08:14
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread hud/agents/claude.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread hud/agents/base.py Outdated
Comment on lines +681 to +683
source = cit.get("source") or cit.get("document") or ""
if not source:
return None
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@ryantzr1 ryantzr1 changed the title add claude citations add claude citations HUD-985 Mar 11, 2026
@lorenss-m lorenss-m merged commit 184b9c6 into l/api-docs Mar 11, 2026
2 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.

2 participants