Skip to content

fix(devcontainer): raise the process limit of the container #3722

Closed

Description

@dan-petty

Problem

The devcontainer has a limit of 2048 processes and threads (pids.max of its cgroup, the default of rootless Podman). VS Code fills it, and then the tools of agent sessions fail with exit code 1, can't start new thread or fork errors, and the sessions end. This happened on 2026-11-05 and on 2026-11-06, and it lost agent work each time.

Evidence, from a log of pids.current every 5 seconds:

Time (UTC) Count What happened
2026-11-05 21:29:15 to 21:30:12 604 to 2048 in 57 s 94 refused forks, load 180. About 39 rg processes, 619 rg threads.
2026-11-06 02:25:44 to 02:27:48 722 to 2048 in 2 min 30 rg processes, then 98, 553 refused forks, load 300.

Every rg process is a child of the VS Code extension host (@vscode/ripgrep-universal), not of a command of an agent. Each rg starts one thread for each of the 16 CPUs, so 98 searches use about 1,600 slots. The second burst came in the minute that a new worktree with its virtual environment was created: 6,189 new files under .data/agent/worktrees/. I did not find which extension starts the searches: no extension log names one.

A full devops ci or a pytest run with workers adds to the count, but the baseline with 4 agents is about 600 to 1,000. The searches are what pass the limit.

Expected

The container limit leaves room for a burst of searches, so a burst slows VS Code and does not stop the tools of a session. Raise the limit in runArgs of .devcontainer/devcontainer.json (Podman and Docker both accept --pids-limit), to a value that the burst fits in with a margin, for example 8192. The cause (which extension runs the searches, and whether .data can leave its file list) stays open as a follow-up.

Acceptance criteria

  • .devcontainer/devcontainer.json holds a --pids-limit in runArgs, with a comment that states the measure above.
  • A test or the devcontainer validation check reads the value and fails if it is under 4096.
  • k8s/README.md, CONTRIBUTING.md or the devcontainer document that names the limit of 2048 states the new value, and where it takes effect (a rebuild of the container).
  • A person rebuilds the container: the pull request says so.

Existing tool considered

--pids-limit is the standard option of podman run and docker run. The cost of the change is about 100,000 tokens and 30 minutes.

Related

#2336 (limit how many CPU-heavy gates run at once), #3593.

Proposed design

Problem statement

a

Acceptance criteria

Existing Tool Considered

b

Key questions

None.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/devcontainer
    status/new
    value/high
    effort/low
    on Nov 6, 2026
  2. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/devcontainer. The (devcontainer) scope of the title gives the scope.
    • Priority: P1-High. The limit has caused loss of agent work on two consecutive days and will recur until fixed.
    • Value: High. Agent sessions that lose work are the core failure this project must prevent.
    • Effort: Low. The change adds one flag to runArgs, a validation check, and a doc note, estimated at 30 minutes.
    • Related: docs(devcontainer): align devcontainer usage guide with modern best practices #144, which asks for a different change. Both items touch the devcontainer configuration, but #144 updates usage documentation while the candidate raises the pids limit in devcontainer.json.
  3. added
    priority/p1-high
    on Nov 6, 2026
  4. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 7496693 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who rebuilds the devcontainer after the change? (a person decides)
  5. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Cause found on 2026-11-06. The searches are rg --files --hidden --no-ignore --follow with the glob **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig.json}, run by the extension host (parent pid of the rg processes). That glob is MARKER_GLOB of the extension ms-python.vscode-python-envs 1.42.0 (registerWorkspacePythonContext, file dist/extension.js). It watches the glob over the whole workspace and starts one findFiles scan, so one rg process, for each created or deleted file. It has no debounce and no check for a scan in progress.

    So a git worktree add that checks out about 2,000 Python files starts about 2,000 scans in seconds. Each rg starts 16 threads, one for each CPU, so 100 scans use about 1,700 of the 2,048 slots. All our bursts (2026-11-05 21:29, 2026-11-06 02:25, 04:03 and 04:07) came with a new worktree or virtual environment under .data/agent/worktrees/.

    The upstream issue is microsoft/vscode-python-environments#1989 (open, triage-needed; the code is unchanged in 1.43.0). The extension has no setting that turns this off. python.useEnvironmentsExtension is at its default (false), so the Python extension does not even use it.

    I could not reproduce it with 40 small files under .data: each scan ends in milliseconds when the host is idle. The scans pile up only when the host is loaded.

    What this means for the item:

    • The higher --pids-limit stays the fix for this repository, because the cause is in an extension that we do not own.
    • Do not add files.watcherExclude for .data unless a measure shows that it stops the scans. Measure the number of rg processes that start (for example strace -f -e trace=execve on the extension host, if strace exists) while a worktree is created. If it cannot be measured, leave the setting out and say so.
    • A larger change for a person to decide: move the agent worktrees out of the workspace folder, so that neither the watcher nor the scans see them.
  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 6, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 6, 2026
  8. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 9fc5d8f until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The proposal has no problem statement, no acceptance criterion with its requirement, scenario, WHEN and THEN, or no answer to the existing-tool question. State the problem, the requirements with their scenarios, and the open tool that covers the need or the cost of building it.
  9. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 05:02 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p1-highscope/devcontainersource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions