Skip to content

fix(agent): stop excluding .devsy-internal from streamed workspace mount - #1109

Merged
skevetter merged 1 commit into
mainfrom
fix/k8s-dockerless-devsy-internal-stream-exclude
Aug 20, 2026
Merged

fix(agent): stop excluding .devsy-internal from streamed workspace mount#1109
skevetter merged 1 commit into
mainfrom
fix/k8s-dockerless-devsy-internal-stream-exclude

Conversation

@skevetter

@skevetter skevetter commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

Kubernetes-provider workspace up for a Dockerfile-backed devcontainer fails before the Dockerless build starts:

dockerless build: rename dir: open /workspaces/.dockerless/.devsy-internal: no such file or directory

Root cause

The Kubernetes dockerless fallback (dockerlessFallback in pkg/devcontainer/build.go) generates .devsy-internal/Dockerfile-without-features on the host, inside the Dockerfile build context, before the pod exists. Since Kubernetes has no bind mount, the primary workspace content (including the build context) is delivered into the pod exclusively via the tunnel StreamWorkspace/StreamMount RPCs (pkg/agent/tunnelserver/tunnelserver.go).

Both of those RPCs appended config.BuildArtifactExcludes() (.devsy-internal) to their tar excludes, so the generated build context never reached the pod. In-pod, prepareBuildDirectory (pkg/agent/dockerless.go) then can't find it at either the primary location or the /workspaces/.dockerless fallback, producing the observed rename dir error.

The exclude was introduced in 8e32743af (#615) to fix build-artifact leakage into LocalDockerDelivery's docker-volume seeding (pkg/agent/delivery/workspace_seed.go), which has its own independent tar/exclude logic and is unaffected by this change — the tunnelserver changes in that commit were an unrelated, untested "also fix it here" that caused this regression.

Fix

Remove config.BuildArtifactExcludes() from StreamWorkspace and StreamMount. Cleanup of .devsy-internal is unaffected: it still happens host-side (cleanupBuildInformation in run.go) and in-pod (cleanupBuildDirectory in dockerless.go) after the build.

Testing

  • pkg/agent/tunnelserver/tunnelserver_test.go: added TestStreamWorkspace_IncludesDevsyInternalBuildArtifacts and TestStreamMount_IncludesDevsyInternalBuildArtifacts, which seed a .devsy-internal/Dockerfile-without-features file and assert it survives the tar stream. Verified both fail against the pre-fix exclude and pass with the fix.
  • e2e/tests/build/build.go: added "kubernetes dockerless build cleans up .devsy-internal after streaming", exercising the exact repro (Dockerfile-backed devcontainer + Kubernetes provider + up), asserting the build actually ran with the transported Dockerfile and that .devsy-internal doesn't linger in the pod workspace or on the host afterward. Requires a kind cluster; not run locally in this sandbox.

Fixes #1108

Summary by CodeRabbit

  • Bug Fixes
    • Workspace and mount streaming now preserves required internal build artifacts during transfers.
    • Improved dockerless Kubernetes builds by ensuring temporary build artifacts are properly removed after streaming completes.
  • Tests
    • Added end-to-end coverage for dockerless Kubernetes builds.
    • Added validation for workspace and mount streaming contents.

The Kubernetes dockerless fallback generates .devsy-internal build
artifacts on the host before the workspace is streamed into the pod.
StreamWorkspace and StreamMount both appended
config.BuildArtifactExcludes() to their tar excludes, stripping
.devsy-internal from that stream. With no bind mount for Kubernetes,
this was the only transport into the pod, so prepareBuildDirectory
could never find the build context and dockerless build failed before
starting.

The exclude was introduced in 8e32743 (#615) to fix build-artifact
leakage into LocalDockerDelivery's docker-volume seeding
(workspace_seed.go), which has its own independent tar/exclude logic
and is unaffected by this change.

Fixes #1108
@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit b3b9f98
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a863b04beb4b800083622c0

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit b3b9f98
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a863b040af1d500088bcc0d

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 766a4adb-c024-4993-9dba-896a9963ab34

📥 Commits

Reviewing files that changed from the base of the PR and between fd525aa and b3b9f98.

📒 Files selected for processing (3)
  • e2e/tests/build/build.go
  • pkg/agent/tunnelserver/tunnelserver.go
  • pkg/agent/tunnelserver/tunnelserver_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Workspace and mount streaming now preserves Devsy internal Dockerless build artifacts. Unit tests inspect streamed TAR entries, and a Kubernetes end-to-end test verifies Dockerless setup and artifact cleanup.

Changes

Dockerless artifact streaming

Layer / File(s) Summary
Stream exclusion handling
pkg/agent/tunnelserver/tunnelserver.go
StreamWorkspace and StreamMount no longer add build-artifact exclusions to their TAR streams.
Streaming regression tests
pkg/agent/tunnelserver/tunnelserver_test.go
Added stream capture and TAR parsing helpers. Tests verify that workspace and mount streams include Dockerfile-without-features.
Kubernetes build validation
e2e/tests/build/build.go
Added a Kubernetes Dockerless build test that checks SSH setup and confirms .devsy-context is absent from the workspace and host .devcontainer directory after streaming.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b3b9f

The change restores required workspace build artifacts during streaming while preserving cleanup behavior, and no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

  • devsy-org/devsy#615: Directly relates to reversing the streaming build-artifact exclusions while retaining cleanup.
  • devsy-org/devsy#848: Also changes pkg/agent/tunnelserver/tunnelserver.go and related streaming tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary fix: stopping exclusion of .devsy-internal from streamed workspace mounts.
Linked Issues check ✅ Passed The changes transport .devsy-internal, preserve cleanup, and add unit and Kubernetes regression coverage for issue [#1108].
Out of Scope Changes check ✅ Passed The implementation and tests directly support the linked issue and PR objectives; no unrelated changes are identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #1108

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/k8s-dockerless-devsy-internal-stream-exclude

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 2 duplication

Metric Results
Complexity 8
Duplication 2

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@skevetter
skevetter marked this pull request as ready for review August 19, 2026 23:49
@mergify

mergify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@skevetter
skevetter merged commit 4895666 into main Aug 20, 2026
83 checks passed
@skevetter
skevetter deleted the fix/k8s-dockerless-devsy-internal-stream-exclude branch August 20, 2026 00:55
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.

Kubernetes Dockerless build drops .devsy-internal during StreamMount and fails before build starts

1 participant