Skip to content

fix: support keenable component - #16884

Merged
yuzhichang merged 5 commits into
infiniflow:mainfrom
Haruko386:main
Jul 14, 2026
Merged

yuzhichang merged 5 commits into
infiniflow:mainfrom
Haruko386:main

Conversation

@Haruko386

Copy link
Copy Markdown
Member

Summary

As title

image

@Haruko386 Haruko386 added 🐞 bug Something isn't working, pull request that fix bug. dependencies Pull requests that update a dependency file ci Continue Integration labels Jul 14, 2026
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 14, 2026
@Haruko386
Haruko386 marked this pull request as draft July 14, 2026 01:56
@Haruko386
Haruko386 marked this pull request as ready for review July 14, 2026 01:56
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b13ae8ad-66e7-4a7b-8ed7-5efe2fa2db9c

📥 Commits

Reviewing files that changed from the base of the PR and between 33f3104 and b62cd04.

📒 Files selected for processing (1)
  • internal/service/agent.go
💤 Files with no reviewable changes (1)
  • internal/service/agent.go

📝 Walkthrough

Walkthrough

KeenableSearch is integrated as a canvas component with retrieval-reference storage and rendered outputs. Runtime state now exposes normalized references, and agent SSE/session payloads use the structured reference format. Message inputs and event schemas accept broader content and reference values.

Changes

Retrieval reference integration

Layer / File(s) Summary
Message input and event contracts
internal/agent/canvas/runner.go, internal/agent/component/message.go, internal/agent/component/message_test.go
Message content extraction supports runtime content inputs, while message event references accept arbitrary JSON-compatible values.
KeenableSearch component flow
internal/agent/tool/keenable.go, internal/agent/component/universe_a_wrappers.go, internal/agent/component/fixture_stubs.go, internal/agent/component/keenable_component_test.go, internal/agent/tool/keenable_test.go
Adds KeenableSearch input metadata, registration, invocation adaptation, retrieval-reference construction, rendered outputs, and tests.
Runtime retrieval payload
internal/agent/runtime/state.go, internal/agent/runtime/state_test.go
Adds deterministic retrieval-reference copying for chunks and document aggregates, including the computed total.
Agent reference emission and persistence
internal/service/agent.go
Agent runs select state-backed references or legacy chunks, then emit and persist the structured reference payload.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant KeenableSearchComponent
  participant CanvasState
  participant AgentRun
  participant SSEAndSession
  KeenableSearchComponent->>CanvasState: Store retrieval chunks and doc_aggs
  AgentRun->>CanvasState: Get retrieval reference
  CanvasState-->>AgentRun: Return chunks, doc_aggs, total
  AgentRun->>SSEAndSession: Emit and persist structured reference
Loading

Suggested reviewers: yuzhichang

Poem

I’m a rabbit with references bright,
Keenable hops into search tonight.
Chunks and docs line up in a row,
While message streams neatly flow.
Thump, thump—the payloads are just right!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is too generic and only says "As title" without the required summary or background. Add a brief Summary describing what the PR changes, why it was needed, and any relevant background context.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding support for the Keenable component.
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.

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/agent/component/universe_a_wrappers.go (1)

713-772: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Missing title/url render as the literal string "None" in user-facing output.

keenableValueString returns the string "None" for nil fields, and both buildKeenableReferences (docnm_kwd/document_name/url) and renderKeenableReferences (the "Title:"/"URL:" lines fed to the LLM and shown in the chat sidebar per the PR's reference-card UI) bake that literal in directly. The content-skip check (content == "" || content == "None") also silently depends on this sentinel string rather than checking m["description"] == nil directly, coupling two unrelated functions through a magic string.

🩹 Proposed fix
-		content := truncateRunes(strings.TrimSpace(keenableValueString(m["description"])), 10000)
-		if content == "" || content == "None" {
+		description, _ := m["description"].(string)
+		content := truncateRunes(strings.TrimSpace(description), 10000)
+		if content == "" {
 			continue
 		}

And return "" instead of "None" from keenableValueString (or use a display-only variant) so a missing title/url renders as blank rather than the literal word "None".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/agent/component/universe_a_wrappers.go` around lines 713 - 772,
Update keenableValueString to return an empty string for nil values so missing
titles and URLs render blank in buildKeenableReferences and
renderKeenableReferences. Decouple the content filtering in
buildKeenableReferences from the "None" sentinel by checking the raw description
value for nil or empty content explicitly, while continuing to skip genuinely
missing descriptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/agent/component/universe_a_wrappers.go`:
- Around line 713-772: Update keenableValueString to return an empty string for
nil values so missing titles and URLs render blank in buildKeenableReferences
and renderKeenableReferences. Decouple the content filtering in
buildKeenableReferences from the "None" sentinel by checking the raw description
value for nil or empty content explicitly, while continuing to skip genuinely
missing descriptions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: de213170-e274-4fb8-a158-d5a7a563c7d6

📥 Commits

Reviewing files that changed from the base of the PR and between d279aee and 848a5c3.

📒 Files selected for processing (11)
  • internal/agent/canvas/runner.go
  • internal/agent/component/fixture_stubs.go
  • internal/agent/component/keenable_component_test.go
  • internal/agent/component/message.go
  • internal/agent/component/message_test.go
  • internal/agent/component/universe_a_wrappers.go
  • internal/agent/runtime/state.go
  • internal/agent/runtime/state_test.go
  • internal/agent/tool/keenable.go
  • internal/agent/tool/keenable_test.go
  • internal/service/agent.go

@Haruko386 Haruko386 removed the dependencies Pull requests that update a dependency file label Jul 14, 2026
@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit 9289a18 into infiniflow:main Jul 14, 2026
3 checks passed
@Haruko386 Haruko386 added good first issue Good for newcomers dependencies Pull requests that update a dependency file and removed good first issue Good for newcomers dependencies Pull requests that update a dependency file labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants