Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
…currency group Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done! Changes made in commit 65abddd:
New Structure: engine:
id: claude
max-concurrency: 5Generated Concurrency: concurrency:
group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number }}-claude-${{ github.run_id % 5 }}"The engine ID ( |
|
@copilot the key can only use runid and engine id as it is a global lock accross all workflows and refs for the agent. |
|
@copilot this engine-specific concurrency element should be added to the agentic job |
…obal lock Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in commit 47a2e8a. The concurrency group now uses only engine ID and run_id slot for a true global lock: concurrency:
group: "{engine-id}-${{ github.run_id % max-concurrency }}"Example output: concurrency:
group: "claude-${{ github.run_id % 5 }}"This creates a global lock across all workflows and refs for each engine, as requested. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit [hash]. The concurrency configuration is now added to the agentic job instead of the workflow level. Before (workflow level): name: "Workflow"
concurrency:
group: "claude-${{ github.run_id % 5 }}"
jobs:
agent:
...After (job level): name: "Workflow"
jobs:
agent:
runs-on: ubuntu-latest
concurrency:
group: "claude-${{ github.run_id % 5 }}"
steps:
... |
| actions: read | ||
| contents: read | ||
| concurrency: | ||
| group: "copilot-${{ github.run_id % 3 }}" |
There was a problem hiding this comment.
Done in commit [hash]. All concurrency groups now have the "gh-aw-" prefix.
Before:
concurrency:
group: "copilot-${{ github.run_id % 3 }}"After:
concurrency:
group: "gh-aw-copilot-${{ github.run_id % 3 }}"# Conflicts: # .github/workflows/duplicate-code-detector.lock.yml
|
|
||
| - **Default**: 3 concurrent slots (when not specified or set to 0) | ||
| - **Minimum**: 1 (sequential execution) | ||
| - **No maximum**: Set to any positive integer based on your needs |
There was a problem hiding this comment.
Done in commit fe60ca7. Documentation updated to include -1 option:
- Added "Disabled: -1 (no agent concurrency limiting)" to default values
- Added example showing
max-concurrency: -1 - Added explanation in Global Lock Behavior section
|
|
||
| This ensures workflows operating on different issues, PRs, or branches can run concurrently without interfering with each other. | ||
|
|
||
| ### Job-Level Concurrency (Max-Concurrency) |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…level" to "agent concurrency" Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot merge main, format, lint, recompile |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…er-max-concurrency
|
@copilot add |
|
@copilot format,lint,fix tests |
…er-max-concurrency
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Overview
Adds a new
max-concurrencyoption under theengineconfiguration to control how many agentic jobs can run concurrently across all workflows and refs using that engine. This provides cost control, resource management, and engine isolation for AI-powered workflows through a global concurrency lock applied at the agent job level only.Implementation
The feature uses GitHub Actions dual-level concurrency strategy with slot-based distribution and engine ID isolation:
This generates concurrency configuration at both workflow and agent levels with different strategies:
How It Works
max-turnsunder theengine:sectiongithub.run_id % max-concurrencyto assign each run to a slot (0 to max-concurrency-1)gh-aw-prefixExample Usage
Benefits
✅ Global Cost Control: Prevents runaway costs across all workflows for an engine
✅ Repository-Wide Limiting: Single concurrency limit applies to all workflows and refs via agent concurrency lock
✅ Context Isolation Preserved: Workflow-level concurrency unchanged, allowing different issues/PRs/branches to run concurrently
✅ Dual-Level Strategy: Workflow-level for context isolation, agent concurrency for global AI execution limiting
✅ Standardized Naming:
gh-aw-prefix for all concurrency groups ensures consistent identification✅ Simple and Predictable: Agent concurrency uses only engine ID and slot for global control
✅ Engine Isolation: Different engines can run concurrently without interfering
✅ Per-Engine Configuration: Each engine can have its own concurrency limits
✅ Flexible: Easy to adjust based on repository needs and budget, including ability to disable with -1
Changes Made
MaxConcurrencyfield toEngineConfigstructConcurrencyfield toJobstruct for agent concurrency supportExtractEngineConfig()to parsemax-concurrencyfrom engine configurationGenerateJobConcurrencyConfig(): New function for agent concurrency with global lock pattern andgh-aw-prefixGenerateConcurrencyConfig(): Maintains original workflow-level concurrency behavior (context-specific keys)buildMainJob()to set agent concurrency on the agentic job usingGenerateJobConcurrencyConfig()max-concurrencyunder engine configuration (minimum: -1)docs/src/content/docs/reference/concurrency.mdwith complete coverage of dual-level strategy, configuration, slot distribution, global locks, engine isolation, disable option, best practices, and troubleshootingTestGenerateConcurrencyConfig()tests workflow-level (context-specific),TestGenerateJobConcurrencyConfig()tests agent concurrency (max-concurrency)Documentation
A comprehensive dedicated documentation page has been added at
/docs/src/content/docs/reference/concurrency.mdcovering:Testing
All unit tests pass, including:
Fixes the requirement to support max-concurrency control with global engine-level limiting at the agent level while preserving original workflow-level concurrency behavior, with ability to disable via -1.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.