Skip to content

Fix: An additional retrieval node has appeared in the agent created using the CAJAL Scientific Paper Assistant template. - #21079

Merged
wangq8 merged 3 commits into
infiniflow:mainfrom
cike8899:fix-agent-template
Oct 16, 2026
Merged

wangq8 merged 3 commits into
infiniflow:mainfrom
cike8899:fix-agent-template

Conversation

@cike8899

Copy link
Copy Markdown
Contributor

Summary

Fix: An additional retrieval node has appeared in the agent created using the CAJAL Scientific Paper Assistant template.

@cike8899
cike8899 requested a review from wangq8 October 16, 2026 09:40
@cike8899 cike8899 added the ci Continue Integration label Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5e60d408-b682-4526-823a-813e011ea295
📥 Commits

Reviewing files that changed from the base of the PR and between 54cb269 and 6ef7de6.

📒 Files selected for processing: 9
  • internal/agent/templates/cajal_scientific_paper_agent.json
  • web/src/components/next-markdown-content/__tests__/index.test.tsx
  • web/src/components/next-markdown-content/index.tsx
  • web/src/components/next-message-item/reference-image-list.tsx
  • web/src/pages/agent/hooks/use-add-node.test.tsx
  • web/src/pages/agent/hooks/use-add-node.ts
  • web/src/utils/__tests__/citation-utils.test.ts
  • web/src/utils/chat.ts
  • web/src/utils/citation-utils.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The change updates citation lookup and rendering, adjusts tool-node addition to read current graph state, and adds a Tool node and edge to the CAJAL template graph.

Changes: Citation Resolution

Layer / File(s) Summary
Shared citation lookup
web/src/utils/citation-utils.ts, web/src/utils/chat.ts, web/src/utils/__tests__/citation-utils.test.ts
A shared resolver selects chunks by numeric index or matching id or chunk_id. The chat utility exports the resolver and CitationKey type. Tests cover parsing, lookup, and display numbering.
Citation rendering and reference lookup
web/src/components/next-markdown-content/index.tsx, web/src/components/next-markdown-content/__tests__/index.test.tsx, web/src/components/next-message-item/reference-image-list.tsx
Markdown citations resolve chunks from marker keys while retaining first-occurrence display numbering. Unresolved markers remain literal text after loading, and citation popovers render only when a chunk resolves. Reference image lookup delegates to the shared resolver.

Tool Node Addition

Layer / File(s) Summary
Current graph state guard
web/src/pages/agent/hooks/use-add-node.ts, web/src/pages/agent/hooks/use-add-node.test.tsx
The tool-node callback reads current nodes and edges from the graph store when called. A test checks that two calls add one tool node and one edge.

CAJAL Template Tool Node

Layer / File(s) Summary
Template graph Tool node
internal/agent/templates/cajal_scientific_paper_agent.json
The graph adds an edge from the agent’s tool output to a Tool node named flow.tool_0, with placeholder description and user-prompt form values.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant MarkdownContent
  participant resolveCitationChunk
  participant ReferenceChunks
  MarkdownContent->>resolveCitationChunk: Pass citation key and chunks
  resolveCitationChunk->>ReferenceChunks: Select by index or matching chunk ID
  ReferenceChunks-->>resolveCitationChunk: Return matching chunk or no match
  resolveCitationChunk-->>MarkdownContent: Return resolved chunk
  MarkdownContent->>MarkdownContent: Render popover only when a chunk resolves
Loading

Suggested reviewers: jinhai-cn

Merge Risk: ⚪ Minimal · up to 6ef7d

No merge-blocking issue was identified in the supplied changes. Normal checks remain appropriate before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description includes the required Summary heading and identifies the intended fix, but it does not provide the requested background context or explain the changes and validation. Expand the Summary with the problem context, the cause of the extra node, the implemented fix, the citation-rendering changes included in the PR, and the tests or validation performed.
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 8 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary fix: preventing an additional retrieval node in agents created from the CAJAL Scientific Paper Assistant template.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 8 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks each marker’s trail,
By index or ID, finds the tale.
The graph gains a tool in its place,
Two calls leave one node to trace.
The rabbit hops through tests with glee.

Comment @coderabbitai help to get the list of available commands.

@wangq8
wangq8 merged commit fb015ec into infiniflow:main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants