Skip to content

fix: resolve create harness Dockerfile paths from command cwd#1474

Open
kiwigitops wants to merge 1 commit into
aws:mainfrom
kiwigitops:fix-create-harness-dockerfile-base
Open

fix: resolve create harness Dockerfile paths from command cwd#1474
kiwigitops wants to merge 1 commit into
aws:mainfrom
kiwigitops:fix-create-harness-dockerfile-base

Conversation

@kiwigitops

@kiwigitops kiwigitops commented Jun 7, 2026

Copy link
Copy Markdown

Description

When agentcore create adds a harness with a Dockerfile, the project directory is created before the harness is added. Relative Dockerfile paths were resolved from that new project root, so a path supplied from the directory where agentcore create was invoked could fail.

This threads the create command's original working directory into the harness add path and uses it as the base for relative Dockerfile paths. Existing harness add behavior still falls back to the project root.

Related Issue

Closes #1128

Documentation PR

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Additional checks:

  • npx vitest run --project unit src/cli/primitives/__tests__/HarnessPrimitive.test.ts
  • Preview CLI smoke test with agentcore create --container ./Dockerfile.custom, verifying the Dockerfile is copied into the generated harness directory and recorded in harness.json

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@kiwigitops kiwigitops requested a review from a team June 7, 2026 09:33
@github-actions github-actions Bot added the size/s PR size: S label Jun 7, 2026

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the clean fix!

apiKeyArn: options.apiKeyArn,
containerUri: containerOption.containerUri,
dockerfilePath: containerOption.dockerfilePath,
dockerfileBaseDir: commandCwd,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be worth a brief comment here noting that dockerfileBaseDir intentionally uses CWD (not outputDir) since the Dockerfile is a source input.

@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 8, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The path to dockerfile should be fixed to where the agentcore command was run

3 participants