Skip to content

Update Agent/Tool Message Construction and Handling #6333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jul 2, 2025

Conversation

RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Jun 28, 2025

Description

  • Unifies thunks - moves getting system message, constructing messages into the streamNormalInput thunk
  • Updates the way dangling messages are cleaned up on stream cancellation - accounts for tool calls, thinking messages, etc.
  • Updates message compilation so that fresh tool messages are injected after their tool calls at the time of compiling messages, although output is still streamed to redux toolCallState AND existing tool call messages, so that persisted conversation reflects what is sent to model. This fixes bugs around tool calls not having associated tool messages and vice versa.
  • Changes pending tool rejection to just stop rather than continue streaming
  • Changes reject diffs after edit tool to stop rather than continue streaming from GUI at least for now
  • Removes filtering of tool calls in chat mode (was causing non-sensical history for model) but updates the Bedrock API to insert tool calls and outputs as text parts when the corresponding tool is not in the toolOptions. Updates corresponding tests.
  • Changes rule trigger logic to include context items from the most recent user message forward, including tool/assistant messages AFTER the most recent user message (for long agent convos)

Borrows ideas from @chezsmithy #5662

Copy link

netlify bot commented Jun 28, 2025

Deploy Preview for continuedev failed. Why did it fail? →

Name Link
🔨 Latest commit 401b3bb
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/68633986356ce300087e8eef

Copy link
Collaborator Author

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

  • Adds a "Truncate chat to this message" icon in non-last tool messages, to allow users to interrupt mid-long agent streams
  • Fix bug where toggling mode causes focus loss if not in main editor
  • Streamline tool context item to contextItemWithId conversion, add toolCall named icon

EDIT this is no longer relevant

@RomneyDa RomneyDa changed the title Agent papercuts Truncate to tool message icon Jun 28, 2025
@RomneyDa RomneyDa marked this pull request as ready for review June 28, 2025 02:41
@RomneyDa RomneyDa requested a review from a team as a code owner June 28, 2025 02:41
@RomneyDa RomneyDa requested review from sestinj and removed request for a team June 28, 2025 02:41
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 28, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 2 issues across 9 files. Review them in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

@RomneyDa RomneyDa marked this pull request as draft June 30, 2025 02:22
@RomneyDa RomneyDa changed the title Truncate to tool message icon Agent message bugginess fixes Jun 30, 2025
@RomneyDa RomneyDa marked this pull request as ready for review June 30, 2025 18:43
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 30, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 5 issues across 22 files. Review them in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

Copy link
Contributor

@sestinj sestinj left a comment

Choose a reason for hiding this comment

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

It feels like there's a chance this could have been 2 PRs? I don't know exactly what the order of operations looked like while you were working on it, but just noting that this was slightly messy to review

Otherwise biggest thing is unit tests on constructMessages

And make sure to take a look at Cubic's feedback. At least the gap one is accurate

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jun 30, 2025
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 1, 2025
@RomneyDa RomneyDa closed this Jul 1, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jul 1, 2025
@RomneyDa RomneyDa reopened this Jul 1, 2025
@github-project-automation github-project-automation bot moved this from Done to In Progress in Issues and PRs Jul 1, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jul 1, 2025
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 1, 2025
@RomneyDa RomneyDa changed the title Agent message bugginess fixes Update Agent/Tool Message Handling Jul 2, 2025
@RomneyDa RomneyDa changed the title Update Agent/Tool Message Handling Update Agent/Tool Message Construction and Handling Jul 2, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 2, 2025
@RomneyDa RomneyDa merged commit ad12f6f into main Jul 2, 2025
104 of 108 checks passed
@RomneyDa RomneyDa deleted the dallin/agent-papercuts branch July 2, 2025 03:57
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jul 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants