feat: Pro: Add agentwatch replay command to rewind and resume failed agent sessions#430
feat: Pro: Add agentwatch replay command to rewind and resume failed agent sessions#430SHAURYASANYAL3 wants to merge 6 commits into
agentwatch replay command to rewind and resume failed agent sessions#430Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 28 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesCLI and Orchestration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
🧪 PR Test Results
Python 3.12 · commit e4d3a61 |
2e5a0d2 to
8594d7f
Compare
agentwatch replay command to rewind and resume failed agent sessions
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@agentwatch/cli/main.py`:
- Around line 1527-1538: The replay_session command is defined twice with the
same decorator name "replay-session", and the second definition is overriding
the first functional implementation that calls RollbackEngine.rollback_session.
Either remove the duplicate replay_session function definition entirely to
restore the working implementation, or if Pro license gating is intended, merge
the license validation check (the console.print statements for validating Pro
License) into the original replay_session implementation instead of replacing
the entire function. Later command registrations in Typer override earlier ones,
so duplicates must be consolidated.
- Around line 384-389: The json.load() call when reading the config file does
not handle the case where the file contains invalid JSON, which will raise
json.JSONDecodeError without a user-friendly message. Wrap the json.load(f)
statement in a try-except block to catch json.JSONDecodeError, then use
console.print() to display a user-friendly error message (similar to the
existing message for missing config file) and raise typer.Exit(1) to terminate
gracefully. This should be placed after the file existence check and within the
context manager.
In `@agentwatch/orchestration/__init__.py`:
- Line 1: The import statement `from agentwatch.orchestration.bft_consensus
import *` in the __init__.py file references a module that does not exist,
causing the entire orchestration package initialization to fail. Either create
the missing bft_consensus.py module in the agentwatch/orchestration directory
with appropriate implementation, or remove the import statement from the
__init__.py file until the bft_consensus module is ready to be implemented.
Choose whichever approach aligns with your development timeline and module
architecture.
In `@tests/test_multiagent.py`:
- Line 8: The import statement importing BFTConsensusEngine from
agentwatch.orchestration.bft_consensus will fail because this module does not
exist yet, causing the entire test file to fail during collection. Either remove
or comment out the import line that imports BFTConsensusEngine from
agentwatch.orchestration.bft_consensus until the bft_consensus module is created
and available, or add the missing bft_consensus module with the
BFTConsensusEngine class to the agentwatch.orchestration package.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1937a04b-e51c-4cfd-ad98-58dfed351029
📒 Files selected for processing (4)
agentwatch/cli/main.pyagentwatch/orchestration/__init__.pytests/test_multiagent.pytests/test_protocol.py
| @@ -1 +1,2 @@ | |||
| from agentwatch.orchestration.bft_consensus import * | |||
There was a problem hiding this comment.
Import fails—module does not exist.
The pipeline failures confirm that agentwatch.orchestration.bft_consensus raises ModuleNotFoundError. This breaks the entire package initializer, causing all imports from agentwatch.orchestration to fail.
Either add the missing bft_consensus.py module or remove this import until the module is implemented.
🧰 Tools
🪛 GitHub Actions: PR Tests / 0_Test & lint.txt
[error] 1-1: Import error in package initialization: from 'agentwatch.orchestration.bft_consensus' import * failed with ModuleNotFoundError.
🪛 GitHub Actions: PR Tests / Test & lint
[error] 1-1: Import failure in package initializer: 'from agentwatch.orchestration.bft_consensus import *' raises ModuleNotFoundError for 'agentwatch.orchestration.bft_consensus'.
🤖 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 `@agentwatch/orchestration/__init__.py` at line 1, The import statement `from
agentwatch.orchestration.bft_consensus import *` in the __init__.py file
references a module that does not exist, causing the entire orchestration
package initialization to fail. Either create the missing bft_consensus.py
module in the agentwatch/orchestration directory with appropriate
implementation, or remove the import statement from the __init__.py file until
the bft_consensus module is ready to be implemented. Choose whichever approach
aligns with your development timeline and module architecture.
Source: Pipeline failures
| import pytest | ||
|
|
||
| from agentwatch.core.event_bus import EventBus | ||
| from agentwatch.orchestration.bft_consensus import BFTConsensusEngine |
There was a problem hiding this comment.
Import will fail—module does not exist.
This import of BFTConsensusEngine from agentwatch.orchestration.bft_consensus will fail with ModuleNotFoundError since the module does not exist (as confirmed by pipeline failures on the package initializer). The entire test file will fail to collect.
This is blocked until the bft_consensus module is added or this import is removed.
🤖 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 `@tests/test_multiagent.py` at line 8, The import statement importing
BFTConsensusEngine from agentwatch.orchestration.bft_consensus will fail because
this module does not exist yet, causing the entire test file to fail during
collection. Either remove or comment out the import line that imports
BFTConsensusEngine from agentwatch.orchestration.bft_consensus until the
bft_consensus module is created and available, or add the missing bft_consensus
module with the BFTConsensusEngine class to the agentwatch.orchestration
package.
Source: Pipeline failures
Resolves #416
Overview
This Pull Request implements the highly requested Pro: Add
agentwatch replaycommand to rewind and resume failed agent sessions functionality into the AgentWatch CLI.Why do we need this?
For a 5-year-old: Sometimes the robot trips and drops its toys. We want a "rewind" button so it can go back in time, fix its mistake, and keep playing!
For developers: Debugging agent failure loops is expensive and tedious. Developers need a way to restore an agent's memory and execution state from a specific checkpoint just before failure.
What is it?
A new CLI command
agentwatch replay <session-id> --step <n>that initializes a local agent context using a saved snapshot. This is a PAID Pro feature.Suggestions for Implementation
CheckpointDataengine to retrieve the exact memory snapshot and prompt history.Implementation Notes 🛠️
typerframework inagentwatch/cli/main.py.rich.Summary by CodeRabbit
New Features
swarmcommand to manage agent configurations and list agentsreplay-sessioncommand for session resumption and rollback capabilitiesRemoved
replaycommandTests