Skip to content

feat(core): add sandbox target configuration for observed-IO opt-out - #36853

Open
AgentEnder wants to merge 2 commits into
masterfrom
claude/nx-snapshot-opt-out-b6dgt1
Open

feat(core): add sandbox target configuration for observed-IO opt-out#36853
AgentEnder wants to merge 2 commits into
masterfrom
claude/nx-snapshot-opt-out-b6dgt1

Conversation

@AgentEnder

Copy link
Copy Markdown
Member

Current Behavior

There is no way to opt a target out of observed-IO sandboxing or to declare reads/writes that should be excluded from sandboxing reports. Every task the runner tracks gets its PIDs reported through the TaskIOService, so a sandbox report is produced regardless of whether the task can safely use one, and task instances carry no sandbox information for downstream consumers (the Nx Cloud runner and cloud api).

Expected Behavior

Targets can declare a sandbox configuration in project/target config (and targetDefaults):

{
  "sandbox": {
    "enabled": false,
    "ignoredReads": ["tmp/cache/**"],
    "ignoredWrites": ["scratch/**"]
  }
}
  • TargetConfiguration gains sandbox (typed and in the JSON schemas), defined as the native TaskSandboxConfiguration so Task['sandbox'] and TargetConfiguration['sandbox'] are the same type.
  • createTaskGraph copies the target's sandbox config onto each Task instance (like cache/parallelism), so consumers read it off the task itself instead of resolving it through the project graph.
  • The task orchestrator registers each task's config with the TaskIOService just-in-time in processTask (both run paths await it before spawning). notifyPidUpdate drops PID updates for tasks with enabled: false, so no IO tracing signal — and therefore no sandbox report — is produced for opted-out tasks.

ignoredReads/ignoredWrites are consumed by the Nx Cloud runner and io-trace daemon (nrwl/ocean), which exclude matching accesses from sandbox reports at record time; this PR only carries them on the task instances.

Related Issue(s)

Part of the "Allow Nx plugins to declare tasks as non-snapshot-able" work (Linear). The backpropagate/healing flag from that ticket is deliberately not included here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YVrVQUAtU1aSQPuUxLkJsn


Generated by Claude Code

claude added 2 commits August 29, 2026 17:40
Adds a `sandbox` property to target configuration with `enabled`,
`ignoredReads`, and `ignoredWrites`. The task orchestrator registers each
task's sandbox configuration with the TaskIOService, which suppresses PID
reporting for tasks whose target sets `sandbox.enabled: false`, so no IO
tracing signal (and therefore no sandbox report) is produced for them.
checkFilesAreInputs/checkFilesAreOutputs treat paths matching the ignored
globs as reconciled so sandbox-violation validation skips them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVrVQUAtU1aSQPuUxLkJsn
Review feedback: the target's sandbox configuration is copied onto each
Task in createTaskGraph (Task['sandbox'] equals
TargetConfiguration['sandbox']), so consumers read it off the task
instead of resolving it through the project graph. The orchestrator
registers it with the TaskIOService just-in-time in processTask, which
both run paths await before spawning, replacing the upfront iteration
over the task graph. The check-task-files sandbox matching is reverted:
those functions answer whether a file is an input/output, and with
ignored accesses excluded from reports at record time there is nothing
left for them to reconcile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVrVQUAtU1aSQPuUxLkJsn
@AgentEnder
AgentEnder requested a review from a team as a code owner August 30, 2026 06:22
@netlify

netlify Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 56662c3
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6a93cc2b638e7000082e1c5a
😎 Deploy Preview https://deploy-preview-36853--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 56662c3
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6a93cc2b312ae5000744300d
😎 Deploy Preview https://deploy-preview-36853--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Nx Cloud AI Fix could not be generated

View fix generation details ↗


View your CI Pipeline Execution ↗ for commit 56662c3

Command Status Duration Result
nx affected --targets=lint,oxlint,test,build,e2... ❌ Failed 54m 9s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 33s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 13s View ↗
nx-cloud record -- nx format:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-30 07:20:38 UTC

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants