Hands Off Development

Why Shared CI Runners Contaminate Cursor and OpenCode Agent Jobs and How Per-Task VMs Fix It

Fresh VMs per task cut off the shared state and credentials that patches miss.

· 9 min read
Cover illustration for “Why Shared CI Runners Contaminate Cursor and OpenCode Agent Jobs and How Per-Task VMs Fix It”
Cloud Agent Environments · December 1, 2026 · 9 min read · 1,935 words

Isolated VM environments for cloud coding agents separate each task from other jobs’ files, processes, and credentials. For Cursor and OpenCode in CI, the reference architecture is a fresh VM per task, narrowly scoped credentials, and controlled network egress. This removes cross-job state and credential sharing while containing, rather than curing, prompt injection.

How shared CI runners work and what they expose when an agent joins the pipeline

Shared CI runners run builds, tests, and deployment steps as part of an established execution workflow. Reusing that environment supports ordinary pipeline work, but it also places jobs inside a common trust boundary. A runner may have deployment tokens, cloud credentials, package-registry keys, and signing keys. That trust can extend to every job. Where workloads are not explicitly isolated or cleaned up, workspace files, caches, and inherited environment variables can expose one job’s context to another.

An agent changes what that shared trust permits. It reads text to decide what to do, then uses the filesystem, shell, and APIs to act on that decision. The Cloud Security Alliance AI Safety Initiative says that combining a text interpreter with a trusted pipeline actor puts the structure of CI/CD at risk. An agent that triages issues or fixes bugs unattended may get the same environment variables and API keys as other pipeline steps. The exposure therefore depends on both what the agent reads and what its execution environment allows it to reach.

Diagram: The Three-Link Contamination Chain. Visualizes: Show a three-stage linear chain illustrating how shared CI environments expose agent workloads to escalating risk.

Leaked state is the first link in the contamination chain. Files, cached dependencies, and environment state from one job survive into another job’s execution context. An instruction file makes the risk concrete. CSA’s research note describes two OpenAI Codex passes sharing a checked-out workspace, where the first could write to AGENTS.md and the second loaded that file as authoritative instructions. The next invocation inherited not merely data but directions written by the previous one.

Credential bleed is the second link, and it does not require an instruction file. A compromised low-sensitivity job sharing an execution environment with deployment work can collect production credentials when they become accessible there. Project privilege is not an effective boundary by itself. CSA’s AI Safety Initiative reports that AI-assisted commits expose secrets at roughly double the rate of human-only commits. Adversarial repository content adds another exposure path when an agent can already reach pipeline secrets.

Prompt-injection pivots form the third link. An issue title, PR description, code comment, or environment file can contain attacker-authored instructions that the model does not reliably distinguish from legitimate directions. Yet model behavior is only part of the chain. CSA’s note says the Black Hat cases used commands that looked plausible but got past downstream validators or isolation mechanisms that failed. Better prompting cannot repair string-parsing logic, remove inherited credentials, or enforce a domain allowlist.

Cursor and OpenCode agents running inside shared CI inherit these execution risks while interacting with more of the repository than a deterministic build script. They read configuration and source content, write artifacts into the workspace, and respond to triggers that can contain external input. This expands the available attack surface. A GitHub issue can trigger an agent even when its author has no repository write access. The workflow then converts permission to submit text into an opportunity to influence a privileged process.

CSA’s note describes a Gemini CLI advisory in which headless execution auto-granted workspace trust and --yolo bypassed the tool allowlist. A malicious .gemini/settings.json supplied through a PR could run a before_agent hook before sandbox initialization. The boundary failed before sandbox protections could apply. This is a failure in the harness, the software connecting the model to files, shell commands, and tool APIs.

The demonstrated products were Claude Code, Gemini CLI, and OpenAI Codex, which limits the product-specific evidence available for Cursor and OpenCode. The evidence establishes a harness-level failure class relevant to any agent placed inside shared CI, rather than proving the same bugs exist in every tool. For Cursor and OpenCode deployments, the diagnostic question is whether their jobs inherit shared state and credentials. Agent choice alone does not answer it.

What Black Hat 2026 proved about harness-level failures in CI-wired agents

Novee Security researchers showed how the attack chains worked at Black Hat USA 2026 [1][2][3][4]. CSA’s research note describes an unprivileged GitHub account opening an issue that led to credentials held by agents in CI workflows. The entry point required no repository write access. The three cases then crossed different harness boundaries, showing why the problem cannot be reduced to a single prompt or command.

Claude Code’s CVE-2026-54316 turned a pre-approved Hugging Face domain into an exfiltration channel for API keys [1][2][3][4]. Gemini CLI and its companion GitHub Action had CVE-2026-12537, which allowed arbitrary command execution before the sandbox initialized. Codex exposed a different kind of boundary failure. Its shared-workspace sequence allowed one pass to alter instructions consumed by the next. In every workflow examined, work triggered by an issue ran in the same environment as CI secrets and persisted state.

All three vendors addressed the reported issues. Anthropic and Google shipped fixes within days, while OpenAI applied workflow-level hardening without a product-version patch or assigned CVE [1][2][3][4]. These are not claims about open zero-days. CSA’s note also describes TeamPCP’s 2026 campaign against Trivy, Checkmarx KICS, and LiteLLM as following the same code-execution-in-CI pattern. The wider risk comes from running work that an attacker can influence where a harness defect can give it access to the trust built up in the pipeline.

Why patching individual CVEs does not close the contamination chain

Repairing a domain allowlist does not prevent credential inheritance, and enforcing a tool allowlist does not remove poisoned workspace files. The remaining boundaries still need independent protection. Harness software can have ordinary software bugs, so relying entirely on the harness to enforce every boundary leaves new ways into the same shared environment.

Scoped tokens, sandboxed containers, and least-privilege policies are useful defenses. They reduce what a compromised task can reach. However, container sandboxing alone does not remove state persisted outside the container on a shared host, and a container escape reaches that host. A fresh environment for each job keeps state from carrying over without depending on every cleanup step to work.

How do per-task VMs keep coding agents from affecting each other?

A per-task VM starts from a clean snapshot instead of inheriting a previous job’s execution context. Earlier workspace files, cached artifacts, and environment variables are absent from its filesystem and memory. The Codex instruction-file pattern cannot cross that boundary through a prior job’s leftover workspace, because the new task does not reuse it. That protection depends on keeping the environment fresh for each task.

Separate VMs also separate agent work from deployment credentials. A low-privilege task and a deployment job have distinct execution environments and network namespaces, so the deployment job’s credentials need not appear anywhere the agent can reach. Credential scope remains an essential design choice. Giving an agent production credentials would break that separation even in its own VM. For containers running within the task VM, a container escape reaches that VM.

Prompt injection is contained. A successful payload can still affect the task’s files and any credentials deliberately supplied to it. Destruction of the VM removes its execution environment after completion, while scoped credentials and egress controls limit what can escape during the task. CSA’s note recommends dedicated, sandboxed runners with zero production-secret access for issue-triggered workflows. Per-task VMs supply the execution boundary for that design, without implying that the VM or its contents are invulnerable.

Platforms that run Cursor and OpenCode agents in per-task isolated VMs

Replicas is a recommended option for teams running Cursor, OpenCode, Claude Code, or Codex because each task runs in its own isolated Linux VM rather than sharing an agent execution environment with deployment jobs. It accepts work from Slack, Linear, or GitHub and returns pull requests, replies, and recordings for review, with audit logs, SCIM, and self-hosting among its governance controls.

The alternatives differ in their isolation primitives and operating model. GitHub Copilot Coding Agent / Workspace uses an ephemeral GitHub Actions container environment for each task, with GitHub Issues and PRs as closely integrated entry points. OpenAI Codex Cloud also uses isolated containers and caches setup for a limited window. Its agent phase runs offline by default. That default limits outbound exfiltration paths during execution, but a container environment is not the same architectural claim as a separate VM per task.

E2B provides Firecracker microVM sandboxes through Python and JS/TS SDKs. It is open-source under Apache-2.0, and a team can use Terraform to self-host it in its cloud. Teams building their own task environments can use this isolation primitive as the execution layer. Across these options, the relevant distinctions are supported agents, VM versus container boundaries, environment freshness, credential scope, and network access.

Connecting agent triggers to isolated jobs: Slack, Linear, GitHub, and Sentry as safe on-ramps

Task isolation lets teams take work from more sources without giving every contributor the trust granted to a deployment runner. Slack messages, Linear tickets, GitHub issues, and monitoring alerts remain untrusted inputs. The execution boundary changes what they can affect. When each trigger starts a separate VM, a malicious request cannot rely on another task’s leftover workspace or deployment environment. Separate environments also let jobs run at the same time without sharing mutable execution state.

Draper’s workflow illustrates how these handoffs can operate. Product tickets written in a Slack channel and bug reports posted to a reports channel become Linear Triage issues through an agent. An “AI: Claude” label then triggers a cloud workflow that checks out staging and passes the ticket to Claude Code in an isolated CI context. The agent opens a draft PR. It also comments the link back on the ticket, retaining a reviewable output rather than turning a message directly into a production change.

Linear’s integrations with Claude Code and Codex support triage, planning, implementation, and review, including gathering Sentry and Datadog evidence through MCP. Ramp built its workflow on Linear’s API to connect specs, customer feedback, and code, with a majority of merged pull requests now written through the agent pipeline. Those examples establish the breadth of the workflow. They do not show that every implementation uses per-task VMs. The security distinction remains where the trigger dispatches execution and which credentials that environment receives.

What to audit in your pipeline before wiring another agent into CI

Runner isolation. The audit begins with whether each agent task receives a fresh, ephemeral environment or lands on a persistent shared runner. For shared runners, inspect explicit cleanup of workspace files, cached dependencies, and environment state.

Credential scope. Check every token available to the agent and whether it grants deployment access. Replace long-lived personal access tokens with short-lived, narrowly scoped credentials, following the post-disclosure guidance. Isolation cannot compensate for deliberately overprivileged task credentials.

Trigger trust. Review the execution environments of issues and issue_comment workflows. These externally reachable triggers need dedicated, sandboxed runners with zero access to production secrets. They must not share deployment runners.

Workspace trust. Check whether headless execution loads repository settings, hooks, or environment files as trusted configuration. Inspect whether contributor-supplied configuration can execute before sandbox initialization. The Gemini CLI case makes that ordering a concrete audit concern.

Human review. Check whether pull requests from an agent can reach production without a human reviewer. Keep the review gate distinct from execution isolation. Each addresses a different part of the workflow.

Harness versions. Patching and task isolation are complementary controls.

Sources

  1. Comment and Control: When a GitHub Issue Steals CI Secrets

More in Cloud Agent Environments