Conversation
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor conversation history management into a separate class
Extract conversation history into thread-safe class with automatic trimming
Jan 1, 2026
hiyouga
reviewed
Jan 1, 2026
…ms, always trim Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
hiyouga
reviewed
Jan 1, 2026
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
hiyouga
reviewed
Jan 1, 2026
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
hiyouga
approved these changes
Jan 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR refactors conversation history management in PrettyGeminiBot by extracting it into a dedicated ConversationHistory class with thread-safe operations and automatic memory management. It also establishes a testing infrastructure using pytest with CI/CD integration.
Key Changes:
- Thread-safe
ConversationHistoryclass with automatic trimming prevents unbounded memory growth - Simplified history management in
PrettyGeminiBotusing the new class interface - Comprehensive test suite with pytest and automated CI/CD via GitHub Actions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
mini_ema/bot/pretty_gemini_bot.py |
Adds ConversationHistory class with thread-safe operations and refactors PrettyGeminiBot to use it |
tests/test_conversation_history.py |
Comprehensive unit tests for ConversationHistory including thread safety validation |
pyproject.toml |
Adds pytest dependency for testing infrastructure |
Makefile |
Adds make test command and updates help documentation |
.github/workflows/tests.yml |
New GitHub Actions workflow for automated test execution on push/PR |
.github/copilot-instructions.md |
Updates documentation with consolidated testing instructions |
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.
PrettyGeminiBot's conversation history was managed inline with direct list operations, lacking thread safety and automatic memory management.
Changes
New
ConversationHistoryclass (embedded inmini_ema/bot/pretty_gemini_bot.py)threading.Lockadd_messages()prevents unbounded memory growthPRETTY_GEMINI_BOT_HISTORY_LENGTHenvironment variableUpdated
PrettyGeminiBot(mini_ema/bot/pretty_gemini_bot.py)ConversationHistoryinstanceTesting Infrastructure
make testcommand to Makefile using pytest for test execution.github/workflows/tests.yml) for automated testingUsage
History is automatically trimmed to max capacity (max_rounds * 2) on each write, preventing memory leaks in long-running conversations.
Testing
Run
make testto execute all tests with pytest. Tests are also automatically run via GitHub Actions on push/PR to main branch.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.