Skip to content

Symphony: Forced Parallel Execution: bypass message queue with modifier shortcut (#702)#711

Merged
pedramamini merged 7 commits intorcfrom
symphony/issue-702-mnhxkuso
Apr 4, 2026
Merged

Symphony: Forced Parallel Execution: bypass message queue with modifier shortcut (#702)#711
pedramamini merged 7 commits intorcfrom
symphony/issue-702-mnhxkuso

Conversation

@chr1syy
Copy link
Copy Markdown
Contributor

@chr1syy chr1syy commented Apr 2, 2026

Maestro Symphony Contribution

Closes #702

Contributed via Maestro Symphony.

Status: In Progress
Started: 2026-04-02T20:32:11.363Z


This PR will be updated automatically when the Auto Run completes.

Summary by CodeRabbit

  • New Features

    • Added Forced Parallel Execution setting with a customizable keyboard shortcut (default: Meta+Shift+Enter).
    • Added a confirmation warning modal that must be acknowledged before enabling the setting; confirming enables and acknowledges the feature.
    • Settings toggle and shortcut label added to Settings → General; toggle opens modal when needed.
  • Tests

    • Added tests covering the warning modal, shortcut handling, forced-parallel input processing, focus behavior, and settings persistence/initial state.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

Adds a configurable "Forced Parallel Execution" feature: new settings and persistence, a one-time warning modal component and modal priority, Settings UI toggle with shortcut badge and acknowledgement flow, a configurable keyboard shortcut to trigger per-message forced sends, processInput API extension to support forceParallel and queue-bypass, and accompanying tests.

Changes

Cohort / File(s) Summary
Store & Settings API
src/renderer/stores/settingsStore.ts, src/renderer/hooks/settings/useSettings.ts, src/__tests__/renderer/stores/settingsStore.test.ts
Added forcedParallelExecution and forcedParallelAcknowledged to settings state and hook return; added setters setForcedParallelExecution / setForcedParallelAcknowledged; persisted values in loadAllSettings(); tests updated to assert defaults and persistence.
UI — Settings & Modal
src/renderer/components/ForcedParallelWarningModal.tsx, src/renderer/components/Settings/tabs/GeneralTab.tsx, src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx
New ForcedParallelWarningModal component and integration into GeneralTab with toggle/acknowledgement flow; toggle opens modal on first enable; modal wired to confirm/cancel, initial focus, theme, and tests verifying rendering, focus, and handlers.
Constants & Shortcut Defaults
src/renderer/constants/modalPriorities.ts, src/renderer/constants/shortcuts.ts
Added MODAL_PRIORITIES.FORCED_PARALLEL_WARNING = 1005 and default shortcut DEFAULT_SHORTCUTS.forcedParallelSend (Meta+Shift+Enter) with label "Forced Parallel Send".
Input Handling & Processing
src/renderer/hooks/input/useInputHandlers.ts, src/renderer/hooks/input/useInputKeyDown.ts, src/renderer/hooks/input/useInputProcessing.ts, src/__tests__/renderer/hooks/useInputKeyDown.test.ts, src/__tests__/renderer/hooks/useInputProcessing.test.ts
Extended processInput signature to accept options?: { forceParallel?: boolean }; added shortcut detection in useInputKeyDown to call processInput(undefined, { forceParallel: true }) when enabled and in AI mode; useInputProcessing respects forceParallel to bypass queuing and appends -fp-{timestamp} to spawned targetSessionId to avoid collisions; tests cover behavior and gating.
Tests & Misc
src/__tests__/... (new/updated tests across renderer)
Added/updated unit and integration-style tests for modal behavior, keyboard shortcut handling (including custom key config and mode guards), processing-path differences when forcing parallel execution, and settings persistence.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as GeneralTab UI
    participant Modal as ForcedParallelWarningModal
    participant Store as settingsStore
    participant KeyHandler as useInputKeyDown
    participant Processor as useInputProcessing
    participant Persist as window.maestro.settings
    participant ProcessAPI as window.maestro.process

    User->>UI: Toggle Forced Parallel (first time)
    alt not acknowledged
        UI->>Modal: open modal
        Modal->>User: show warning
        User->>Modal: confirm
        Modal->>Store: setForcedParallelAcknowledged(true)
        Store->>Persist: persist acknowledgment
        Modal->>Store: setForcedParallelExecution(true)
        Store->>Persist: persist execution enabled
    else already acknowledged
        UI->>Store: setForcedParallelExecution(true)
        Store->>Persist: persist execution enabled
    end

    User->>KeyHandler: Press configured shortcut (AI mode)
    KeyHandler->>Processor: processInput(undefined, {forceParallel: true})
    Processor->>Store: read forcedParallelExecution
    alt forceParallel enabled
        Processor->>Processor: shouldQueue = false
        Processor->>ProcessAPI: spawn (targetSessionId + -fp-{timestamp})
    else
        Processor->>Processor: normal queue logic
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

RC

Suggested reviewers

  • pedramamini

"I'm a rabbit in a hurried sprint,
Toggle set, a cautious hint,
Meta+Shift to send once more,
Parallel paths across the floor,
Hop lightly — warnings kept in store!" 🐰⚠️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly identifies the main feature: adding a 'Forced Parallel Execution' mode with a modifier shortcut that bypasses the message queue, which aligns with the core changes.
Linked Issues check ✅ Passed The PR implements all core coding requirements from issue #702: settings store with state management, warning modal component, GeneralTab UI integration, keyboard shortcut handling, and comprehensive test coverage for all scenarios.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #702 requirements: settings infrastructure, modal component, keyboard handling, and test suites. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch symphony/issue-702-mnhxkuso

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pedramamini
Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @chr1syy! 🙌

It looks like this PR is still in progress — the title is marked [WIP], the body says "In Progress," and there are currently no file changes or diffs to review.

Once your Auto Run completes and the implementation is pushed, feel free to drop a comment here and we'll take a look. No merge conflicts at the moment, so you're in good shape there.

@chr1syy chr1syy marked this pull request as ready for review April 2, 2026 21:33
@chr1syy
Copy link
Copy Markdown
Contributor Author

chr1syy commented Apr 2, 2026

Symphony Contribution Summary

This pull request was created using Maestro Symphony - connecting AI-powered contributors with open source projects.

Contribution Stats

Metric Value
Input Tokens 172,876
Output Tokens 61,629
Total Tokens 234,505
Estimated Cost $15.97
Time Spent 50m 41s
Documents Processed 1
Tasks Completed 13

Powered by MaestroLearn about Symphony

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR adds a "Forced Parallel Execution" feature that lets users bypass the message queue and send input immediately while the agent is busy, triggered by a configurable modifier shortcut (⌘⇧↩ by default). It ships a one-time acknowledgment modal, a settings toggle in GeneralTab, new store fields with persistence, and an updated processInput signature that threads the forceParallel option all the way from keydown to spawn. The core bypass logic, settings store changes, and modal flow are all correct. The main area to polish before a final merge is documenting (or enforcing) the implicit Enter-only constraint on the shortcut, and removing the redundant useCallback wrapper in the modal component.

Confidence Score: 5/5

  • Safe to merge; all remaining findings are P2 style and documentation concerns with no runtime impact on the default configuration.
  • The feature works correctly end-to-end for the default and Enter-based custom shortcuts. The non-Enter shortcut limitation is a silent UX gap rather than a runtime error, and the redundant useCallback is purely cosmetic. No P0/P1 issues found.
  • src/renderer/hooks/input/useInputKeyDown.ts — shortcut detection should document or enforce the Enter-only constraint.

Important Files Changed

Filename Overview
src/renderer/hooks/input/useInputKeyDown.ts Adds forced-parallel shortcut detection inside the Enter-key branch; non-Enter custom shortcuts silently never fire and the meta/ctrl aliasing is undocumented.
src/renderer/hooks/input/useInputProcessing.ts Adds options.forceParallel bypass that short-circuits queue logic only when the settings flag is enabled; logic is correct and well-guarded.
src/renderer/components/ForcedParallelWarningModal.tsx New one-time acknowledgment modal; minor redundant useCallback wrapper on handleConfirm, otherwise clean.
src/renderer/components/Settings/tabs/GeneralTab.tsx Adds toggle UI and modal integration for Forced Parallel Execution; acknowledgment flow correctly gates the first-time warning modal.
src/renderer/stores/settingsStore.ts Adds forcedParallelExecution and forcedParallelAcknowledged fields with getters, setters, persistence, and load hydration — all consistent with existing patterns.
src/renderer/constants/shortcuts.ts Adds forcedParallelSend default shortcut (Meta+Shift+Enter); no conflicts with existing shortcuts.
src/renderer/constants/modalPriorities.ts Adds FORCED_PARALLEL_WARNING priority at 1005, correctly slotted between CONFIRM (1000) and AGENT_ERROR (1010).
src/renderer/hooks/input/useInputHandlers.ts Propagates the options?: { forceParallel?: boolean } signature change through processInput and processInputRef types consistently.
src/renderer/hooks/settings/useSettings.ts Exposes the two new settings fields and setters through the UseSettingsReturn interface; straightforward additions.
src/tests/renderer/components/ForcedParallelWarningModal.test.tsx New test file with good coverage of render states, button handlers, focus management, and layer-stack integration.
src/tests/renderer/hooks/useInputKeyDown.test.ts New tests for the forced-parallel shortcut; covers AI/terminal modes and custom shortcut config, but all custom variants tested are still Enter-based.
src/tests/renderer/hooks/useInputProcessing.test.ts Adds four tests covering force-bypass with setting enabled/disabled, AutoRun active, and absent option; all cases are correct.
src/tests/renderer/stores/settingsStore.test.ts Updates default-state test count to 68 and adds setter/default tests for both new fields; consistent with store test patterns.

Sequence Diagram

sequenceDiagram
    participant User
    participant useInputKeyDown
    participant useInputProcessing
    participant settingsStore
    participant GeneralTab
    participant ForcedParallelWarningModal

    User->>GeneralTab: Toggle Forced Parallel Execution
    alt First time (not acknowledged)
        GeneralTab->>ForcedParallelWarningModal: isOpen=true
        User->>ForcedParallelWarningModal: Click "I understand, enable it"
        ForcedParallelWarningModal->>settingsStore: setForcedParallelAcknowledged(true)
        ForcedParallelWarningModal->>settingsStore: setForcedParallelExecution(true)
    else Already acknowledged or toggling off
        GeneralTab->>settingsStore: setForcedParallelExecution(!current)
    end

    User->>useInputKeyDown: Press ⌘+⇧+Enter (forcedParallelSend shortcut)
    useInputKeyDown->>settingsStore: getState().shortcuts.forcedParallelSend
    useInputKeyDown->>useInputKeyDown: Match modifier keys
    useInputKeyDown->>useInputProcessing: processInput(undefined, { forceParallel: true })
    useInputProcessing->>settingsStore: getState().forcedParallelExecution
    alt forcedParallelExecution === true
        useInputProcessing->>useInputProcessing: forceParallel = true → shouldQueue = false
        useInputProcessing->>useInputProcessing: Spawn immediately (bypass queue)
    else forcedParallelExecution === false
        useInputProcessing->>useInputProcessing: Normal queue logic applies
    end
Loading

Comments Outside Diff (1)

  1. src/renderer/hooks/input/useInputKeyDown.ts, line 825-830 (link)

    P2 fpNeedsMeta treats meta and ctrl interchangeably — document the intent

    fpNeedsMeta is true if the shortcut keys array contains 'meta', 'ctrl', or 'command', and metaPressed is e.metaKey || e.ctrlKey. This means a shortcut configured as ['Meta', 'Shift', 'Enter'] will also fire on Ctrl+Shift+Enter (and vice versa), which is the intended cross-platform Cmd/Ctrl equivalence. However this is non-obvious — a quick comment explaining the intentional platform aliasing would prevent future maintainers from "fixing" it.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "MAESTRO: Add tests for forced parallel e..." | Re-trigger Greptile

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (3)
src/__tests__/renderer/hooks/useInputProcessing.test.ts (1)

881-927: Strengthen forced-bypass tests by asserting queue state, not only spawn calls.

Right now these cases can pass even if a queued item is still appended. Add an explicit executionQueue assertion to lock behavior.

🧪 Suggested assertion pattern
 			await act(async () => {
 				await result.current.processInput(undefined, { forceParallel: true });
 			});
 
-			// Should NOT queue — should process immediately (spawn called)
+			// Should NOT queue — should process immediately
 			expect(window.maestro.process.spawn).toHaveBeenCalled();
+			const setSessionsCall = mockSetSessions.mock.calls[0]?.[0];
+			if (typeof setSessionsCall === 'function') {
+				const updatedSessions = setSessionsCall([busySession]);
+				expect(updatedSessions[0].executionQueue.length).toBe(0);
+			}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/hooks/useInputProcessing.test.ts` around lines 881 -
927, The tests currently only assert window.maestro.process.spawn was called;
also assert the queue state to ensure no queued item was appended when
bypassing: after calling result.current.processInput(undefined, { forceParallel:
true }) add an assertion that executionQueue (or the module's queue exposed by
useInputProcessing) did not grow — e.g. expect(executionQueue.length).toBe(0) or
the prior length — and/or assert there is no new entry for the inputValue;
update both tests that use createDeps/result.current.processInput and
window.maestro.process.spawn to include this executionQueue assertion so the
bypass behavior is fully verified.
src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx (1)

202-215: Strengthen layer-stack integration test with an Escape-path assertion.

Unmount-only verification is weak; add an Escape key interaction check so stack registration/priority regressions are caught.

🧪 Suggested enhancement
 	describe('layer stack integration', () => {
-		it('registers and unregisters without errors', () => {
+		it('registers with layer stack and handles Escape via stack close', () => {
+			const onCancel = vi.fn();
 			const { unmount } = renderWithLayerStack(
 				<ForcedParallelWarningModal
 					isOpen={true}
 					onConfirm={vi.fn()}
-					onCancel={vi.fn()}
+					onCancel={onCancel}
 					theme={testTheme}
 				/>
 			);
 
 			expect(screen.getByRole('dialog')).toBeInTheDocument();
+			fireEvent.keyDown(document, { key: 'Escape' });
+			expect(onCancel).toHaveBeenCalledTimes(1);
 			expect(() => unmount()).not.toThrow();
 		});
 	});
Based on learnings: "For modal escape key handling, register the modal with the layer stack and do not handle Escape locally. Ensure the modal priority is set correctly in the modal priorities configuration."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx` around
lines 202 - 215, The test for layer-stack integration in
ForcedParallelWarningModal currently only verifies mount/unmount; update the
test that uses renderWithLayerStack and unmount to also simulate an Escape key
press and assert the modal is closed or that the dialog is no longer in the
document (use screen.getByRole('dialog') before and after). Specifically, after
rendering ForcedParallelWarningModal (isOpen=true) and asserting the dialog
exists, fire an Escape keyboard event (via your test utils) and then assert that
the dialog is removed (or that the onCancel handler was invoked) to ensure the
modal relies on the layer stack Escape-path handling and correct priority
registration.
src/__tests__/renderer/stores/settingsStore.test.ts (1)

633-659: Add loadAllSettings hydration coverage for the new forced-parallel flags.

Defaults and setters are covered, but persisted-read behavior for these two keys isn’t validated yet.

🧪 Suggested test addition
+		it('loads forced parallel flags from persisted settings', async () => {
+			vi.mocked(window.maestro.settings.getAll).mockResolvedValue({
+				forcedParallelExecution: true,
+				forcedParallelAcknowledged: true,
+			});
+
+			await loadAllSettings();
+
+			expect(useSettingsStore.getState().forcedParallelExecution).toBe(true);
+			expect(useSettingsStore.getState().forcedParallelAcknowledged).toBe(true);
+		});
Based on learnings: "When adding settings, ensure the wrapper function calls `window.maestro.settings.set()` and the loading code in `useSettings.ts` useEffect properly retrieves and persists settings."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/stores/settingsStore.test.ts` around lines 633 - 659,
Add tests that verify loadAllSettings hydrates the new flags from persisted
storage: mock window.maestro.settings.get to return values for
'forcedParallelExecution' and 'forcedParallelAcknowledged', call
useSettingsStore.getState().loadAllSettings(), then assert that
useSettingsStore.getState().forcedParallelExecution and
forcedParallelAcknowledged match the mocked values and that
window.maestro.settings.set was invoked for those keys (to ensure the wrapper
persistence path is exercised); reference the loadAllSettings function,
useSettingsStore, and window.maestro.settings.get/set in the new assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx`:
- Around line 1-217: This file has Prettier formatting issues; run Prettier and
commit the formatted output. Run the project's Prettier config (e.g., npx
prettier --write) against
src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx,
reformatting the entire test (including imports, mock setup, test blocks like
renderWithLayerStack and the describe/it blocks around
ForcedParallelWarningModal) and then stage/commit the changes so CI's prettier
--check passes.

In `@src/__tests__/renderer/hooks/useInputKeyDown.test.ts`:
- Around line 948-970: The test's assertion is too narrow—replace the final
expect that uses not.toHaveBeenCalledWith on deps.processInput with a stricter
assertion that the mock was not called at all (e.g.,
expect(deps.processInput).not.toHaveBeenCalled() or
expect(deps.processInput).toHaveBeenCalledTimes(0)). Update the test around
useInputKeyDown, createMockDeps, result.current.handleInputKeyDown and
deps.processInput so it verifies no invocation occurred in terminal mode rather
than just not being called with the specific forceParallel argument.

In `@src/__tests__/renderer/stores/settingsStore.test.ts`:
- Around line 633-659: Prettier formatting drift detected in the tests around
the "Forced Parallel Execution" block; reformat this test file so it matches
repository Prettier rules (run Prettier and commit the changes). Specifically
reformat the test cases that call
useSettingsStore.getState().setForcedParallelExecution,
useSettingsStore.getState().setForcedParallelAcknowledged, and the expectations
for forcedParallelExecution/forcedParallelAcknowledged so spacing/line breaks
match project style, then run npx prettier --write . (or your repo format
command) and commit the modified file.

In `@src/renderer/components/Settings/tabs/GeneralTab.tsx`:
- Around line 752-754: The code dereferences shortcuts.forcedParallelSend
directly which prevents the fallback from ever running and crashes when
shortcuts is undefined; update the rendering to guard access to shortcuts (e.g.,
check shortcuts && shortcuts.forcedParallelSend or use optional chaining like
shortcuts?.forcedParallelSend) before passing keys into formatShortcutKeys, and
apply the same defensive check for the similar occurrences around lines
referencing formatShortcutKeys(shortcuts.forcedParallelSend.keys) and the block
at the other occurrence (the chunk covering the other 787-789 usage) so the
fallback strings are used when shortcuts or forcedParallelSend are missing.

In `@src/renderer/hooks/input/useInputHandlers.ts`:
- Around line 103-106: The updated TypeScript typing block for the input
handlers (symbols processInput and processInputRef) has formatting drift; run
the project's Prettier formatter (e.g., prettier --write) on
src/renderer/hooks/input/useInputHandlers.ts (including the region around the
processInput/processInputRef declarations) to fix whitespace/linebreaks and then
commit the formatted file so CI passes.

In `@src/renderer/hooks/input/useInputKeyDown.ts`:
- Around line 240-263: The forced-parallel send shortcut handler (inside the
useInputKeyDown branch that checks activeSession?.inputMode !== 'terminal')
currently triggers unconditionally when the shortcut keys match; update it to
first check the user setting that enables the feature
(settings.forcedParallelExecution or similar) before processing the shortcut. In
practice, guard the block that reads settings.shortcuts.forcedParallelSend and
calls processInput(undefined, { forceParallel: true }) with a condition that the
forcedParallelExecution flag is truthy, so the shortcut is ignored until the
user enables it; keep the existing key-matching logic and call site
(processInput) unchanged.

In `@src/renderer/hooks/input/useInputProcessing.ts`:
- Around line 405-419: When forceParallel can bypass the queue (forceParallel in
this hook), ensure each send gets a unique per-send process key so concurrent
forced sends from the same AI tab don't reuse the same session key; when
constructing the sessionId (currently `${activeSession.id}-ai-${tabId}` used
later in spawn/bookkeeping), append a per-send unique token (e.g., timestamp,
incrementing counter, or generated id) only for forced-parallel sends and
propagate that altered sessionId into the process spawn/bookkeeping paths
(functions that consume sessionId like the batch spawn/process-entry points) so
each forced send is distinguishable.

---

Nitpick comments:
In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx`:
- Around line 202-215: The test for layer-stack integration in
ForcedParallelWarningModal currently only verifies mount/unmount; update the
test that uses renderWithLayerStack and unmount to also simulate an Escape key
press and assert the modal is closed or that the dialog is no longer in the
document (use screen.getByRole('dialog') before and after). Specifically, after
rendering ForcedParallelWarningModal (isOpen=true) and asserting the dialog
exists, fire an Escape keyboard event (via your test utils) and then assert that
the dialog is removed (or that the onCancel handler was invoked) to ensure the
modal relies on the layer stack Escape-path handling and correct priority
registration.

In `@src/__tests__/renderer/hooks/useInputProcessing.test.ts`:
- Around line 881-927: The tests currently only assert
window.maestro.process.spawn was called; also assert the queue state to ensure
no queued item was appended when bypassing: after calling
result.current.processInput(undefined, { forceParallel: true }) add an assertion
that executionQueue (or the module's queue exposed by useInputProcessing) did
not grow — e.g. expect(executionQueue.length).toBe(0) or the prior length —
and/or assert there is no new entry for the inputValue; update both tests that
use createDeps/result.current.processInput and window.maestro.process.spawn to
include this executionQueue assertion so the bypass behavior is fully verified.

In `@src/__tests__/renderer/stores/settingsStore.test.ts`:
- Around line 633-659: Add tests that verify loadAllSettings hydrates the new
flags from persisted storage: mock window.maestro.settings.get to return values
for 'forcedParallelExecution' and 'forcedParallelAcknowledged', call
useSettingsStore.getState().loadAllSettings(), then assert that
useSettingsStore.getState().forcedParallelExecution and
forcedParallelAcknowledged match the mocked values and that
window.maestro.settings.set was invoked for those keys (to ensure the wrapper
persistence path is exercised); reference the loadAllSettings function,
useSettingsStore, and window.maestro.settings.get/set in the new assertions.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30f68095-c97d-4adb-aef6-7b408b86f045

📥 Commits

Reviewing files that changed from the base of the PR and between 6e467f4 and 3660bee.

📒 Files selected for processing (13)
  • src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx
  • src/__tests__/renderer/hooks/useInputKeyDown.test.ts
  • src/__tests__/renderer/hooks/useInputProcessing.test.ts
  • src/__tests__/renderer/stores/settingsStore.test.ts
  • src/renderer/components/ForcedParallelWarningModal.tsx
  • src/renderer/components/Settings/tabs/GeneralTab.tsx
  • src/renderer/constants/modalPriorities.ts
  • src/renderer/constants/shortcuts.ts
  • src/renderer/hooks/input/useInputHandlers.ts
  • src/renderer/hooks/input/useInputKeyDown.ts
  • src/renderer/hooks/input/useInputProcessing.ts
  • src/renderer/hooks/settings/useSettings.ts
  • src/renderer/stores/settingsStore.ts

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/__tests__/renderer/stores/settingsStore.test.ts (1)

125-125: Field count should stay accurate as the store evolves.

Consider whether maintaining a hard-coded field count ("68 fields") in the test name adds value. If future settings are added and this number becomes stale, it could cause confusion. A generic description like "has correct default values for all fields" might be more maintainable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/stores/settingsStore.test.ts` at line 125, Rename the
test description that currently reads 'has correct default values for all 68
fields' to a generic, maintainable string like 'has correct default values for
all fields' in the test defined in
src/__tests__/renderer/stores/settingsStore.test.ts so the test name does not
contain a hard-coded field count; update the test title in the it(...) call to
remove the "68" and preserve the test body and any assertions (e.g., the test
function referencing settingsStore/defaults) unchanged.
src/renderer/components/Settings/tabs/GeneralTab.tsx (1)

734-799: Forced Parallel Execution UI section is well-implemented.

The new settings card includes:

  • Clear labeling and shortcut badge display
  • Accessible toggle switch with proper role="switch" and aria-checked
  • Warning message with AlertTriangle icon styled appropriately
  • Opacity reduction when disabled for visual feedback

One minor observation: the section's opacity is set to 0.7 when disabled (line 740), which may make the toggle itself harder to see. Consider keeping the toggle at full opacity while dimming only the description text for better usability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/Settings/tabs/GeneralTab.tsx` around lines 734 - 799,
The container div currently dims the entire card using opacity tied to
forcedParallelExecution, making the toggle hard to see; instead, remove or set
full opacity on the outer div and only reduce opacity for descriptive elements
(e.g., the description div using class "flex items-start..." and the shortcut
badge span) when forcedParallelExecution is false; update the JSX around the
outer container that reads opacity: forcedParallelExecution ? 1 : 0.7 to keep
the toggle button (used by handleForcedParallelToggle) fully opaque while
applying the reduced opacity to the descriptive text and shortcut display (the
spans that render shortcuts via formatShortcutKeys and the warning text).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/__tests__/renderer/stores/settingsStore.test.ts`:
- Line 125: Rename the test description that currently reads 'has correct
default values for all 68 fields' to a generic, maintainable string like 'has
correct default values for all fields' in the test defined in
src/__tests__/renderer/stores/settingsStore.test.ts so the test name does not
contain a hard-coded field count; update the test title in the it(...) call to
remove the "68" and preserve the test body and any assertions (e.g., the test
function referencing settingsStore/defaults) unchanged.

In `@src/renderer/components/Settings/tabs/GeneralTab.tsx`:
- Around line 734-799: The container div currently dims the entire card using
opacity tied to forcedParallelExecution, making the toggle hard to see; instead,
remove or set full opacity on the outer div and only reduce opacity for
descriptive elements (e.g., the description div using class "flex
items-start..." and the shortcut badge span) when forcedParallelExecution is
false; update the JSX around the outer container that reads opacity:
forcedParallelExecution ? 1 : 0.7 to keep the toggle button (used by
handleForcedParallelToggle) fully opaque while applying the reduced opacity to
the descriptive text and shortcut display (the spans that render shortcuts via
formatShortcutKeys and the warning text).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dd183f3e-7216-49af-8d17-afbad293ed66

📥 Commits

Reviewing files that changed from the base of the PR and between 3660bee and b12f2c5.

📒 Files selected for processing (8)
  • src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx
  • src/__tests__/renderer/hooks/useInputKeyDown.test.ts
  • src/__tests__/renderer/stores/settingsStore.test.ts
  • src/renderer/components/ForcedParallelWarningModal.tsx
  • src/renderer/components/Settings/tabs/GeneralTab.tsx
  • src/renderer/hooks/input/useInputHandlers.ts
  • src/renderer/hooks/input/useInputKeyDown.ts
  • src/renderer/hooks/input/useInputProcessing.ts
✅ Files skipped from review due to trivial changes (1)
  • src/tests/renderer/hooks/useInputKeyDown.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/hooks/input/useInputKeyDown.ts
  • src/renderer/hooks/input/useInputProcessing.ts

@chr1syy chr1syy changed the title [WIP] Symphony: Forced Parallel Execution: bypass message queue with modifier shortcut (#702) Symphony: Forced Parallel Execution: bypass message queue with modifier shortcut (#702) Apr 3, 2026
@chr1syy chr1syy changed the base branch from main to rc April 4, 2026 23:17
chr1syy and others added 7 commits April 5, 2026 01:17
…priority

Phase 1 of forced parallel execution feature: adds forcedParallelSend
shortcut definition, FORCED_PARALLEL_WARNING modal priority, and
forcedParallelExecution/forcedParallelAcknowledged settings with
persistence to the Zustand settings store.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creates the warning modal shown when users first enable Forced Parallel
Execution. Uses the existing Modal/ModalFooter pattern with layer stack
registration at FORCED_PARALLEL_WARNING priority. Includes AlertTriangle
icon with warning accent, explanatory copy about parallel write risks,
and Cancel / "I understand, enable it" action buttons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive test coverage for the forced parallel execution feature:

- useInputProcessing: 4 tests verifying forceParallel queue bypass logic
  (enabled+busy, enabled+autorun, disabled+busy, absent+busy)
- useInputKeyDown: 4 tests for Cmd/Ctrl+Shift+Enter shortcut detection
  (AI mode, terminal mode exclusion, custom shortcut support)
- settingsStore: 4 tests for forcedParallelExecution/Acknowledged defaults
  and setter persistence. Updated resetStore() and field count (66→68)
- ForcedParallelWarningModal: 10 tests covering rendering, open/closed state,
  button handlers, focus management, and layer stack integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lel execution

- Gate forced parallel shortcut behind forcedParallelExecution setting
- Add optional chaining for shortcuts in GeneralTab to prevent TypeError
- Append unique suffix to targetSessionId for forced-parallel sends to prevent process key collisions
- Remove redundant useCallback wrapper in ForcedParallelWarningModal
- Document Enter-only constraint for forced parallel shortcut detection
- Tighten terminal-mode test assertion and add test for disabled feature state
- Apply Prettier formatting to all affected files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chr1syy chr1syy force-pushed the symphony/issue-702-mnhxkuso branch from b12f2c5 to 6299d4a Compare April 4, 2026 23:25
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/__tests__/renderer/hooks/useInputKeyDown.test.ts (1)

996-998: ⚠️ Potential issue | 🟡 Minor

Strengthen negative assertions to prevent false positives.

At Line 997 and Line 1021, not.toHaveBeenCalledWith(...) still passes if processInput is called with different arguments. For these checks, assert zero calls at that checkpoint.

Suggested assertion hardening
@@
-		// Should NOT call processInput with forceParallel when feature is disabled
-		expect(deps.processInput).not.toHaveBeenCalledWith(undefined, { forceParallel: true });
+		// Should NOT call processInput at all when feature is disabled
+		expect(deps.processInput).not.toHaveBeenCalled();
@@
 		act(() => {
 			result.current.handleInputKeyDown(e1);
 		});
-		expect(deps.processInput).not.toHaveBeenCalledWith(undefined, { forceParallel: true });
+		expect(deps.processInput).toHaveBeenCalledTimes(0);
@@
 		act(() => {
 			result.current.handleInputKeyDown(e2);
 		});
+		expect(deps.processInput).toHaveBeenCalledTimes(1);
 		expect(deps.processInput).toHaveBeenCalledWith(undefined, { forceParallel: true });
#!/bin/bash
# Verify no narrow negative matcher remains for forced-parallel assertions
rg -n "not\.toHaveBeenCalledWith\(undefined, \{ forceParallel: true \}\)" src/__tests__/renderer/hooks/useInputKeyDown.test.ts

Expected result after fix: no matches.

Also applies to: 1016-1022

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/hooks/useInputKeyDown.test.ts` around lines 996 - 998,
The negative assertions using not.toHaveBeenCalledWith(undefined, {
forceParallel: true }) are weak and can yield false positives; update the two
checkpoints in the useInputKeyDown.test (the tests that verify the
feature-disabled and related scenarios) to assert that deps.processInput was not
called at all by replacing those not.toHaveBeenCalledWith(...) checks with
expect(deps.processInput).not.toHaveBeenCalled() so the test fails if
processInput was invoked with any arguments (references: deps.processInput and
the failing test cases in useInputKeyDown.test).
🧹 Nitpick comments (2)
src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx (2)

174-178: Add defensive assertion before clicking close button.

The non-null assertion closeButton! could mask a test failure if the DOM structure changes. Assert the button exists first for clearer failure messages.

🔧 Suggested improvement
-			const closeButton = screen.getByTestId('x-icon').closest('button');
-			fireEvent.click(closeButton!);
+			const closeButton = screen.getByTestId('x-icon').closest('button');
+			expect(closeButton).toBeInTheDocument();
+			fireEvent.click(closeButton!);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx` around
lines 174 - 178, Add a defensive assertion that the resolved closeButton exists
before calling fireEvent.click to avoid masking DOM regressions; after computing
closeButton via screen.getByTestId('x-icon').closest('button') (the closeButton
variable in the ForcedParallelWarningModal.test), assert it is present (e.g.,
expect(closeButton).not.toBeNull() or toBeInTheDocument()) and then call
fireEvent.click(closeButton) and the existing
expect(onCancel).toHaveBeenCalledTimes(1).

181-198: Consider adding Escape key dismissal test.

The focus management test is good. However, modals should typically support Escape key to close. Based on learnings, this modal should register with the layer stack for Escape handling. Consider adding a test to verify pressing Escape calls onCancel.

🔧 Example test for Escape key
it('calls onCancel when Escape key is pressed', () => {
	const onCancel = vi.fn();
	renderWithLayerStack(
		<ForcedParallelWarningModal
			isOpen={true}
			onConfirm={vi.fn()}
			onCancel={onCancel}
			theme={testTheme}
		/>
	);

	fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' });
	expect(onCancel).toHaveBeenCalledTimes(1);
});

Based on learnings: "For modal escape not working, register with layer stack (don't handle Escape locally) and check priority is set correctly."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx` around
lines 181 - 198, Add a test that verifies the ForcedParallelWarningModal calls
its onCancel prop when Escape is pressed: render the modal using
renderWithLayerStack with isOpen={true}, pass a vi.fn() for onCancel, then
simulate pressing Escape (e.g., fireEvent.keyDown on the dialog element returned
by screen.getByRole('dialog')) and assert onCancel was called once; ensure the
test uses the same helpers (renderWithLayerStack, testTheme) and targets the
modal component ForcedParallelWarningModal so it also verifies the modal is
registered with the layer stack for Escape handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/__tests__/renderer/hooks/useInputKeyDown.test.ts`:
- Around line 996-998: The negative assertions using
not.toHaveBeenCalledWith(undefined, { forceParallel: true }) are weak and can
yield false positives; update the two checkpoints in the useInputKeyDown.test
(the tests that verify the feature-disabled and related scenarios) to assert
that deps.processInput was not called at all by replacing those
not.toHaveBeenCalledWith(...) checks with
expect(deps.processInput).not.toHaveBeenCalled() so the test fails if
processInput was invoked with any arguments (references: deps.processInput and
the failing test cases in useInputKeyDown.test).

---

Nitpick comments:
In `@src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx`:
- Around line 174-178: Add a defensive assertion that the resolved closeButton
exists before calling fireEvent.click to avoid masking DOM regressions; after
computing closeButton via screen.getByTestId('x-icon').closest('button') (the
closeButton variable in the ForcedParallelWarningModal.test), assert it is
present (e.g., expect(closeButton).not.toBeNull() or toBeInTheDocument()) and
then call fireEvent.click(closeButton) and the existing
expect(onCancel).toHaveBeenCalledTimes(1).
- Around line 181-198: Add a test that verifies the ForcedParallelWarningModal
calls its onCancel prop when Escape is pressed: render the modal using
renderWithLayerStack with isOpen={true}, pass a vi.fn() for onCancel, then
simulate pressing Escape (e.g., fireEvent.keyDown on the dialog element returned
by screen.getByRole('dialog')) and assert onCancel was called once; ensure the
test uses the same helpers (renderWithLayerStack, testTheme) and targets the
modal component ForcedParallelWarningModal so it also verifies the modal is
registered with the layer stack for Escape handling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4f78fff-ce7c-481f-b84d-98250955be35

📥 Commits

Reviewing files that changed from the base of the PR and between b12f2c5 and 6299d4a.

📒 Files selected for processing (2)
  • src/__tests__/renderer/components/ForcedParallelWarningModal.test.tsx
  • src/__tests__/renderer/hooks/useInputKeyDown.test.ts

@pedramamini pedramamini merged commit 2a5de14 into rc Apr 4, 2026
4 checks passed
@pedramamini pedramamini deleted the symphony/issue-702-mnhxkuso branch April 4, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forced Parallel Execution: bypass message queue with modifier shortcut

2 participants