Conversation
2. forbid developer and evaluator to execute interactive commands
…ionAI/AWorld into cli_activeskill # Conflicts: # aworld-cli/src/aworld_cli/history.py
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the CLI's history tracking capabilities by introducing a structured, JSONL-based history system that records and aggregates token usage. Concurrently, it refines the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces functionality for handling media files, including size checks and compression, and updates command history logging. It also refines prompts and terminal command validation. My review focuses on performance optimizations for file handling in the history module, improving error logging, reducing code duplication, and addressing potential issues with the updated interactive command blocklist. I've also pointed out a minor typo in the prompt files and a compatibility concern in a Python script within a prompt.
Note: Security Review is unavailable for this PR.
I am having trouble creating individual review comments. Click here to see my feedback.
aworld-cli/src/aworld_cli/history.py (156-157)
The IOError is caught but ignored with a pass statement. This can lead to silent data loss if writing to the history file fails. It's better to log this error, similar to how it's done in load_history_strings.
except IOError as e:
logger.warning(f"Failed to write to history file {self.filename}: {e}")
examples/gaia/mcp_collections/tools/terminal.py (107-110)
The commands less, more, top, htop, and interactive shells (python -i, bash -i) have been removed from the interactive_command_patterns blocklist. These commands are inherently interactive and will likely hang or fail when executed in a non-interactive environment with stdin redirected from /dev/null. This could lead to unexpected behavior or timeouts. It's safer to keep them in the blocklist to provide clear and immediate feedback to the agent that such commands are not allowed.
aworld-cli/src/aworld_cli/history.py (96-97)
The current implementation reads the entire history file into memory with f.readlines() to find a record for aggregation. This can be very inefficient and consume a lot of memory if the history file grows large. Consider optimizing this by reading only a portion of the file, for example, the last N lines, to find a recent match.
aworld-cli/src/aworld_cli/history.py (175-177)
This method reads the entire history file into memory to retrieve the last limit records. For large history files, this is inefficient. A more performant approach would be to read the file from the end, especially since you only need the newest records. You could use a deque to store the last limit lines found while reading backwards.
aworld-cli/src/aworld_cli/history.py (237-285)
There is significant code duplication between the if by_model: block and the else: block for handling token statistics. Both blocks iterate over models and update stats. This logic can be refactored into a helper function to improve maintainability and reduce redundancy. The helper could take the stats dictionary, the record's token_stats, and the timestamp ts as arguments.
aworld-cli/src/aworld_cli/inner_plugins/smllc/agents/developer/prompt.txt (14)
There's a typo in non-interactivealternatives. It should be non-interactive alternatives with a space.
**Do Not Use Interactive commands. You may use non-interactive alternatives (e.g. --yes, -y, CI=1, DEBIAN_FRONTEND=noninteractive) or different tools.
aworld-cli/src/aworld_cli/inner_plugins/smllc/agents/evaluator/prompt.txt (30)
There's a typo in non-interactivealternatives. It should be non-interactive alternatives with a space.
- **Do Not Use Interactive commands. You may use non-interactive alternatives (e.g. --yes, -y, CI=1, DEBIAN_FRONTEND=noninteractive) or different tools.
aworld-cli/src/aworld_cli/inner_plugins/smllc/agents/media_comprehension/prompt.txt (56)
The use of Image.Resampling.LANCZOS requires Pillow version 9.1.0 or newer. For better compatibility with older environments, it's safer to use the legacy Image.LANCZOS. This avoids a potential AttributeError if an older version of Pillow is installed.
img.resize(new_size, Image.LANCZOS).save(out_path, 'JPEG', quality=70, optimize=True)
Uh oh!
There was an error while loading. Please reload this page.