Skip to content

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

Merged
Mossaka merged 2 commits intomainfrom
copilot/increase-agent-memory-limit
Mar 23, 2026
Merged

feat: increase default agent memory limit to 6GB and enable swap#1360
Mossaka merged 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

github-actions bot commented Mar 18, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 86.11% 86.23% 📈 +0.12%
Statements 86.03% 86.15% 📈 +0.12%
Functions 86.13% 86.13% ➡️ +0.00%
Branches 79.31% 79.38% 📈 +0.07%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 87.7% → 88.1% (+0.48%) 87.0% → 87.5% (+0.47%)

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

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@pelikhan
Copy link
Contributor

@Mossaka Z3 was hitting memory issues.

@Mossaka Mossaka closed this Mar 23, 2026
@Mossaka Mossaka reopened this Mar 23, 2026
@github-actions
Copy link
Contributor

Smoke Test Results — Run 23444610776

Test Result
✅ GitHub MCP — last 2 merged PRs: #1389 chore: remove all trivy references, #1385 fix: pin aquasecurity/trivy-action to verified-safe v0.35.0 PASS
✅ Playwright — github.com title contains "GitHub" PASS
✅ File write — /tmp/gh-aw/agent/smoke-test-copilot-23444610776.txt created & verified PASS
✅ Bash — cat confirmed file content PASS

Overall: PASS | Author: @Copilot | Assignees: @Mossaka @Copilot

📰 BREAKING: Report filed by Smoke Copilot for issue #1360

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all versions match — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1360

@github-actions
Copy link
Contributor

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1360

@github-actions
Copy link
Contributor

🏗️ Build Test Suite Results

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

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #1360 ·

@github-actions
Copy link
Contributor

Smoke Test Results

PR titles: chore: remove all trivy references; chore(deps): update trivy-action to v0.35.0

  1. GitHub MCP merged PR review: ✅
  2. safeinputs-gh PR query: ❌ (tool unavailable in this run)
  3. Playwright github.com title contains "GitHub": ✅
  4. Tavily search results returned: ❌ (Tavily MCP unavailable)
  5. File write + 6) bash cat verification: ✅
  6. Discussion query + mystical discussion comment: ❌ (discussion safe-input tool unavailable)
  7. npm ci && npm run build: ✅
    Overall status: FAIL

🔮 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.

@Mossaka Mossaka merged commit afc1d00 into main Mar 23, 2026
117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants