Skip to content

bug: scheduled task containers don't receive MCP credential mounts #1046

@iabheejit

Description

@iabheejit

Problem

Scheduled tasks set isScheduledTask: true in ContainerInput and pass it to runContainerAgent. However, buildVolumeMounts only gates MCP credential mounts (Gmail, Calendar, Todoist, etc.) on isMain. Since scheduled tasks typically run under non-main groups, their containers start with no MCP credentials mounted.

The result: any scheduled task that calls a Gmail, Calendar, or Todoist MCP tool silently fails — the MCP server cannot find its credentials at /home/node/.gmail-mcp etc. The task produces no error; the tool call just returns empty.

Root cause

src/container-runner.ts, buildVolumeMounts function:

function buildVolumeMounts(
  group: RegisteredGroup,
  isMain: boolean,   // isScheduledTask never reaches here
): VolumeMount[] {
  ...
  // MCP mounts gated only on isMain — non-main scheduled tasks get nothing
  if (isMain) {
    // mount .gmail-mcp, .calendar-mcp, etc.
  }
}

// Call site — isScheduledTask is not forwarded
const mounts = buildVolumeMounts(group, input.isMain);

input.isScheduledTask is declared in ContainerInput and set to true by task-scheduler.ts, but it is never passed through to buildVolumeMounts.

Minimal fix

Add a mountIntegrations?: boolean parameter to buildVolumeMounts and pass input.isScheduledTask at the call site:

function buildVolumeMounts(
  group: RegisteredGroup,
  isMain: boolean,
  mountIntegrations?: boolean,
): VolumeMount[] {
  const shouldMountIntegrations = isMain || !!mountIntegrations;
  ...
  if (shouldMountIntegrations) {
    // mount .gmail-mcp, .calendar-mcp, etc.
  }
}

// Call site
const mounts = buildVolumeMounts(group, input.isMain, input.isScheduledTask);

This keeps the isMain gate for interactive groups while enabling credential mounts for scheduled tasks regardless of their group_folder.

PR

Fix is in branch fix/scheduled-task-credential-mounts on iabheejit/nanoclaw. TypeScript checks pass. 22 lines changed + 1 import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions