Skip to content

refactor(automations): migrate workflow assistant to unified chat system#742

Merged
larryro merged 1 commit into
mainfrom
feat/workflow-assistant-unified-chat
Mar 10, 2026
Merged

refactor(automations): migrate workflow assistant to unified chat system#742
larryro merged 1 commit into
mainfrom
feat/workflow-assistant-unified-chat

Conversation

@larryro

@larryro larryro commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the workflow assistant from a dedicated agent implementation to the unified chat system, removing ~300 lines of bespoke code and aligning with the shared agent infrastructure.

Changes

Frontend (automation assistant)

  • Replace dedicated chatWithWorkflowAssistant action with the shared chatWithAgent mutation
  • Resolve workflow agent ID dynamically via new getSystemAgentBySlug query
  • Add dual-layer loading state: optimistic (isPending) + server-reactive (isGenerating) with safety timeout
  • Display file attachments in automation assistant messages using FileAttachmentDisplay
  • Wrap handlers in useCallback for stable references

Backend (Convex)

  • Add getSystemAgentBySlug query for slug-based agent resolution
  • Pass additionalContext through the unified chat mutation
  • Protect system agents (chat, workflow) from deletion and deactivation
  • Enable filePreprocessingEnabled and publishOnSeed on the workflow agent template
  • Use WORKFLOW_AGENT_CORE_INSTRUCTIONS instead of delegation-specific instructions

Removed

  • convex/agents/workflow/actions.ts
  • convex/agents/workflow/agent.ts
  • convex/agents/workflow/generate_response.ts
  • app/features/automations/hooks/actions.ts

Summary by CodeRabbit

  • New Features

    • Added file attachment display support in automation assistant messages.
    • Implemented protection for system agents to prevent accidental deletion or deactivation.
  • Improvements

    • Enhanced chat system with improved context and state management for better message handling and user experience.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

- Replace dedicated workflow agent actions with unified chatWithAgent mutation
- Resolve workflow agent ID dynamically via system agent slug query
- Add dual-layer loading state (optimistic + server-reactive isGenerating)
- Support file attachments display in automation assistant messages
- Add additionalContext passthrough to unified chat mutation
- Protect system agents (chat, workflow) from deletion/deactivation
- Add getSystemAgentBySlug query for slug-based agent resolution
- Enable file preprocessing and publish-on-seed for workflow agent template
- Remove obsolete workflow agent files (actions, agent, generate_response)
@larryro larryro force-pushed the feat/workflow-assistant-unified-chat branch from c428c26 to daae890 Compare March 10, 2026 14:46
@larryro larryro merged commit 938ba5d into main Mar 10, 2026
15 checks passed
@larryro larryro deleted the feat/workflow-assistant-unified-chat branch March 10, 2026 14:47
@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR consolidates workflow-specific chat logic into a unified agent chat system. It removes the dedicated chatWithWorkflowAssistant action and workflow agent infrastructure, adds FileAttachment support for multimodal messaging throughout the chat pipeline, extends the unified agent chat API with an optional additionalContext parameter, introduces system agent protection for 'chat' and 'workflow' slugs, and refactors the automation assistant hook to use the generalized agent mutation with optimistic UI handling and file attachment management.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(automations): migrate workflow assistant to unified chat system' clearly summarizes the main change: migrating the workflow assistant from a dedicated implementation to the unified chat system, which aligns with the substantial changes removing ~300 lines of bespoke workflow code and integrating with shared infrastructure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/workflow-assistant-unified-chat

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

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.

1 participant