Skip to content

Limit number of processes that can be spawned when fetching manifests - #247

Merged
OCopping merged 4 commits into
mainfrom
limit-processes
Jul 8, 2026
Merged

OCopping merged 4 commits into
mainfrom
limit-processes

Conversation

@OCopping

@OCopping OCopping commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

I noticed when there are a large number of services (e.g. on i19) and the workstation has limited resources, the command can crash as it can't spawn more subprocesses

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when loading application manifests from Argo CD.
    • Reduced failures during large or concurrent manifest retrieval by throttling parallel processing.
    • Enhanced manifest parsing to handle multi-document output more consistently by splitting and parsing each segment individually.

I noticed when there are a large number of services (e.g. on i19) and
the workstation has limited resources, the command can crash as it can't
spawn more subprocesses
@OCopping
OCopping requested a review from gilesknap June 26, 2026 08:49
@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@OCopping, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9d36f5d-4409-4eba-9dd3-bb122580f15b

📥 Commits

Reviewing files that changed from the base of the PR and between 86f5906 and ec8fe7a.

📒 Files selected for processing (1)
  • src/edge_containers_cli/cmds/argo_commands.py
📝 Walkthrough

Walkthrough

The PR adds a semaphore to limit concurrent manifest extraction, updates _extract_app_manifests to run argocd app manifests under that limit, and parses each manifest document separately.

Changes

Argo manifest extraction

Layer / File(s) Summary
Semaphore and manifest parsing
src/edge_containers_cli/cmds/argo_commands.py
Adds a semaphore parameter to _extract_app_manifests, wraps the command execution with it, splits manifest output on ---, and passes a CPU-sized semaphore from _get_service_data into each task.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped with care through manifest clover,
Kept my paws in line, then parsed it over.
Split each scroll where the dash-lines roam,
And brought each manifest safely home.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 title clearly matches the main change: throttling concurrent manifest fetching to limit spawned processes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch limit-processes

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/edge_containers_cli/cmds/argo_commands.py`:
- Around line 305-307: The manifest parsing in the resource loop is brittle
because splitting on raw document separators can drop the first YAML document
and mis-handle `---` inside content. Update the parsing in the `argo` command’s
resource-processing path to use YAML stream/document parsing instead of
`mani_resp.split("---")[1:]`, and ensure each parsed document is validated as a
dictionary before any `.get(...)` access in the `manifest` handling logic.
- Line 32: The module-level asyncio.Semaphore in argo_commands.py should not be
shared across fresh event loops created by _run_async(), since it can become
bound to the first loop and fail on later calls. Move semaphore creation into
_get_service_data(), pass the semaphore through to _extract_app_manifests(), and
keep the concurrency control local to the event loop used for that invocation.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: d10333f5-f26c-425a-ad8f-5947e04a46db

📥 Commits

Reviewing files that changed from the base of the PR and between 9de85dd and 9dc1672.

📒 Files selected for processing (1)
  • src/edge_containers_cli/cmds/argo_commands.py

@gilesknap gilesknap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @OCopping this looks like progress. Thanks for this.

Please take a look at the coderabbit comments - they look legit.

OCopping and others added 2 commits June 29, 2026 08:09
Line 305 skips the first segment, so valid YAML output without a leading document marker drops the first manifest. Raw splitting can also break on --- inside scalar content, and Line 307 lets truthy non-dict documents reach .get(...).

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/edge_containers_cli/cmds/argo_commands.py`:
- Around line 345-348: The subprocess concurrency limit in argo_commands.py is
still unbounded on large machines because the Semaphore in the cpu-based setup
uses cpus * 5 directly. Keep the existing cpu_count() scaling in the same
initialization block, but add an upper cap to the computed limit so the
semaphore cannot permit excessive concurrent argocd processes; use the existing
cpus and sem symbols to locate and adjust the limit calculation.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: e57df95b-c4fd-4037-8c4f-41edc70bcaa3

📥 Commits

Reviewing files that changed from the base of the PR and between 9dc1672 and 86f5906.

📒 Files selected for processing (1)
  • src/edge_containers_cli/cmds/argo_commands.py

cpus * 5 can still permit hundreds of concurrent argocd processes on high-core machines, which undermines the crash-prevention goal. Keep the CPU scaling, but cap it.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@OCopping
OCopping requested a review from gilesknap June 29, 2026 08:38
@OCopping

Copy link
Copy Markdown
Contributor Author

@coderabbitai help

@OCopping

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue 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 rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @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 generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OCopping
OCopping requested review from gilesknap and removed request for gilesknap June 30, 2026 08:08

@gilesknap gilesknap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice.

@OCopping
OCopping merged commit d4ed8bf into main Jul 8, 2026
10 checks passed
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.

2 participants