Ephemeral VM Lifecycle From Cold Start to Pull Request What Cloud Infrastructure Teams Should Measure
Stage-by-stage metrics separate infrastructure failures from agent failures.

A bring-your-own API key cloud coding agent runner needs measurement from workspace creation through merged pull request. Measuring setup, reasoning, CI, and merge outcomes separately lets teams distinguish infrastructure failures from agent failures and optimize each independently.
Why the ephemeral VM lifecycle needs its own measurement framework
A pull request that never arrives looks the same whether a cold start timed out, a clone hung, or the agent exhausted its context window. Each belongs to a different stage, with a different owner, cost structure, and remedy. Teams that use endpoint-only monitoring can start looking in the wrong layer before they know what went wrong.
Ephemeral execution makes that ambiguity harder to resolve because the environment destroys its state after each invocation. Every session must rebuild the conditions for useful work. Without instrumentation, the team also starts each investigation blind. This is a reason to measure the rebuild cost deliberately and preserve stage-level signals beyond the environment that produced them.
What the cold start stage actually measures and why it sets the tempo for everything downstream
Cold start begins with the workspace-create request and ends when the first command can execute and return a response. “Provisioning started” and “container running” are not equivalent endpoints. Neither establishes that the agent can do work.
To capture that interval, teams should emit timestamped events at workspace-create-request and first-command-ready, then calculate the delta for each workspace. A mean alone hides the operational risk. The distribution, including p95 and p99, exposes outlier sessions that warrant investigation for warm-pool depletion or image-pull misses. These measurements show whether startup is slow every time or usually works well but sometimes stalls.
That distinction governs the architecture of the downstream loop. When each iteration uses a fresh sandbox, VM creation cost recurs on every such iteration. Cold start can therefore make ephemeral-per-task execution economically and operationally unviable. Teams must track the time it takes separately from clone and build time, even when all three happen before useful output appears. Otherwise, a team may optimize image size to fix “slow startup” when repository size is the actual constraint.
Repo clone and dependency install as a hidden tax that compounds with every cold start
A ready VM is not a ready environment. Repository clone and dependency install impose another startup tax on every ephemeral invocation, and repository properties largely determine its size. Persistent execution avoids rebuilding all state on each invocation, which explains the contrast in setup cost. That contrast establishes why ephemeral workloads need a distinct measurement boundary between compute readiness and task readiness.
Clone instrumentation should record start and completion timestamps, distinguishing by-ref operations from full clones. Dependency installation needs events of its own for when it starts and when it finishes. A separate environment-ready timestamp then marks the end of both, without changing the meaning of VM ready. Together, these intervals distinguish VM creation lag, network-limited cloning, and cold dependency resolution when all three would otherwise appear as an agent that has not started working.
The distinction also makes caching strategies testable. Partial clones, shallow clones, and volume mounts change what the downstream agent sees, so a faster aggregate startup time cannot explain which compensation is working. Separate clone and install measurements preserve that attribution. They direct investigation toward the platform for VM lag, the caching strategy for clone delays, or a base image pre-bake for cold dependency resolution.
The agent reasoning loop as the stage where infrastructure signals and agent signals diverge
Once the environment is ready, setup timing no longer explains execution by itself. Two signal streams now run in parallel. The VM consumes CPU, memory, disk I/O, and network resources while the agent makes tool calls, consumes context, retries failures, and decides whether to continue. A slow loop can originate in either stream, and elapsed time alone cannot distinguish them.
Teams should track CPU utilization per workspace minute, memory high-water mark, and disk write rate during build steps. Network egress needs destination metadata for each workspace so model API calls remain distinguishable from package downloads and VCS operations. Task-level logs do not substitute for this coverage. Unexpected calls to external APIs or model endpoints outside the allow-list may be invisible there unless egress is captured separately.
Agent-behavior coverage should measure tool calls per task, the tool call latency distribution, context window tokens consumed per iteration, retries on failed calls, and the loop termination reason. Success, timeout, and context exhaustion are different outcomes. Consider two sessions that both time out. One exhausts VM memory, while the other repeats a failed API call. The former calls for a larger memory SKU, while the latter calls for a retry-policy adjustment or a different harness.
Workspace minutes consumed per completed pull request connects these domains in the engineering dashboard. It provides a comparable compute-cost unit across agents, tasks, and harnesses. The underlying streams explain why that number changes, rather than leaving teams to infer whether additional compute bought useful progress or merely sustained an inefficient loop.
Build, test, and CI as a cost layer that scales with pull request volume, not with engineering headcount
Agents that run in parallel can produce more pull requests with the same engineering headcount. CI consumption follows those requests. Teams that count agent output but do not attribute pipeline resources to it can therefore discover the cost increase in a bill before they see it in a dashboard.
System-wide pipeline minutes and queue depth are insufficient for that attribution. Teams need pipeline minutes per PR split by whether an agent or a human wrote it, along with queue depth when an agent-authored PR enters the queue. First-run test suite pass rates should use the same author distinction. Artifact storage growth should also be correlated with agent PR volume, so pipeline execution is not the only visible component of CI cost.
If agents finish faster than runners can process their output, infrastructure wait accumulates before reviewers see the PR. LinearB’s 2026 finding reported substantially longer waits for review for agentic pull requests than for unassisted work. That finding does not, by itself, identify CI as the cause. Submission-time queue measurements are what distinguish runner congestion from agent reasoning time or human review time.
When many agent-authored PRs target the same repository, merge conflict rate belongs in pipeline instrumentation. Even with a fast agent and enough runners, integration can be slow when open branches conflict.
The pull request as the unit of measurement for the whole lifecycle
A merged pull request supplies the denominator that connects upstream resource use to accepted work. Opened requests cannot serve the same purpose. An agent that produces many PRs that close without merging consumes resources without producing merged output, and an opened-PR denominator obscures that distinction. Cost-per-merged-PR makes the infrastructure expenditure legible to engineering leadership.
The infrastructure-cost numerator combines workspace compute, attributable CI execution, and storage costs during the session. Teams must use their actual rates to turn workspace minutes and pipeline minutes into dollars before adding them to storage charges. Raw minutes are not interchangeable monetary units. Clone and install time contribute through workspace consumption, while loop tokens and retries provide the behavioral context for interpreting that consumption.
Teams need more than cost to tell whether greater parallelism helps. Post-merge quality rate is the second outcome measure, starting here with post-merge revert rate within seven days. Together, cost and quality help leadership judge whether additional agent throughput is acceptable or whether integration and review are constraining the result. CI queue measurements help locate that constraint before it is mistaken for a reasoning problem.
These PR-level measures depend on the earlier instrumentation. Without attributed workspace, CI, storage, and outcome signals, cost and quality remain disconnected reports rather than an account of the lifecycle that produced the merged change.
Separating infrastructure problems from agent problems in practice: how to read the signal stack
A session that produces no output, shows high cold-start latency, and has normal clone time points toward provisioning or image pull. The agent configuration is not the first suspect. Platform engineering has a bounded stage to investigate. The value lies in the relationship between signals.
If a session produces output but iteration count is high and token consumption is a multiple of comparable tasks, a retry loop or context-window management issue becomes a plausible explanation. AI engineering can investigate the harness or prompt configuration. Resource measurements remain useful here because they prevent behavioral symptoms from being read in isolation.
Successful execution followed by a long CI queue and frequent merge conflicts identifies a third domain. The agent has finished, but integration has stalled. That combination directs attention toward concurrency governance and repository branching policy, with developer experience or tooling teams coordinating integration. Reconfiguring the reasoning loop would leave the observed bottleneck untouched.
Clean attribution also depends on workspace isolation. One agent per VM, with its own filesystem and network namespace, keeps one agent’s resource use from contaminating another’s measurements. Audit logs and session recordings support this analysis as well as compliance and governance requirements, including SOC 2 and access control review. Treating recordings only as compliance artifacts leaves detailed timing evidence unused. Stage-aware instrumentation turns the ephemeral VM from a black box into a legible system.
What to instrument first when starting from no observability on agent workloads
A team starting without coverage should build it from outcomes upstream, beginning with the measurements that are cheapest to add and immediately useful. Merged PR rate by author type and post-merge revert rate within seven days require an agent-versus-human tag at PR creation and a query on the VCS event log. No agent or infrastructure changes are required. For workflows triggered through Slack, Linear, GitHub, or GitLab, the tag can originate where a ticket or message triggers a workspace.
The next layer is CI attribution and congestion. Queue depth at agent-PR submission and pipeline minutes per agent-authored PR can be captured through a webhook or CI API query when the PR opens. These signals expose review delays and volume-driven pipeline costs before deeper infrastructure work begins. They also establish whether the largest visible delay occurs after the agent has already completed its task.
Teams can then add clone and cold-start telemetry to cover the earlier stages. Those measurements require instrumentation closer to the infrastructure, but the outcome and CI signals provide a basis for deciding whether setup latency is the binding constraint. The sequence prevents detailed low-level telemetry from becoming an end in itself. It allocates measurement effort according to the evidence already available, while leaving room to deepen agent-loop coverage where diagnosis requires it.
Comprehensive observability is not the day-one goal. The practical test is whether a team can determine, quickly enough to act, whether a session failed because of its infrastructure or its agent. A framework that answers that question reliably gives each owner a specific failure to fix.


