Conversation
📝 WalkthroughWalkthroughThis PR adds session resumption to the MTV-agent TUI, allowing users to save and restore chat sessions via a ChangesSession Resume and History Persistence
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@mtv_agent/server/agent.py`:
- Around line 173-177: The dict comprehension that builds cleaned incorrectly
uses "or" and should use "and": locate the comprehension that assigns cleaned
from msg (symbols: cleaned, msg, _SNAPSHOT_STRIP_KEYS) and change the condition
from "if k not in _SNAPSHOT_STRIP_KEYS or v is not None" to "if k not in
_SNAPSHOT_STRIP_KEYS and v is not None" so keys listed in _SNAPSHOT_STRIP_KEYS
are always removed while keeping only non-None values for other keys.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09509645-5e1b-4c37-859b-4a20f73876a9
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
README.mdmtv_agent/cli.pymtv_agent/server/agent.pymtv_agent/server/app.pymtv_agent/server/config.pymtv_agent/server/tools.pymtv_agent/tui/app.py
| cleaned = { | ||
| k: v | ||
| for k, v in msg.items() | ||
| if k not in _SNAPSHOT_STRIP_KEYS or v is not None | ||
| } |
There was a problem hiding this comment.
Critical logic error: or should be and in the dict comprehension.
The condition if k not in _SNAPSHOT_STRIP_KEYS or v is not None incorrectly keeps keys that should be stripped. For example, if "annotations" has a non-None value, the condition evaluates to False or True = True, so the key is kept—but annotations is in _SNAPSHOT_STRIP_KEYS and should always be removed. Similarly, keys not in strip_keys but with None values are incorrectly kept.
🐛 Proposed fix
cleaned = {
k: v
for k, v in msg.items()
- if k not in _SNAPSHOT_STRIP_KEYS or v is not None
+ if k not in _SNAPSHOT_STRIP_KEYS and v is not None
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| cleaned = { | |
| k: v | |
| for k, v in msg.items() | |
| if k not in _SNAPSHOT_STRIP_KEYS or v is not None | |
| } | |
| cleaned = { | |
| k: v | |
| for k, v in msg.items() | |
| if k not in _SNAPSHOT_STRIP_KEYS and v is not None | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@mtv_agent/server/agent.py` around lines 173 - 177, The dict comprehension
that builds cleaned incorrectly uses "or" and should use "and": locate the
comprehension that assigns cleaned from msg (symbols: cleaned, msg,
_SNAPSHOT_STRIP_KEYS) and change the condition from "if k not in
_SNAPSHOT_STRIP_KEYS or v is not None" to "if k not in _SNAPSHOT_STRIP_KEYS and
v is not None" so keys listed in _SNAPSHOT_STRIP_KEYS are always removed while
keeping only non-None values for other keys.
Summary by CodeRabbit
New Features
--resume IDoption to resume saved chat sessions; session IDs and copy-pastable resume commands are now printed on exit.Bug Fixes
Documentation