[auto] #77 phase 3: detailed tt runs inspection for a single run - #99
Conversation
…n guidance Add Runs subcommand (list/show) to CLI, refactor show() to display ordered step table with status/duration/agent/failure columns, and derive actionable next-step guidance for operators. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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 |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/cli/runs.rs (2)
168-197: Consider clarifying the failing-step + resume-eligible interaction.The logic prioritizes inspection of failing steps over the resume suggestion. This is sensible (inspect failures before retrying), but the output doesn't inform the user that a resume is also available.
Consider enhancing the failing-step case to mention resume eligibility when applicable:
♻️ Optional enhancement
if let Some(step) = failing_step { let agent = step.intent.get("agent_scope").and_then(|v| v.as_str()); + let resume_hint = if ledger.resume_eligible { + format!(" (resume with: tt run --resume {})", ledger.run_id) + } else { + String::new() + }; if let Some(agent_name) = agent { return format!( - "Inspect agent '{}' transcript for step '{}'", - agent_name, step.step_id + "Inspect agent '{}' transcript for step '{}'{}", + agent_name, step.step_id, resume_hint ); } - return format!("Inspect step '{}' output", step.step_id); + return format!("Inspect step '{}' output{}", step.step_id, resume_hint); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/runs.rs` around lines 168 - 197, derive_next_action currently returns a message to inspect a failing step but omits that the run may also be resume-eligible; update the failing-step branch in derive_next_action to append or include a short note when ledger.resume_eligible is true (e.g., " — run can be resumed with: tt run --resume <run_id>") so users are informed of both the failure and the resume option; locate the failing_step handling that formats messages using step.step_id and step.intent (agent_scope) and conditionally add the resume hint using ledger.run_id and ledger.resume_eligible.
292-306: Test coverage could be expanded forderive_next_action.The current tests cover the success and resume-eligible paths, but additional coverage for failing and pending step scenarios would strengthen confidence:
♻️ Suggested additional tests
#[test] fn derive_next_action_failing_step() { use crate::state::{WorkflowStepIntentRecord, WorkflowStepOutcomeRecord}; let ledger = stub_record(None); let steps = vec![WorkflowStepIntentRecord { run_id: "test".to_string(), workflow_name: "test".to_string(), step_index: 0, step_id: "step-fail".to_string(), step_type: "command".to_string(), planned_at: Utc::now(), intent: serde_json::json!({}), attempt: 1, outcome: Some(WorkflowStepOutcomeRecord { completed_at: Utc::now(), status: "failed".to_string(), success: false, exit_code: Some(1), timed_out: false, message: Some("error".to_string()), side_effects: None, }), }]; assert!(derive_next_action(&ledger, &steps).contains("Inspect step")); } #[test] fn derive_next_action_pending_step() { use crate::state::WorkflowStepIntentRecord; let ledger = stub_record(None); let steps = vec![WorkflowStepIntentRecord { run_id: "test".to_string(), workflow_name: "test".to_string(), step_index: 0, step_id: "step-pending".to_string(), step_type: "command".to_string(), planned_at: Utc::now(), intent: serde_json::json!({}), attempt: 0, outcome: None, }]; assert!(derive_next_action(&ledger, &steps).contains("still in progress")); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/runs.rs` around lines 292 - 306, Add two unit tests for derive_next_action: one that constructs a failing step using WorkflowStepIntentRecord with an associated WorkflowStepOutcomeRecord (status "failed", success false, exit_code Some(1), message Some(...)) and asserts the returned string contains "Inspect step", and another that constructs a pending step (WorkflowStepIntentRecord with attempt 0 and outcome None) and asserts the returned string contains "still in progress"; place them alongside derive_next_action tests (use stub_record(None) as the ledger and import crate::state::{WorkflowStepIntentRecord, WorkflowStepOutcomeRecord} and Utc timing helpers) so the failing and pending branches are covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/cli/runs.rs`:
- Around line 168-197: derive_next_action currently returns a message to inspect
a failing step but omits that the run may also be resume-eligible; update the
failing-step branch in derive_next_action to append or include a short note when
ledger.resume_eligible is true (e.g., " — run can be resumed with: tt run
--resume <run_id>") so users are informed of both the failure and the resume
option; locate the failing_step handling that formats messages using
step.step_id and step.intent (agent_scope) and conditionally add the resume hint
using ledger.run_id and ledger.resume_eligible.
- Around line 292-306: Add two unit tests for derive_next_action: one that
constructs a failing step using WorkflowStepIntentRecord with an associated
WorkflowStepOutcomeRecord (status "failed", success false, exit_code Some(1),
message Some(...)) and asserts the returned string contains "Inspect step", and
another that constructs a pending step (WorkflowStepIntentRecord with attempt 0
and outcome None) and asserts the returned string contains "still in progress";
place them alongside derive_next_action tests (use stub_record(None) as the
ledger and import crate::state::{WorkflowStepIntentRecord,
WorkflowStepOutcomeRecord} and Utc timing helpers) so the failing and pending
branches are covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 859ecad0-0384-433c-8650-a3fe9b448473
📒 Files selected for processing (4)
src/cli/mod.rssrc/cli/runs.rssrc/main.rssrc/state/mod.rs
Automated SDLC cycle for #77.
Summary by CodeRabbit
Release Notes
runscommand to inspect SDLC run history with two subcommandsruns listdisplays all tracked runsruns showprovides detailed run view including steps table with execution status, duration, and agent scope, plus intelligent next-action recommendations based on step outcomes