Skip to content

Workflow startup greeting should render client-side, not round-trip through Claude #779

@jeremyeder

Description

@jeremyeder

Jira: RHOAIENG-51904

Problem

When a user selects a workflow (e.g., CLAUDE.md Generator), the welcome/greeting message takes 20+ seconds to appear in the chat UI. This is because the startupPrompt from ambient.json is sent through the full LLM round-trip:

runner → backend API → runner /agui/run → Claude SDK → MCP server startup (~14s) → Anthropic API (~3s) → AG-UI events → frontend

The greeting is a static message defined in the workflow's ambient.json. It doesn't need LLM processing.

Root Cause

_trigger_workflow_greeting in ambient_runner/endpoints/workflow.py sends the startupPrompt as a hidden user message to /agui/run, which spins up a full Claude session (including connecting all MCP servers) just to echo back a predetermined message.

Additional bug found during investigation

_trigger_workflow_greeting used path.split("/")[-1] to derive the workflow directory, while clone_workflow_at_runtime uses the repo name (git_url.split("/")[-1].removesuffix(".git")). These don't match, causing the greeting to silently fail — it can't find ambient.json and skips the greeting entirely.

Proposed Solution

  1. Frontend renders the greeting directly: When a workflow is selected, the frontend reads the startupPrompt from the workflow metadata endpoint (/workflow/metadata) and renders it as a system/assistant message in the chat UI immediately — no Claude round-trip needed.

  2. Claude is only invoked when the user sends a real message (e.g., types "1" to select PROJECT/REPO).

  3. Remove _trigger_workflow_greeting from the runner or keep it as a fallback only.

Impact

  • Every workflow activation has a 20+ second delay before the user sees anything
  • Most of that time is MCP server cold starts (google-workspace downloads 80 Python packages via uv on every session start)
  • The greeting itself is static text that could render in <100ms

Time Breakdown (from debug logs)

Phase Duration
mcp-atlassian connect ~1s
webfetch connect (downloads cpython + deps via uv) ~4s
google-workspace connect (downloads 80 packages via uv) ~9s
Anthropic API call ~3s
Total ~20s

Steps to Reproduce

  1. Create a session in the UI
  2. Wait for MCP servers to show as connected
  3. Click a workflow (e.g., CLAUDE.md Generator)
  4. Observe 20+ second delay before greeting appears

Metadata

Metadata

Assignees

No one assigned

    Labels

    amber-generatedPR created by Amber background agentamber:auto-fixAmber agent: automated low-risk fixes (formatting, linting)bugSomething isn't workingfrontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions