Skip to content

fix(redteam): respect maxConcurrency from webui #4605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

mldangelo
Copy link
Member

No description provided.

Copy link
Contributor

use-tusk bot commented Jun 23, 2025

⏩ No tests generated (0d9d326) View output ↗

View output in GitHub ↗

Tip

New to Tusk? Learn more here.

View check history

Commit Status Output Created (UTC)
29ad276 ⏩ Skipped due to new commit on branch Output Jun 23, 2025 9:20PM
0fca7bb ⏩ No tests generated Output Jun 23, 2025 9:23PM
8998369 ⏩ Skipped due to new commit on branch Output Jun 23, 2025 9:42PM
0d9d326 ⏩ No tests generated Output Jun 23, 2025 9:42PM
↳ Retry ⏩ No tests generated Output Jun 24, 2025 10:50PM

Copy link
Contributor

gru-agent bot commented Jun 23, 2025

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 0fca7bb ✅ Finished

History Assignment

Files

File Pull Request
src/app/src/pages/redteam/setup/hooks/useRedTeamConfig.ts ❌ Failed (The test job failed due to a custom zustand mock implementation error. The error message '(0 , create)(...) is not a function' indicates that the mocked 'create' function from 'zustand' does not return a function as expected by the source code. This is an issue with the test/mock setup, not a bug in the source code itself. The test file and source file both compile and lint correctly, and the failure is outside the test file's scope.)

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@mldangelo mldangelo force-pushed the fix/redteam-maxconcurrency-webui branch from 29ad276 to 0fca7bb Compare June 23, 2025 21:23
Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

📝 Walkthrough

Walkthrough

The changes introduce a new optional numeric property, maxConcurrency, across several configuration interfaces and objects related to the redteam setup. The Config and SavedRedteamConfig interfaces are updated to include this property. Default values for maxConcurrency are set in configuration defaults and example configurations. The component responsible for reviewing and updating configuration now synchronizes its local state with the external maxConcurrency value and updates the global configuration when the user modifies this field. When loading configurations from a YAML file, maxConcurrency is extracted and included in the mapped configuration. The unified configuration output conditionally includes maxConcurrency if present in the input.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-23T21_25_52_644Z-debug-0.log


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70ec3b9 and 0fca7bb.

📒 Files selected for processing (6)
  • src/app/src/pages/redteam/setup/components/Review.tsx (3 hunks)
  • src/app/src/pages/redteam/setup/hooks/useRedTeamConfig.ts (2 hunks)
  • src/app/src/pages/redteam/setup/page.tsx (1 hunks)
  • src/app/src/pages/redteam/setup/types.ts (1 hunks)
  • src/redteam/sharedFrontend.ts (1 hunks)
  • src/redteam/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`src/**/*`: Place core logic files inside the src/ directory.

src/**/*: Place core logic files inside the src/ directory.

  • src/redteam/types.ts
  • src/app/src/pages/redteam/setup/types.ts
  • src/redteam/sharedFrontend.ts
  • src/app/src/pages/redteam/setup/page.tsx
  • src/app/src/pages/redteam/setup/hooks/useRedTeamConfig.ts
  • src/app/src/pages/redteam/setup/components/Review.tsx
`src/app/**/*`: src/app is included as a workspace.

src/app/**/*: src/app is included as a workspace.

  • src/app/src/pages/redteam/setup/types.ts
  • src/app/src/pages/redteam/setup/page.tsx
  • src/app/src/pages/redteam/setup/hooks/useRedTeamConfig.ts
  • src/app/src/pages/redteam/setup/components/Review.tsx
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Tusk Test Runner
  • GitHub Check: Redteam
  • GitHub Check: Redteam Custom Enterprise Server
  • GitHub Check: Test on Node 24.x and ubuntu-latest
  • GitHub Check: Test on Node 18.x and windows-latest
  • GitHub Check: Build Docs
  • GitHub Check: Test on Node 20.x and windows-latest
  • GitHub Check: Style Check
  • GitHub Check: Build on Node 24.x
  • GitHub Check: Cursor BugBot
  • GitHub Check: Tusk Tester
🔇 Additional comments (9)
src/app/src/pages/redteam/setup/types.ts (1)

36-36: LGTM! Clean interface extension.

The addition of the optional maxConcurrency property is well-placed and properly typed.

src/redteam/types.ts (1)

186-186: LGTM! Consistent interface extension.

The maxConcurrency property addition maintains consistency with the Config interface and follows the same optional pattern.

src/app/src/pages/redteam/setup/hooks/useRedTeamConfig.ts (2)

64-64: LGTM! Reasonable default value.

The maxConcurrency: 4 default is well-positioned and provides a sensible concurrency limit.


272-272: LGTM! Consistent with default configuration.

The example configuration correctly includes the same maxConcurrency default as the main config.

src/app/src/pages/redteam/setup/page.tsx (1)

475-476: LGTM! Proper YAML parsing with consistent defaults.

The extraction of numTests and maxConcurrency from the YAML configuration follows the established pattern and uses consistent default values.

src/redteam/sharedFrontend.ts (1)

57-57: Verify handling of maxConcurrency: 0 edge case.

The conditional spread pattern is consistent with the existing code style. However, the truthy check would exclude maxConcurrency: 0, which might be a valid value for unlimited concurrency or disabling the feature entirely.

Consider whether maxConcurrency: 0 should be a valid configuration. If so, update the condition:

-      ...(config.maxConcurrency && { maxConcurrency: config.maxConcurrency }),
+      ...(config.maxConcurrency !== undefined && { maxConcurrency: config.maxConcurrency }),
src/app/src/pages/redteam/setup/components/Review.tsx (3)

89-92: Good implementation of state synchronization.

The useEffect correctly synchronizes the local maxConcurrency state with external config changes, ensuring the component stays in sync when the configuration is updated from other sources.


880-880: Proper global config update integration.

The addition of updateConfig('maxConcurrency', Number(value)) correctly propagates user input changes to the global configuration, completing the bidirectional sync between local state and global config. The type conversion from string (input field) to number (config) is handled appropriately.


69-69: Default value changed from 1 to 4 - verify this is intentional.

The initialization now derives from config.maxConcurrency with a fallback to 4, replacing the previous hardcoded default of 1. This behavioral change should be intentional and aligns with making the component respect the webui configuration.

#!/bin/bash
# Description: Verify the default maxConcurrency value is consistently set to 4 across the codebase
# Expected: Find other references to maxConcurrency defaults

echo "Searching for maxConcurrency default values..."
rg -A 2 -B 2 "maxConcurrency.*[^a-zA-Z0-9]4[^a-zA-Z0-9]"

echo -e "\nSearching for maxConcurrency property definitions..."
ast-grep --pattern 'maxConcurrency: $_'
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

cursor[bot]

This comment was marked as outdated.

gru-agent bot added 2 commits June 23, 2025 14:42
Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Concurrency Validation Mismatch

The maxConcurrency input field's JavaScript validation (Number(value) >= 0) is inconsistent with its HTML min=1 attribute. Allowing a maxConcurrency of 0 is illogical as it would prevent any operations from running. The JavaScript validation should be updated to Number(value) >= 1 to align with the HTML constraint and ensure valid concurrency values.

src/app/src/pages/redteam/setup/components/Review.tsx#L875-L885

onChange={(e) => {
const value = e.target.value;
// Ensure non-negative numbers only
if (!Number.isNaN(Number(value)) && Number(value) >= 0) {
setMaxConcurrency(value);
updateConfig('maxConcurrency', Number(value));
// If concurrency > 1, disable delay by setting it to 0
if (Number(value) > 1) {
setDelayMs('0');
}
}

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@mldangelo mldangelo merged commit 2be1893 into main Jun 25, 2025
38 checks passed
@mldangelo mldangelo deleted the fix/redteam-maxconcurrency-webui branch June 25, 2025 23:07
mldangelo added a commit that referenced this pull request Jun 30, 2025
Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
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.

1 participant