feat: add phased decision report to orchestrator#45
Conversation
Replace the bare-bones numeric summary with a structured decision report that explains each orchestration phase (sync, status, decisions, evolve, watch) so operators can understand what the loop did and why. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThis PR adds human-readable report formatting to the orchestration CLI. It introduces helper functions to render phase-specific decision reports and exports a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cli/selftune/orchestrate.ts`:
- Around line 165-179: In formatWatchPhase, avoid appending empty parentheses
when c.watchResult?.snapshot is missing by building a stats string only when
snapshot exists: compute passInfo and baseInfo from snap, join them into a
non-empty statsPart, and then only append ` (${statsPart})` to the line when
statsPart is truthy; leave alertTag and reason formatting unchanged. Ensure you
reference formatWatchPhase, the watched variable, c.watchResult?.snapshot
(snap), passInfo/baseInfo, and alertTag when making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 37e0b1ca-27e1-400d-921e-5fd71478d03b
📒 Files selected for processing (2)
cli/selftune/orchestrate.tstests/orchestrate.test.ts
| function formatWatchPhase(candidates: SkillAction[]): string[] { | ||
| const watched = candidates.filter((c) => c.action === "watch"); | ||
| if (watched.length === 0) return []; | ||
|
|
||
| const lines: string[] = ["Phase 5: Watch"]; | ||
| for (const c of watched) { | ||
| const snap = c.watchResult?.snapshot; | ||
| const passInfo = snap ? `pass_rate=${snap.pass_rate.toFixed(2)}` : ""; | ||
| const baseInfo = snap ? `, baseline=${snap.baseline_pass_rate.toFixed(2)}` : ""; | ||
| const alertTag = c.watchResult?.alert ? " [ALERT]" : ""; | ||
| lines.push(` ${c.skill.padEnd(20)} ${c.reason}${alertTag} (${passInfo}${baseInfo})`); | ||
| } | ||
|
|
||
| return lines; | ||
| } |
There was a problem hiding this comment.
Empty parentheses appended when snapshot is missing.
If c.watchResult?.snapshot is undefined (snap falsy), passInfo and baseInfo are both empty strings, resulting in output like "SkillName reason ()". Consider omitting the parentheses entirely when there's no snapshot data.
Proposed fix
const snap = c.watchResult?.snapshot;
const passInfo = snap ? `pass_rate=${snap.pass_rate.toFixed(2)}` : "";
const baseInfo = snap ? `, baseline=${snap.baseline_pass_rate.toFixed(2)}` : "";
const alertTag = c.watchResult?.alert ? " [ALERT]" : "";
- lines.push(` ${c.skill.padEnd(20)} ${c.reason}${alertTag} (${passInfo}${baseInfo})`);
+ const metrics = snap ? ` (${passInfo}${baseInfo})` : "";
+ lines.push(` ${c.skill.padEnd(20)} ${c.reason}${alertTag}${metrics}`);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@cli/selftune/orchestrate.ts` around lines 165 - 179, In formatWatchPhase,
avoid appending empty parentheses when c.watchResult?.snapshot is missing by
building a stats string only when snapshot exists: compute passInfo and baseInfo
from snap, join them into a non-empty statsPart, and then only append `
(${statsPart})` to the line when statsPart is truthy; leave alertTag and reason
formatting unchanged. Ensure you reference formatWatchPhase, the watched
variable, c.watchResult?.snapshot (snap), passInfo/baseInfo, and alertTag when
making the change.
Orchestrate output now explains each decision clearly so users can trust the autonomous loop. Adds formatOrchestrateReport() with 5-phase human report (sync, status, decisions, evolution, watch) and enriched JSON with per-skill decisions array. Supersedes PR #45. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the bare-bones numeric summary with a structured decision report that explains each orchestration phase (sync, status, decisions, evolve, watch). Operators can now see exactly which skills were considered, which were skipped, and why — along with evolution results and watch alerts.
Changes
decisionsarray with per-skill action, reason, and outcome (deployed/validation/alert details)Safe defaults remain intact; no changes to core telemetry semantics.
🤖 Generated with Claude Code