Fix local agent list hang#1042
Conversation
|
CodeAnt AI is reviewing your PR. |
📝 WalkthroughWalkthroughThis PR migrates local agent and metrics CLI commands from ChangesLocal Command Broker Connection Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
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 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 |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/cli/src/cli/commands/core.ts (1)
399-399: 💤 Low valueConsider matching the optional-chaining style used in local-agent.ts.
For consistency,
local-agent.ts:69usesclient?.disconnect?.()while this line usesclient?.disconnect(). Both work (sincedisconnectalways exists on the client instance), but matching styles across the codebase improves readability.🎨 Proposed diff for consistency
- client?.disconnect(); + client?.disconnect?.();🤖 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 `@packages/cli/src/cli/commands/core.ts` at line 399, The call uses inconsistent optional-chaining style: change the invocation from client?.disconnect() to use safe method chaining client?.disconnect?.() so it matches the existing pattern (e.g., the other usage of client?.disconnect?.()), ensuring the code defensively handles a missing disconnect property before calling it.
🤖 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.
Nitpick comments:
In `@packages/cli/src/cli/commands/core.ts`:
- Line 399: The call uses inconsistent optional-chaining style: change the
invocation from client?.disconnect() to use safe method chaining
client?.disconnect?.() so it matches the existing pattern (e.g., the other usage
of client?.disconnect?.()), ensuring the code defensively handles a missing
disconnect property before calling it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eac472f7-0e78-46ba-9e04-6ad995845890
📒 Files selected for processing (4)
CHANGELOG.mdpackages/cli/src/cli/commands/core.tspackages/cli/src/cli/commands/local-agent.test.tspackages/cli/src/cli/commands/local-agent.ts
User description
Summary
Diagnosis
relay local agent listwas usingcreateRuntimeClient({ preferConnect: true }). When no connection file existed, that helper fell back toHarnessDriverClient.spawn(), which started an empty broker. The command could print[], but the spawned broker child, event stream, and lease timer kept the Node process alive.Validation
npm run build:corenpx vitest run packages/cli/src/cli/commands/local-agent.test.tsnpm --prefix packages/cli run buildnpx vitest run packages/cli/src/cli/commands/core.test.tsnode packages/cli/dist/cli/index.js local agent listexits immediately with the no-running-broker error in a fresh worktreeCodeAnt-AI Description
Stop read-only local commands from starting a broker
What Changed
local agent listnow connects to an existing local broker instead of starting a new empty one, so it finishes normally after showing the resultlocal metricsnow uses the same connect-only behavior and disconnects when done, which prevents the command from staying open after printing metricsImpact
✅ Fewer hangs after read-only local commands✅ Faster exit for agent list✅ Shorter local metrics runs💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.