Skip to content

Fix ENOBUFS in ensureService during Docker image pulls - #58

Merged
clduab11 merged 2 commits into
codex/uat-macos-readinessfrom
copilot/sub-pr-56-again
Feb 24, 2026
Merged

Fix ENOBUFS in ensureService during Docker image pulls#58
clduab11 merged 2 commits into
codex/uat-macos-readinessfrom
copilot/sub-pr-56-again

Conversation

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

execSync with stdio: 'pipe' in ensureService buffers all child-process output through Node's 1 MiB maxBuffer. On first-run pulls of large Docker images, this causes ENOBUFS, killing the process and failing env bootstrap even when Docker is healthy.

Changes

  • src/env/service-manager.ts
    • Import spawn alongside execSync
    • Replace the execSync call in ensureService with await this.runComposeUp(cmd, env)
    • Add private runComposeUp helper using spawn with stdio: ['ignore', 'inherit', 'pipe']:
      • stdout → inherit (streamed to terminal, no buffer limit)
      • stderr → collected into Buffer[] and attached to the rejection as { status, stdout, stderr } — preserving the shape wrapComposeStartError uses for pull-auth / daemon / missing-CLI classification
      • error event → same shape with status: null for spawn-level failures (e.g. docker not on PATH)
private runComposeUp(cmd: string, env: NodeJS.ProcessEnv): Promise<void> {
  return new Promise<void>((resolve, reject) => {
    const proc = spawn(cmd, { shell: true, stdio: ['ignore', 'inherit', 'pipe'], env });
    const stderrChunks: Buffer[] = [];

    proc.stderr?.on('data', (chunk: Buffer) => stderrChunks.push(chunk));

    proc.on('close', (code) => {
      if (code === 0) { resolve(); return; }
      const stderr = Buffer.concat(stderrChunks).toString('utf8');
      reject(Object.assign(new Error(`docker compose exited with code ${code}`), { status: code, stdout: '', stderr }));
    });

    proc.on('error', (spawnErr) => {
      reject(Object.assign(spawnErr, { status: null, stdout: '', stderr: spawnErr.message }));
    });
  });
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Continue Tasks: ✅ 1 no changes — View all

…Sync pipe

Co-authored-by: clduab11 <185000089+clduab11@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address review feedback on Plan and chunk 1 Fix ENOBUFS in ensureService during Docker image pulls Feb 24, 2026
Copilot AI requested a review from clduab11 February 24, 2026 15:40
@clduab11
clduab11 marked this pull request as ready for review February 24, 2026 15:46
@clduab11
clduab11 merged commit b130961 into codex/uat-macos-readiness Feb 24, 2026
1 check failed
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