Fix wtc_list MCP tool always reporting status as "up"#4
Conversation
`docker compose -p <project> ps --format json` exits 0 with empty output for a project that doesn't exist, so the previous `execSafe(...) !== null` check treated every worktree as up regardless of whether its compose stack was actually running. The CLI's `listCommand` already guards against this with a `result.length > 2` check (in src/commands/list.ts). Apply the same guard in the MCP server's `listWorktrees` so its `status` field matches the CLI output.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesContainer Status Detection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
Summary
The
wtc_listMCP tool reportsstatus: "up"for every worktree regardless of whether its compose stack is actually running. The CLI'swtc listis correct; the MCP version isn't.Root cause
docker compose -p <project> ps --format jsonexits 0 with empty output when the project doesn't exist. The MCP server's check is:execSafereturnsnullonly when the command throws — empty stdout from a non-existent project still returns a string, soupis alwaystrue.The CLI already handles this correctly in
src/commands/list.ts:This PR applies the same
length > 2guard in the MCPlistWorktrees.Repro
With no worktree compose stacks running:
Empty output, exit 0 → MCP reports
up, CLI correctly reportsdown.After
MCP
wtc_liststatusfield now matches the CLI.Test plan
pnpm buildpassespnpm test— all 33 existing tests passwtc_listreturnsstatus: "down"for all worktrees, matchingwtc listwtc start <n>, MCPwtc_listreturnsstatus: "up"for that worktreeSummary by CodeRabbit