Skip to content

Change detection skips Dockerfile changes in dev mode #1380

@jariy17

Description

@jariy17

Problem

computeProjectDeployHash in src/cli/operations/deploy/change-detection.ts hashes harness.json, system-prompt.md, and aws-targets.json — but does not include Dockerfiles referenced in the harness spec.

canSkipDeploy can return true despite Dockerfile changes, leaving stale containers running in dev mode.

The per-harness computeHarnessHash in HarnessDeployer does include the Dockerfile, but it's never reached when the project-level check skips the entire deploy pipeline first.

Expected behavior

A Dockerfile change should invalidate the project deploy hash so agentcore dev triggers a redeploy.

Possible fix

Include Dockerfile content in computeProjectDeployHash:

for (const harness of projectSpec.harnesses ?? []) {
  const harnessDir = join(projectRoot, harness.path);
  // ... existing harness.json and system-prompt.md hashing ...
  
  // Also hash Dockerfile if present
  try {
    const harnessJson = JSON.parse(await readFile(join(harnessDir, 'harness.json'), 'utf-8'));
    if (harnessJson.dockerfile) {
      const dockerfileContent = await readFile(join(harnessDir, harnessJson.dockerfile), 'utf-8');
      hash.update(dockerfileContent);
    }
  } catch { /* no dockerfile */ }
}

Context

Found during review of #1341.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions