Skip to content

Conversation

@tsmithsz
Copy link
Contributor

@tsmithsz tsmithsz commented Apr 9, 2025

Problem

We need to switch to using the Chat History DB instead of the local store

Solution

  • Add the same history fixing functionality to Chat History DB as the former chatHistory local store
  • Replace all uses of the local store
  • Maintain a sessionId/ConversationId for each tab

Tested manually


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tsmithsz tsmithsz requested review from a team as code owners April 9, 2025 23:01
@github-actions
Copy link

github-actions bot commented Apr 9, 2025

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from 87284a8 to 9bc7ee8 Compare April 9, 2025 23:06
@tsmithsz
Copy link
Contributor Author

tsmithsz commented Apr 9, 2025

/retrybuilds

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from 9bc7ee8 to 96f76c3 Compare April 10, 2025 17:13
@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch 2 times, most recently from de4747d to b4f8fef Compare April 10, 2025 19:50
@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from b4f8fef to 0398a10 Compare April 10, 2025 19:56
@tsmithsz tsmithsz requested a review from mr-lee April 10, 2025 21:03
@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch 2 times, most recently from feece49 to c6c760e Compare April 10, 2025 21:41
@tsmithsz tsmithsz marked this pull request as draft April 10, 2025 23:31
@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from c6c760e to e58911b Compare April 11, 2025 00:15
@tsmithsz tsmithsz marked this pull request as ready for review April 11, 2025 00:27
} else {
allMessages.splice(-2)
this.logger.info(`Removed last assistant message and user message`)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the case where the end of the chat history is a user message, shouldn't the assistant always respond?

}

// Removes the most recent message(s) from the chat history for a given tab
clearRecentHistory(tabId: string): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

"recent" is ambiguous. Based on implementation it looks like it removes the last "exchange" (pair of messages). Anyway to make this more clear in docstring + name of the function?

* 4. If the last message is from the assistant and it contains tool uses, and a next user
* message is set without tool results, then the user message will have cancelled tool results.
*/
fixHistory(tabId: string, newUserMessage: ChatMessage): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is definitely some non-trivial logic in this class that would benefit from some testing.

Copy link
Contributor

@Hweinstock Hweinstock left a comment

Choose a reason for hiding this comment

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

Approving and merging to unblock, while @tsmithsz is OOTO. Hope there is time to add a solid test suite for this logic in a follow-up.

@Hweinstock Hweinstock merged commit b5cd5c3 into aws:feature/agentic-chat Apr 11, 2025
22 checks passed
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.

6 participants