fix(orchestrator): parse split workflow invocations#1542
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughThis PR adds test coverage for stream-mode and batch-mode orchestration. When ChangesWorkflow Command Split-Chunk Handling Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/orchestrator/orchestrator.test.ts (1)
945-947: ⚡ Quick winAssert against any leaked
/invoke-workflowtext, not just the three exact chunks.These expectations still pass if a future refactor leaks the command as one recombined message. Mirroring the batch-mode style here would make this regression guard much tighter.
Suggested assertion
- expect(platform.sendMessage).not.toHaveBeenCalledWith('chat-456', '/invoke-workflow '); - expect(platform.sendMessage).not.toHaveBeenCalledWith('chat-456', 'fix-bug '); - expect(platform.sendMessage).not.toHaveBeenCalledWith('chat-456', '--project test-project'); + expect( + platform.sendMessage.mock.calls.some( + ([id, content]) => + id === 'chat-456' && + typeof content === 'string' && + content.includes('/invoke-workflow') + ) + ).toBe(false);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/orchestrator/orchestrator.test.ts` around lines 945 - 947, Replace the three exact-call assertions with a single check that no call to platform.sendMessage contains the substring "/invoke-workflow" (to prevent any leaked command even if split/recombined); locate the mock platform.sendMessage usage in orchestrator.test.ts and assert by scanning platform.sendMessage.mock.calls (or map over its arguments) and expect none of the message strings to include "/invoke-workflow" instead of using not.toHaveBeenCalledWith on the three specific chunks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/core/src/orchestrator/orchestrator.test.ts`:
- Around line 945-947: Replace the three exact-call assertions with a single
check that no call to platform.sendMessage contains the substring
"/invoke-workflow" (to prevent any leaked command even if split/recombined);
locate the mock platform.sendMessage usage in orchestrator.test.ts and assert by
scanning platform.sendMessage.mock.calls (or map over its arguments) and expect
none of the message strings to include "/invoke-workflow" instead of using
not.toHaveBeenCalledWith on the three specific chunks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c1a137ec-7cfd-497d-86d9-6f3ee2340bda
📒 Files selected for processing (2)
packages/core/src/orchestrator/orchestrator-agent.tspackages/core/src/orchestrator/orchestrator.test.ts
|
@guanghuang related to #1541 — split invocation parsing. |
|
@guanghuang @Wirasm @worldomkar This fix addresses a real bug, but is incomplete. Note: /register-project has the same vulnerability. There are two distinct failure modes, not one. The batch-mode fix has two independent parts. Verification approach. I have an alternative PR here that addresses all of these issue completely: #1581 |
Review SummaryVerdict: Minor fixes needed This PR fixes a real split-command issue in the orchestrator: when providers emit Blocking issues
Suggested fixes
Minor / nice-to-have
Compliments
Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, error-handling, test-coverage, comment-quality. |
|
Hi @guanghuang — checking in. @b1skit flagged that this fix addresses a real bug but is incomplete (see their comment). The PR is currently DIRTY. Two paths forward:
Either is fine — let me know which way you want to go. If I don't hear back in ~7 days I'll close as inactive. |
d51d594 to
39f6255
Compare
Summary
/invoke-workflowacross multiple assistant chunks, so Archon detects the command prefix before the full command body has arrived.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
handleStreamMode()handleBatchMode()Label Snapshot
risk: lowsize: Score|testscore:orchestratorChange Metadata
bugcoreLinked Issue
Validation Evidence (required)
Commands and result summary:
Security Impact (required)
No)No)No)No)Yes, describe risk and mitigation: Not applicable.Compatibility / Migration
Yes)No)No)Human Verification (required)
What was personally validated beyond CI:
/invoke-workflowcommand chunks are parsed in stream mode; split command text is parsed in batch mode; trailing non-command text does not corrupt the preserved command snapshot.Side Effects / Blast Radius (required)
/invoke-workflowand/register-projectdetection paths.Rollback Plan (required)
/invoke-workflowoutput, or command text appears unexpectedly in chat output.Risks and Mitigations
Summary by CodeRabbit