feat: replace SSE streaming with job-based LangFlow V2 workflow#14
Closed
cfchase wants to merge 11 commits into
Closed
feat: replace SSE streaming with job-based LangFlow V2 workflow#14cfchase wants to merge 11 commits into
cfchase wants to merge 11 commits into
Conversation
- Job model with JobStatus enum and TERMINAL_STATUSES lifecycle tracking - LangflowClient V2 methods: submit_workflow, get_workflow_status, stop_workflow, build_v2_inputs - MockLangflowClient with matching V2 mock methods and resolve_flow_id - LangflowClientProtocol updated with V2 method signatures - ChatMessage reverse relationship to Job - Alembic migration for job table with indexes
…e creation
- GET /v1/jobs/{id} with optional ?sync=true for LangFlow polling
- POST /v1/jobs/{id}/cancel to stop running jobs via V2 API
- POST /v1/chats/{id}/messages/job for background job-based AI processing
- Status sync maps LangFlow V2 statuses to our job lifecycle
- Ownership verification traverses job -> chat_message -> chat -> user
- Existing /stream endpoint preserved for backward compatibility
- Tests for job CRUD, sync, cancel, ownership, and message creation
- Add JobResponse type, TERMINAL_STATUSES, createJobMessage, getJob, cancelJob, getActiveJob to chatApi.ts
- Create useJobPolling hook with TanStack Query refetchInterval pattern (5s polling, stops on terminal)
- Add GET /chats/{id}/active-job backend endpoint for page refresh recovery
- handleSend uses createJobMessage instead of createStreamingMessage - useJobPolling drives message lifecycle (loading -> completed/failed/cancelled) - Typing indicator with animated dots via PatternFly Message isLoading prop - Cancel button inline in typing indicator message area - Tooltip shows status + elapsed time on hover - Errors display as inline messages with expandable details and retry - Page refresh recovery checks for active jobs on chat load - Chat input disabled while job is in progress - Request cancelled state preserved in chat history - All 23 frontend tests pass with job-based flow
- Forward LANGFLOW_DEVELOPER_API_ENABLED and LANGFLOW_API_KEY in dev-langflow.sh - Document V2 Workflow API variables in .env.example - Add E2E job lifecycle tests (happy path, cancel, page refresh, error) - Fix ChatMessageBase min_length=0 to allow placeholder assistant messages
- build_v2_inputs: use V2 flat format ("Chat Input.input_value")
instead of V1-style dict (input_value, input_type, output_type)
- submit_workflow: wrap inputs as "inputs" key instead of spreading
- extract_result_text: parse V2 output structure (dict with component
names as keys) instead of V1 nested arrays
- Update mock client to match V2 format for tests
- Pin all deployment configs to langflowai/langflow:1.8.0 - Add LANGFLOW_DEVELOPER_API_ENABLED=true to k8s, helm, and dev script - Move LANGFLOW_DEVELOPER_API_ENABLED and LANGFLOW_API_KEY to COMMON_ENV_ARGS in dev-langflow.sh (works with both stock and custom images) - Default LANGFLOW_VERSION to 1.8.0 in dev script
Owner
Author
Code reviewFound 1 issue:
multi-agent-platform/backend/app/models/job.py Lines 44 to 47 in 380a649 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Without CASCADE, deleting a ChatMessage leaves orphaned Job records or raises a foreign key constraint violation. Aligns with the cascade pattern used by all other foreign keys in the codebase.
Switch from auto_login/Bearer auth to x-api-key with LANGFLOW_API_KEY_SOURCE=env for LangFlow 1.8.0 compatibility. Fix job sync getting stuck in_progress when LangFlow V2 returns HTTP 500 for failed jobs (JOB_FAILED code).
When a V2 workflow job completes, the result was stored in job.result_content but never written back to the associated ChatMessage.content field. The frontend reads messages from the messages API, so responses appeared as empty bubbles.
Owner
Author
|
Closed: changes were squash merged directly to main in db8b39a. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
make test-backendto verify all backend tests passmake test-frontendto verify frontend tests pass🤖 Generated with Claude Code