Skip to content

Refactor: better message - canvas -> agent - #20395

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
wangq8:refactor/better-message
Sep 30, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
wangq8:refactor/better-message

Conversation

@wangq8

@wangq8 wangq8 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Test: passed
image

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 90464f55-c1af-4e12-a1de-2de6afb9ff6b

📥 Commits

Reviewing files that changed from the base of the PR and between 1f835d2 and 92fb8bc.

📒 Files selected for processing (39)
  • internal/agent/canvas/canvas.go
  • internal/agent/canvas/compile.go
  • internal/agent/canvas/compile_test.go
  • internal/agent/canvas/decode.go
  • internal/agent/canvas/interrupt_resume.go
  • internal/agent/canvas/loop_subgraph.go
  • internal/agent/canvas/multibranch_test.go
  • internal/agent/canvas/node_body.go
  • internal/agent/canvas/parallel_subgraph.go
  • internal/agent/canvas/runner.go
  • internal/agent/canvas/scheduler.go
  • internal/agent/canvas/scheduler_test.go
  • internal/agent/component/tool_component.go
  • internal/agent/component/universe_a_wrappers.go
  • internal/agent/runtime/context.go
  • internal/agent/runtime/state.go
  • internal/agent/runtime/template.go
  • internal/dao/user_canvas.go
  • internal/dao/user_canvas_test.go
  • internal/handler/agent.go
  • internal/handler/agent_logs_test.go
  • internal/handler/agent_run_event.go
  • internal/handler/agent_test.go
  • internal/handler/agent_webhook_trace_test.go
  • internal/ingestion/pipeline/pipeline.go
  • internal/ingestion/task/debug_pages_integration_test.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/ingestion/task/pipeline_real_integration_test.go
  • internal/ingestion/task/pipeline_run_test.go
  • internal/service/agent.go
  • internal/service/agent_cancel_test.go
  • internal/service/agent_deferred_failure_test.go
  • internal/service/agent_run_e2e_test.go
  • internal/service/agent_test.go
  • internal/service/bot_completion_history_test.go
  • internal/service/canvas_decode.go
  • internal/service/dataset/update_test.go
  • internal/service/document/document_test.go
  • tools/migrate-canvas/main.go

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

Walkthrough

The changes standardize diagnostics and related test messages on agent terminology. Agent-run errors in streaming and non-streaming chat responses are converted to message events rather than server-error responses.

Changes

Agent execution diagnostics

Layer / File(s) Summary
Execution and runtime errors
internal/agent/canvas/*, internal/agent/component/*, internal/agent/runtime/*
Agent execution logs and errors use the agent prefix. Existing validation and error handling remain unchanged.
Chat error events as messages
internal/handler/agent.go, internal/handler/agent_run_event.go, internal/handler/agent_test.go
Streaming and non-streaming chat paths convert run error events to message events. Tests check for message content instead of a server-error response.
Agent terminology across services and tools
internal/dao/user_canvas*, internal/service/*, internal/ingestion/*, internal/handler/*test.go, tools/migrate-canvas/main.go
Related diagnostics, test failure messages, and migration-tool errors use agent terminology. Existing test behavior is unchanged.

Priority: ➖ Normal

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant AgentRunner
  participant AgentChatCompletions
  participant ChatClient
  AgentRunner->>AgentChatCompletions: Emit error event
  AgentChatCompletions->>AgentChatCompletions: Convert error event to message event
  AgentChatCompletions->>ChatClient: Write SSE message or aggregated response
Loading

Suggested reviewers: 6ba3i, yuzhichang

Merge Risk: ⚪ Minimal · up to 92fb8

Agent-run failures will appear as chat messages rather than server-error responses, as intended. The reviewed changes show no actionable merge-blocking issue.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 92fb8

Agent-run failures now appear as ordinary chat messages, and non-streaming responses report success instead of a failure code. Clients that rely on a machine-readable failure signal may treat an unsuccessful run as successful; the impact on specific clients is not established.

Retained concerns

  • Medium · security · inferred: Agent-run errors lose their machine-readable failure classification at the chat boundary. A non-streaming error receives a success code, while a streaming error becomes a message event; clients relying on those signals could accept a failed run as successful. Specific downstream security decisions have not been verified.
Security review details

Security Blast Radius

  • inferred — The changed response classification is reachable by authenticated callers of agent chat completions in streaming and non-streaming modes. No new identity or tenant lookup path is shown.

Security Findings and Attack Paths

  • inferred — The established risk is loss of an externally visible failure signal, not a verified exploit. No downstream security-sensitive consumer or new disclosure path was established.

Trust Boundaries and Controls

  • observed — The handler still checks for a user before running the agent. Direct runner-call errors still take the separate mapped-error response path; only errors delivered as run events undergo conversion.

Hardening Proposals

  • proposed — If failures must appear as conversation content, preserve an explicit machine-readable failure indicator so clients can distinguish a failed run from a successful answer.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description. The repository template requires a Summary section that briefly explains the purpose and background of the change. Add a Summary section that explains the terminology refactor from canvas to agent and notes the agent run error handling changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 69 functions across 39 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main change: updating user-facing terminology and messages from “canvas” to “agent.” It also covers the dominant changeset, although it does not mention the additional…
  • Fix all pre-merge checks with AI

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 the agent’s trail,
Where error words once wore a canvas veil.
Now messages reach the waiting stream,
And logs say agent, clear and clean.
Soft paws mark each updated line.

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

@wangq8 wangq8 added the ci Continue Integration label Sep 29, 2026
@wangq8
wangq8 merged commit 7cd4718 into infiniflow:main Sep 30, 2026
11 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.

1 participant