Skip to content

feat: increase default agent memory limit to 6GB and enable swap#1360

Open
Copilot wants to merge 2 commits intomainfrom
copilot/increase-agent-memory-limit
Open

feat: increase default agent memory limit to 6GB and enable swap#1360
Copilot wants to merge 2 commits intomainfrom
copilot/increase-agent-memory-limit

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

Agent container defaults to 2GB with no swap, causing OOM kills (exit 137) on GitHub Actions runners with 7GB RAM. Four repos consistently fail: prettier, k9s, stern, cowboy.

Changes

  • Default mem_limit: 2g6g (~85% of 7GB runner RAM)
  • Default memswap_limit: 2g-1 (unlimited swap as kernel pressure valve instead of immediate OOM kill)
  • Custom --memory-limit still disables swap (memswap_limit = mem_limit), preserving existing behavior for explicit configs
  • Updated CLI help text, JSDoc, and test expectations
// src/docker-manager.ts
mem_limit: config.memoryLimit || '6g',
memswap_limit: config.memoryLimit ? config.memoryLimit : '-1',

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Increase default agent container memory limit from 2GB to 6GB feat: increase default agent memory limit to 6GB and enable swap Mar 18, 2026
Copilot AI requested a review from Mossaka March 18, 2026 19:27
@Mossaka Mossaka marked this pull request as ready for review March 18, 2026 20:36
Copilot AI review requested due to automatic review settings March 18, 2026 20:36
@github-actions
Copy link
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 86.05% 86.16% 📈 +0.11%
Statements 85.97% 86.09% 📈 +0.12%
Functions 86.13% 86.13% ➡️ +0.00%
Branches 79.21% 79.28% 📈 +0.07%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 87.4% → 87.9% (+0.49%) 86.8% → 87.2% (+0.46%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR increases the agent container’s default memory limit and changes swap configuration to reduce OOM-kills (exit 137) when running heavier workloads on GitHub Actions runners.

Changes:

  • Increase default agent mem_limit from 2g to 6g.
  • Change default agent memswap_limit from 2g (no swap) to -1 (unlimited swap), while keeping “no swap” when an explicit --memory-limit is provided.
  • Update CLI help text, JSDoc defaults, and unit test expectations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/types.ts Updates documented default for WrapperConfig.memoryLimit to 6g.
src/docker-manager.ts Adjusts generated docker-compose resource limits (memory + swap behavior).
src/docker-manager.test.ts Updates expected defaults for agent mem_limit/memswap_limit.
src/cli.ts Updates --memory-limit help text and default value.
Comments suppressed due to low confidence (1)

src/types.ts:322

  • The WrapperConfig.memoryLimit docs now say the default is 6g, but the swap behavior changed as well (default swap enabled/unlimited vs swap disabled when the user explicitly sets --memory-limit). It would help to document this coupling here (or reference a separate memswap setting) so API/SDK consumers understand why providing memoryLimit also changes swap behavior.
  /**
   * Memory limit for the agent execution container
   *
   * Accepts Docker memory format: a positive integer followed by a unit suffix
   * (b, k, m, g). Controls the maximum amount of memory the container can use.
   *
   * @default '6g'
   * @example '4g'
   * @example '512m'
   */
  memoryLimit?: string;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1215 to +1216
'Memory limit for the agent container (e.g., 4g, 6g, 8g, 512m). Default: 6g',
'6g'
// with swap unlimited so the kernel can use swap as a pressure valve
// instead of immediately OOM-killing the agent process.
mem_limit: config.memoryLimit || '6g',
memswap_limit: config.memoryLimit ? config.memoryLimit : '-1', // Disable swap when user specifies limit
Comment on lines 1160 to 1163
// Verify resource limits
expect(agent.mem_limit).toBe('2g');
expect(agent.memswap_limit).toBe('2g');
expect(agent.mem_limit).toBe('6g');
expect(agent.memswap_limit).toBe('-1');
expect(agent.pids_limit).toBe(1000);
@github-actions
Copy link
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia N/A ❌ CLONE_FAILED
Bun hono N/A ❌ CLONE_FAILED
C++ fmt N/A ❌ CLONE_FAILED
C++ json N/A ❌ CLONE_FAILED
Deno oak N/A ❌ CLONE_FAILED
Deno std N/A ❌ CLONE_FAILED
.NET hello-world N/A ❌ CLONE_FAILED
.NET json-parse N/A ❌ CLONE_FAILED
Go color N/A ❌ CLONE_FAILED
Go env N/A ❌ CLONE_FAILED
Go uuid N/A ❌ CLONE_FAILED
Java gson N/A ❌ CLONE_FAILED
Java caffeine N/A ❌ CLONE_FAILED
Node.js clsx N/A ❌ CLONE_FAILED
Node.js execa N/A ❌ CLONE_FAILED
Node.js p-limit N/A ❌ CLONE_FAILED
Rust fd N/A ❌ CLONE_FAILED
Rust zoxide N/A ❌ CLONE_FAILED

Overall: 0/8 ecosystems passed — ❌ FAIL


❌ Error Details

ALL_CLONES_FAILED: All 8 repository clones failed because GH_TOKEN is not set in the workflow environment.

gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
  env:
    GH_TOKEN: $\{\{ github.token }}

This affected every ecosystem:

  • Mossaka/gh-aw-firewall-test-bun — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-cpp — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-deno — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-dotnet — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-go — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-java — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-node — CLONE_FAILED
  • Mossaka/gh-aw-firewall-test-rust — CLONE_FAILED

Resolution: Add GH_TOKEN: $\{\{ github.token }} (or a PAT with repo read access to Mossaka/* repos) to the workflow's env: block.

Generated by Build Test Suite for issue #1360 ·

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Smoke Test (Oracle)

🔮 The ancient spirits stir; the smoke-test agent was here.
PR titles: "docs: update architecture docs with three-component overview"; "fix: skip safe dependency update PR when existing PR is open"
GitHub MCP (last 2 merged PRs): ✅
PR query via safeinputs-gh equivalent (2 PRs): ⚠️ tool unavailable; validated via GitHub MCP
Playwright github.com title contains "GitHub": ✅
Tavily search: ❌ tool unavailable
File write + cat + npm ci && npm run build: ✅
Discussion query/comment + PR-context comment target: ❌ unavailable/no current PR context; commented on #1360
Overall: FAIL

References: §23274556386

🔮 The oracle has spoken through Smoke Codex

Warning

⚠️ Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • ab.chatgpt.com
  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"
    - "registry.npmjs.org"

See Network Configuration for more information.

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.

Increase default agent container memory limit from 2GB to 6GB

3 participants