fix(web-search): recover OpenRouter Perplexity citations from message annotations#40881
Merged
obviyus merged 2 commits intoopenclaw:mainfrom Mar 10, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR fixes a bug where Changes made:
Safety: Change is fully backward-compatible — no request-path, routing, or payload changes. Confidence Score: 5/5
Last reviewed commit: a6fc929 |
Contributor
Author
|
cc @obviyus for visibility — this is a small backward-compatible fix for the Perplexity/OpenRouter citation fallback path. |
a6fc929 to
66c8bb2
Compare
Contributor
|
Merged via squash.
Thanks @laurieluo! |
frankekn
pushed a commit
to urianpaul94/openclaw
that referenced
this pull request
Mar 10, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
BunsDev
pushed a commit
to rixau/openclaw
that referenced
this pull request
Mar 10, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
mukhtharcm
pushed a commit
to hnykda/openclaw
that referenced
this pull request
Mar 10, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
mrosmarin
added a commit
to mrosmarin/openclaw
that referenced
this pull request
Mar 10, 2026
* main: (43 commits) docs: add openclaw#42173 to CHANGELOG — strip leaked model control tokens (openclaw#42216) Agents: align onPayload callback and OAuth imports docs: add Tengji (George) Zhang to maintainer table (openclaw#42190) fix: strip leaked model control tokens from user-facing text (openclaw#42173) Changelog: add unreleased March 9 entries chore: add .dev-state to .gitignore (openclaw#41848) fix(agents): avoid duplicate same-provider cooldown probes in fallback runs (openclaw#41711) fix(mattermost): preserve markdown formatting and native tables (openclaw#18655) feat(acp): add resumeSessionId to sessions_spawn for ACP session resume (openclaw#41847) ACPX: bump bundled acpx to 0.1.16 (openclaw#41975) mattermost: fix DM media upload for unprefixed user IDs (openclaw#29925) fix(msteams): use General channel conversation ID as team key for Bot Framework compatibility (openclaw#41838) fix(mattermost): read replyTo param in plugin handleAction send (openclaw#41176) fix(sandbox): pass real workspace to sessions_spawn when workspaceAccess is ro (openclaw#40757) fix(ui): replace Manual RPC text input with sorted method dropdown (openclaw#14967) CI: select Swift 6.2 toolchain for CodeQL (openclaw#41787) fix(agents): forward memory flush write path (openclaw#41761) fix(telegram): move network fallback to resolver-scoped dispatchers (openclaw#40740) fix(security): harden replaceMarkers() to catch space/underscore boundary marker variants (openclaw#35983) fix(web-search): recover OpenRouter Perplexity citations from message annotations (openclaw#40881) ...
aiwatching
pushed a commit
to aiwatching/openclaw
that referenced
this pull request
Mar 10, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
Moshiii
pushed a commit
to Moshiii/openclaw
that referenced
this pull request
Mar 11, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
Moshiii
pushed a commit
to Moshiii/openclaw
that referenced
this pull request
Mar 11, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
dominicnunez
pushed a commit
to dominicnunez/openclaw
that referenced
this pull request
Mar 11, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
dhoman
pushed a commit
to dhoman/chrono-claw
that referenced
this pull request
Mar 11, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
Ruijie-Ysp
pushed a commit
to Ruijie-Ysp/clawdbot
that referenced
this pull request
Mar 12, 2026
… annotations (openclaw#40881) Merged via squash. Prepared head SHA: 66c8bb2 Co-authored-by: laurieluo <89195476+laurieluo@users.noreply.github.com> Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com> Reviewed-by: @obviyus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a compatibility issue in web-search on the Perplexity chat-completions compatibility path (OpenRouter), where citations could be lost when responses provide URL citations under choices[*].message.annotations instead of top-level citations.
runPerplexitySearchonly readdata.citations.citationsin tool output when using OpenRouter.message.annotations.extractPerplexityCitations(...):citations.choices[*].message.annotations[*].url_citation.url.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
web_searchwith Perplexity OpenRouter-compatible responses now returns citations when sources are provided viamessage.annotations(fallback path), instead of returning emptycitations.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
tools.web.search.provider=perplexity, OpenRouter key configuredSteps
web_searchwith Perplexity/OpenRouterchat_completionspath.choices[*].message.annotations.citations.Expected
citationsshould include URLs from annotations (deduplicated) when top-level citations are absent.Actual
citationscorrectly populated from annotations fallback.Evidence
Attach at least one:
Runtime before (same query/provider/model)
{ "query": "Iran latest situation today March 2026 nuclear talks military tensions sanctions", "provider": "perplexity", "model": "perplexity/sonar", "externalContent": { "untrusted": true, "source": "web_search", "provider": "perplexity", "wrapped": true }, "content": "<omitted>", "citations": [] }Runtime after (same query/provider/model)
{ "query": "Iran latest situation today March 2026 nuclear talks military tensions sanctions", "provider": "perplexity", "model": "perplexity/sonar", "externalContent": { "untrusted": true, "source": "web_search", "provider": "perplexity", "wrapped": true }, "content": "<omitted>", "citations": [ "https://timesofindia.indiatimes.com/videos/international/explosions-shake-tel-aviv-as-iran-launches-khorramshahr-fattah-missiles-in-new-barrage/videoshow/129306402.cms", "https://www.democracynow.org/2026/3/5/iran_state_defense", "https://www.foxnews.com/video/6390605040112", "https://www.euronews.com/video/2026/03/03/europe-today-iran-war-intensifies-as-trump-signals-prolonged-fight", "https://globalnews.ca/video/11712842/middle-east-analyst-on-u-s-military-action-in-iran" ] }Test evidence
falls back to message annotations when top-level citations are missing
Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/agents/tools/web-search.tssrc/agents/tools/web-tools.enabled-defaults.test.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.