Return clone-safe persona spawn payloads#136
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 10 minutes and 49 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. 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 (2)
📝 WalkthroughWalkthroughThe PR introduces a shared ChangesUnified broker spawn result normalization
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 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 |
|
Reviewed PR #136 against I found no validated breakage to fix. The sanitized spawn result matches the shared IPC contract, and current callers only depend on Verification run:
|
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. Reviewed PR #136 against I found no validated breakage to fix. The sanitized spawn result matches the shared IPC contract, and current callers only depend on Verification run:
|
25dd845 to
8224de3
Compare
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. Reviewed PR #136 against the diff, changed files, current callers, IPC types, tests, and bot comments. No validated breakage found, so I made no file edits. The spawn result normalization matches the IPC contract and renderer usage. Local validation passed:
GitHub state observed:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/broker.test.ts (1)
587-614: 💤 Low valueConsider using
afterEachfor temp directory cleanup.The test uses a
finallyblock for cleanup, which is acceptable, but other test suites in this file use a suite-leveltempDirvariable withafterEachcleanup (see lines 227-252, 1079-1082) for more robust handling of test timeouts and cancellations.♻️ More robust cleanup pattern
Declare
tempDirat the suite level and clean up inafterEach:describe('BrokerManager local + cloud coexistence', () => { + let personaTempDir: string | null = null + beforeEach(() => { mock.state.spawnedClients.length = 0 ... }) + afterEach(async () => { + if (personaTempDir) await rm(personaTempDir, { recursive: true, force: true }) + personaTempDir = null + }) it('returns a clone-safe payload when spawning a workforce persona', async () => { - const tempDir = await mkdtemp(join(tmpdir(), 'pear-persona-spawn-')) + personaTempDir = await mkdtemp(join(tmpdir(), 'pear-persona-spawn-')) + const tempDir = personaTempDir ... - try { ... - } finally { - await rm(tempDir, { recursive: true, force: true }) - } })🤖 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 `@src/main/broker.test.ts` around lines 587 - 614, The test currently creates tempDir locally and cleans it in a finally block; change it to declare tempDir at the suite level and move the cleanup into an afterEach hook to ensure deletion even if tests time out or get cancelled—declare the tempDir variable alongside other suite-scoped fixtures, assign it before each test that uses it (the code that calls manager.start(PROJECT_ID, tempDir, ...)), and replace the try/finally rm(tempDir...) with a single afterEach that calls rm(tempDir, { recursive: true, force: true }); keep the rest of the test logic (instantiating BrokerManager, calling manager.start and manager.spawnPersona) unchanged.
🤖 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 `@src/main/broker.test.ts`:
- Around line 568-615: Add a duplicate/replay concurrency test for persona
spawns similar to the existing spawnAgent duplicate test: create a new it(...)
case that uses BrokerManager and the same temp agentworkforce binary setup, then
call manager.spawnPersona(PROJECT_ID, 'autonomous-actor') twice (concurrently or
nearly concurrently) and assert both calls resolve to the same persona result
and that only one underlying spawn was performed (inspect lastSpawned() or
local.spawnPty call count); ensure the test also checks clone-safety
(structuredClone) and cleans up via manager.shutdown() and rm(tempDir).
- Around line 570-585: The test writes a Unix-style JS with shebang into both
agentworkforce and agentworkforce.cmd causing Windows to treat the .cmd as a
batch file and fail; modify the test to create two files: keep the current
shebang JS content in agentworkforce (executable for POSIX) and write a real
Windows wrapper for agentworkforce.cmd that invokes node pointing at a separate
JS file (the same logic as the shebang JS but saved as e.g., agentworkforce.js);
ensure resolveAgentWorkforceCommand()/canExecute() will pick up the .cmd and
execFileSync(command.cli, ...) will run node with the JS file so
runAgentWorkforceJson()/findWorkforcePersona()/spawnPersona() work on Windows.
---
Nitpick comments:
In `@src/main/broker.test.ts`:
- Around line 587-614: The test currently creates tempDir locally and cleans it
in a finally block; change it to declare tempDir at the suite level and move the
cleanup into an afterEach hook to ensure deletion even if tests time out or get
cancelled—declare the tempDir variable alongside other suite-scoped fixtures,
assign it before each test that uses it (the code that calls
manager.start(PROJECT_ID, tempDir, ...)), and replace the try/finally
rm(tempDir...) with a single afterEach that calls rm(tempDir, { recursive: true,
force: true }); keep the rest of the test logic (instantiating BrokerManager,
calling manager.start and manager.spawnPersona) unchanged.
🪄 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: 2e739536-8a69-4637-8565-0bc7a339b5c7
📒 Files selected for processing (2)
src/main/broker.test.tssrc/main/broker.ts
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
Summary
Tests