GitHub PR-comment agent (@cursor) ignores `build.context` in `.cursor/environment.json` — Docker COPY fails with "failed to calculate checksum ... not found"

Where does the bug appear (feature/product)?

Cloud Agent (GitHub, Slack, Web, Linear)

Describe the Bug

When a Cloud Agent is triggered via an @cursor comment on a GitHub pull request, the custom environment Docker build does not resolve build.context from .cursor/environment.json as documented. The Dockerfile itself is found and loaded correctly, but the build context arrives empty (the build log shows transferring context: 2B), so every COPY instruction fails with failed to calculate checksum of ref ...: not found and the agent aborts with “Docker build errored (exit code: 1)”.

Per the Cloud Environment Setup docs, paths in environment.json are resolved relative to the .cursor directory, so "context": "." should make the .cursor folder the build context and bare-filename COPY sources should work. That is not what happens when the agent is started from a PR comment.

Steps to Reproduce

  1. In a GitHub repository, create .cursor/environment.json:
{
  "build": {
    "context": ".",
    "dockerfile": "Dockerfile"
  },
  "install": "/home/ubuntu/install.sh",
  "start": "/home/ubuntu/start.sh"
}
  1. Create .cursor/Dockerfile that copies sibling files (all of which exist in the .cursor/ folder):
FROM maven:3.9-eclipse-temurin-25
COPY settings.xml.template /home/ubuntu/.m2/settings.xml.template
COPY install.sh /home/ubuntu/install.sh
COPY start.sh /home/ubuntu/start.sh

  1. Open a pull request in that repository and comment @cursor with any task.
  2. The environment build fails:
COPY settings.xml.template /home/ubuntu/.m2/settings.xml.template
ERROR: failed to calculate checksum of ref ...: "/settings.xml.template": not found
COPY install.sh /home/ubuntu/install.sh
ERROR: failed to calculate checksum of ref ...: "/install.sh": not found
COPY start.sh /home/ubuntu/start.sh
ERROR: failed to calculate checksum of ref ...: "/start.sh": not found

Note in the log that transferring dockerfile: 2.53kB succeeds while transferring context: 2B shows the context is empty. Reproduces 100% of the time across multiple repositories in our organization. Repositories without a .cursor folder (default environment) work fine.

Expected Behavior

"context": "." should resolve to the .cursor directory (as documented), making the COPY sources available. At minimum, the PR-comment-triggered Cloud Agent should resolve the build context the same way as other Cloud Agent entry points, so the same environment.json works everywhere.

Either resolution would be fine from our side:

  1. Fix the agent so "context": "." really does resolve relative to the .cursor folder as documented — then existing configs that follow the docs start working again; or
  2. If the current behavior is intended, update the “paths are relative to .cursor” note in the Cloud Environment Setup docs to describe what the PR-comment agent actually does.

Screenshots / Screen Recordings

Operating System

Other

Version Information

Version: 3.9.16 (system setup)
VS Code Extension API: 1.105.1
Commit: 042b3c1a4c53f2c3808067f519fbfc67b72cad80
Date: 2026-06-27T06:41:01.941Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

N/A — the environment Docker build fails before any model/agent runs.

For AI issues: add Request ID with privacy disabled

bc-1657c42c-0f5c-4ff5-bca9-22ed126a5025

Additional Information

  • Trigger path: GitHub integration, @cursor comment on a pull request.
  • Base image in Dockerfile: maven:3.9-eclipse-temurin-25.
  • The .cursor/environment.json + .cursor/Dockerfile setup follows the Cloud Environment Setup docs (paths relative to the .cursor folder).
  • Workaround we are testing: set "context": ".." and prefix COPY sources with .cursor/ (the pattern shown in the docs example). Even if that works, the documented "context": "." behavior is still broken for PR-comment-triggered agents.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hi @Luke_Kong!

Thanks for the detailed report. I think this is actually working as intended, though the docs make it confusing.

"context": "." doesn’t resolve to .cursor. The values ., ./, and .. are special-cased to mean the repo root, which is why your COPY sources (all in .cursor/) aren’t found and the context shows up empty.

The fix: remove the context line entirely. It defaults to .cursor, and your bare-filename COPYs will work unchanged.

You’re right that there’s a docs gap, though. The “paths are relative to .cursor” note doesn’t mention the ././/.. special-casing. Once you confirm this works on your end, I’ll get the docs clarified. Let me know if that unblocks you!

Hi @Colin, it is a better solution (remove context line in the environment.json file) and works like a charm on my end! Thanks for the quick solution. Please update the documentation when you have time. Thanks a lot! :grinning_face:

Merging docs changes now! Thanks!