Skip to content

Conversation

@tonyfettes
Copy link
Contributor

@tonyfettes tonyfettes commented Dec 15, 2025

Motivation

State events like ModelLoaded, ToolAdded, and SystemPromptSet were used in cmd/test and cmd/jsonl2md to show system information in logs. When implementing event storage and resuming functionality (#787), these event will be added to history for every resumption.

For example, if we created a new conversation, before this PR, the conversation would have the following events if #787 were merged:

  • ModelLoaded
  • ToolUpdated: read_file
  • ToolUpdated: meta_write_file
  • SystemPromptSet: You are a helpful assistant
  • PreConversation
  • UserMessage: Hello
  • RequestCompleted: Hi! ...
  • PostConversation

Then, if we were resuming such conversation using the Maria::resume implemented in #787, the history will have the following event:

  • (old) ModelLoaded
  • (old) ToolUpdated: read_file
  • (old) ToolUpdated: meta_write_file
  • (old) SystemPromptSet: You are a helpful assistant
  • (old) PreConversation
  • (old) UserMessage: Hello
  • (old) RequestCompleted: Hi! ...
  • (old) PostConversation
  • (new) ModelLoaded
  • (new) ToolUpdated: read_file
  • (new) ToolUpdated: meta_write_file
  • (new) SystemPromptSet: You are a helpful assistant

We found out that ModelLoaded, ToolUpdated, and SystemPromptSet events are duplicated.

Changes

This PR remove the ModelLoaded and ToolUpdated event, so that these events does not duplicated when resuming a conversation.

In order for cmd/test and cmd/jsonl2md to continue to work, we moved these events into cmd/test package, by defining type @cmd/test.Event and @cmd/test.EventDesc

@tonyfettes tonyfettes force-pushed the haoxiang/remove-model-loaded-and-tool-added branch 3 times, most recently from 23384d1 to 5986dda Compare December 16, 2025 02:16
@tonyfettes tonyfettes marked this pull request as draft December 16, 2025 03:50
@tonyfettes tonyfettes force-pushed the haoxiang/remove-model-loaded-and-tool-added branch from 5986dda to 9c19a53 Compare December 16, 2025 04:08
@tonyfettes tonyfettes force-pushed the haoxiang/remove-model-loaded-and-tool-added branch 2 times, most recently from 45830b2 to b89dcac Compare December 17, 2025 02:54
@tonyfettes tonyfettes force-pushed the haoxiang/remove-model-loaded-and-tool-added branch from b89dcac to a463829 Compare December 17, 2025 03:08
@tonyfettes tonyfettes changed the title refactor(event): remove ModelLoaded and ToolAdded refactor(event): remove state events Dec 17, 2025
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