Skip to content

fix: resolve followup message failure after frontend tool calls#2

Open
mme wants to merge 3 commits intomainfrom
feat/fix-followup-after-frontend-tools
Open

fix: resolve followup message failure after frontend tool calls#2
mme wants to merge 3 commits intomainfrom
feat/fix-followup-after-frontend-tools

Conversation

@mme
Copy link

@mme mme commented Mar 19, 2026

Summary

  • Fix Bedrock ValidationException ("Expected toolResult blocks") on follow-up messages after using shared state (Canvas/Todos) or any frontend tool call
  • Three fixes in copilotkit/copilotkit_lg_middleware.py:
    • Position-preserving dedup: real tool result replaces placeholder in-place instead of being kept at wrong position
    • Adjacency-based unanswered check: only ToolMessages immediately following an AIMessage count as "answered"
    • Orphan cleanup: removes leftover ToolMessages after stripping unanswered tool_calls
  • Add app mode UI (Chat/App toggle) with enableAppMode/enableChatMode frontend tools
  • Add error handling in agent entrypoint (emits RunErrorEvent instead of silent crash)
  • Replace debug print statements with logging

Test plan

  • Pie chart (Controlled Generative UI)
  • Bar chart (Controlled Generative UI)
  • MCP apps (Open Generative UI / Excalidraw)
  • Change theme (Frontend Tools)
  • Scheduling (Human In The Loop)
  • Canvas (Shared State) + follow-up messages

@tylerslaton tylerslaton force-pushed the feat/fix-followup-after-frontend-tools branch 2 times, most recently from 6173b94 to 0a6b570 Compare March 21, 2026 00:00
tylerslaton and others added 3 commits March 20, 2026 17:05
…ative UI

- Wire CopilotKitMiddleware and LangGraphAGUIAgent into the LangGraph agent
- Add query_data tool with sample financial CSV for generative chart UI
- Add manage_todos/get_todos tools and AgentState with todos field for shared state
- Add Excalidraw MCP middleware and suggestion
- Add unit test infrastructure for agent tools

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
…onents

- Add CopilotChatInterface powered by CopilotKit with generative UI support
- Add PieChart and BarChart for financial data visualization
- Add ToolReasoning default tool renderer
- Add MeetingTimePicker for human-in-the-loop interactions
- Add TodoCanvas with TodoCard/TodoColumn/TodoList for shared agent state
- Add useCopilotExamples hook consolidating all CopilotKit registrations
- Add ThemeProvider and useTheme hook with light/dark mode toggle

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
- Add CopilotKit Lambda runtime to CDK and Terraform stacks
- Add SSM parameters and outputs for CopilotKit runtime URL
- Update frontend deployment scripts to include CopilotKit runtime config

Co-Authored-By: Brian Love <brian@liveloveapp.com>
Co-Authored-By: Markus Ecker <markus.ecker@gmail.com>
@tylerslaton tylerslaton force-pushed the feat/fix-followup-after-frontend-tools branch from 0a6b570 to 8707c68 Compare March 21, 2026 00:07
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.

2 participants