Repository navigation
Sync upstream main through b440f1e1d - #199
Closed
codyhartsook wants to merge 177 commits into
Closed
codyhartsook wants to merge 177 commits into
codyhartsook wants to merge 177 commits into
Conversation
…t-substrate#3789) In a turnover run, the whole-run Requests/s also divides by the time spent registering the fleet. A gVisor run with 2,000 sessions swapping at 10/s shows 8.1 ResumeActor/s, so the dashboards estimate the live window instead of reading it. turnover_window.py already counts each request from the `turnover fill done` line to the end of the run. It writes those counts under per-request keys (`requests_<name>`, `rps_<name>`). Tables that load stats.jsonl with the schema of the whole-run rows drop those keys, so the `turnover_window` row reads as empty there. Write one `turnover_<name>` row per request instead, with the whole-run keys (`request_count`, `failure_count`, `requests_per_s`, `failures_per_s`) and the window bounds. The swap rate is the `requests_per_s` of `turnover_TimeToWake`. Tested with the benchmarking/locust unit tests under pytest, the way hack/verify/benchmarking-python.sh runs them. I used an AI agent to draft the change, the test and this description, and reviewed them myself. Signed-off-by: Chenyi Wang <chenyiwang@google.com>
…aves (agent-substrate#3750) `ResumePausedUser` spaces cold resumes one by one through a `rate.Limiter` with burst `1`. Smooth pacing measures steady-state throughput at a given average rate, but hides the queueing, CPU throttling, and Postgres connection/lock contention that happen when many actors resume at the same time. Add `--burst-size` (`burst_size` in `/boomer-config` and the Locust web UI, default `0`) to release cold resumes in waves of up to `burst_size` users every `burst_size / target_rps` seconds while keeping the same average rate (`target_rps`). - When `burst_size` is `0` (default), `ResumePausedUser` keeps the existing smooth token-bucket pacing. - When `burst_size > 0`, up to `burst_size` callers sleep until the same wave boundary on a `burst_size / target_rps` grid; an overflow or late caller advances to the next boundary on the grid, and live updates to `burst_size` or `target_rps` (including across `--ladder` `@target_rps` steps) step forward from the last scheduled boundary using the new period. - Reject `burst_size < 0` or `burst_size > 0` without `target_rps > 0` in the boomer `knobs` codec. Supersedes agent-substrate#2399. AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated Signed-off-by: Sairaj Pokale <sairajpokale@google.com>
…ent-substrate#3551) Part of agent-substrate#3298 ([design](https://docs.google.com/document/d/1wcO8150RH9bjHulYaAvyW0IrbX2raXCREDYOurQavq4/edit?tab=t.v8rzfkkd2f1j&resourcekey=0-COU9pclBVTxrcs4hGnyI7g)). First of four PRs: agent-substrate#3551 (this), agent-substrate#3550, agent-substrate#3552, agent-substrate#3592. Benchmark pass/fail logic is spread over one-off tools. With this, a test entry declares `evaluations`, each a set of variables (source queries) and CEL conditions over their values, and the evaluator judges a run into a `Report`: pass, fail or invalid per evaluation. Nothing calls it yet. agent-substrate#3552 wires it into the runner and writes `evaluation.json` and the `stats.jsonl` rows. Conditions compile with `cel-expr-python` when the evaluations load. Sources are classes with three hooks (`sources/base.py`): `validate(cfg)` when the evaluations load, `init(run)` when the run starts, and `query(cfg)` after it. A variable whose source can't judge the run is invalid and is left out of the CEL data, so every condition that reads it is invalid and the evaluation can't pass. `run_results` reads one `stats.jsonl` row. The config is pydantic models. `source_cfg: null` is an error; leave the key out for `{}`. AI use: I wrote this with an AI coding agent from the design, then reviewed the diff and checked the goodput numbers against the agent-substrate#2526 prototype on 248 Prow runs. --------- Signed-off-by: Haowei Cai <haoweic@google.com>
Use only fills and no strokes - strokes can scale up/down weirdly.
Re-render the PNGs in can any pixel-level shfts (re-rendering them shows
a diff but it is indiscernible).
Document the names of the 3 robots. They are, of course, UUIDs.
- [X] Tests pass
- [X] Docs updated
Signed-off-by: Tim Hockin <thockin@google.com>
…to nighthawk_common (agent-substrate#3628) Part of agent-substrate#3624 (Stage 1, item 2): share the adaptive load session spec and output helpers between `nighthawk-ingress` and the coming `nighthawk-egress` runner. ### What changes Pure relocation, no behavior change. `nighthawk-ingress/output.py` and `spec.py` move to `benchmarking/nighthawk_common/`. The router-specific parts of the spec builder (router SNI, certificate paths, `build_spec_dict`) stay in `nighthawk-ingress/spec.py`, which now calls the generic `build_session_spec`. Callers and tests import `nighthawk_common` directly; the ingress Dockerfile copies the package into the image. ### Review guide 1. `output.py` rename (GitHub shows 100%), two import lines, the Dockerfile `COPY`, two `sys.path` lines in the ingress tests. 2. `spec.py` rename at 100%, importers repointed, an unused import dropped from `actors.py`. 3. The split: read `nighthawk_common/spec.py` as deletions and `nighthawk-ingress/spec.py` as the same lines moving back. ### Testing `hack/verify/benchmarking-python.sh`: the ingress suite passes at each commit, and fails without the new `sys.path` lines, so the import path is exercised. Independent of agent-substrate#3627. agent-substrate#3629 and agent-substrate#3630 stack on both. AI use: AI-assisted for the diff, the commit split and the test runs; I reviewed the diff. - [x] Tests pass - [ ] Docs updated (none needed) --------- Signed-off-by: Yuan Gao <ypgao@google.com>
…ate#3850) govulncheck fails on main with GO-2026-6865. Update `github.com/klauspost/compress` from `v1.19.1` to `v1.20.4` . Testing: `govulncheck ./...` with Go 1.27.4 finds no called vulnerabilities. AI use: assisted with Claude code. - [x] Tests pass - [ ] Docs updated Signed-off-by: Haven Xia <haoyuxia@google.com>
Go 1.27.4 fixes GO-2026-6859 in net/http. This vulnerability should start being reported once PR agent-substrate#3856 lands on main and fixes the `govulncheck` action. Because of this. I would prefer to merge this after PR agent-substrate#3856. AI use: Used AI to diagnose the issue and make the change. Manually verified that GO-2026-6859 (when running on top of agent-substrate#3856) is gone. Signed-off-by: Julian Gutierrez Oschmann <juliangut@google.com>
The `govulncheck-action` action passes `go-version-input`, which defaults to stable, to setup-go along with `go-version-file`. setup-go uses `go-version` when both are set, so the scan ran with the latest Go release. We build with the toolchain version in go.mod, so the scan missed standard library vulnerabilities in the Go we ship (see agent-substrate#3855) Set `go-version-input` to an empty string so setup-go reads go.mod. Part of agent-substrate#3855. AI use: Used AI to diagnose the issue and make the change. Manually verified the action warning is gone from the logs and the vulns in 1.27.3 are reported. Signed-off-by: Julian Gutierrez Oschmann <juliangut@google.com>
…trate#3521) The CSI controller mounts its NFS share when creating and deleting volume directories. The example omits the driver privileges and NODE_ID used by the vendored deployment. Use privileged mode for the NFS driver, following the vendored controller manifest, and populate NODE_ID from spec.nodeName. Envoy keeps its restricted security context. SYS_ADMIN alone does not override security profiles that deny mounts. Validation: - Real CSI CreateVolume and DeleteVolume calls pass with the privileged driver in isolated containers using nfsplugin v4.13.4 on Linux 5.14. The default-permissions control fails at mount. - All six YAML examples parse; checks confirm the driver privileges, NODE_ID and restricted Envoy configuration. - git diff --check passes. The permission comparison did not deploy Kubernetes or the Envoy sidecar. SYS_ADMIN also worked on that test host, but this does not establish compatibility with AppArmor-enabled Kubernetes nodes. AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: cloudonly <enrondg@gmail.com>
…ate#3096) `docs/reference/api-guide.md` says every declared volume must be mounted by at least one container, but `CreateActorTemplate` accepts templates that don't. Rejecting them now would tighten validation that v1.0.0 accepts. It would also block a template repoint that removes the only container mounting a volume, because a repoint requires identical `volumes`. Fix the docs instead: drop the claim from the API guide and the CSI volumes guide. Add a `CreateActorTemplate` validation test row that accepts an unmounted volume. It passes on `main` and fails if the check is added back. How snapshots treat an unmounted `durableDir` is a separate problem, covered by agent-substrate#3343. Related to agent-substrate#3069. Tested with `go test -race -count=3 -shuffle=on` on the validation package and the repoint functional tests. `hack/verify-all.sh` passes gofmt, codegen, go-modules and licenses locally. proto-fmt, shellcheck, metrics and kube-api-linter did not run locally (no clang-format, docker or weaver, and a module download failed). AI assistance: Codex helped write and rebase the first version, which rejected unmounted volumes. A Claude-based agent reworked it after review: it removed the check, edited the docs and added the test row. --------- Signed-off-by: cloudonly <enrondg@gmail.com>
… from runs (agent-substrate#3550) Part of agent-substrate#3298 ([design](https://docs.google.com/document/d/1wcO8150RH9bjHulYaAvyW0IrbX2raXCREDYOurQavq4/edit?tab=t.v8rzfkkd2f1j&resourcekey=0-COU9pclBVTxrcs4hGnyI7g)). Second of four PRs: agent-substrate#3551 (merged), agent-substrate#3550 (this), agent-substrate#3552, agent-substrate#3592. Goodput today comes from a one-off tool (agent-substrate#2526). This adds a `cel` source to `benchmarking/evaluate`, so a test entry can compute it, or any other metric, in config. The source reads files from the run with two generic readers (`json` and `json_lines`). It then computes named values with standard CEL. It knows nothing about any one benchmark. Reading another test's run (for goodput, the suite's 1-user run) and the goodput example come in agent-substrate#3552. Supersedes agent-substrate#2526 (Nishanth's `tools/goodput`, co-authored here). Tested with the `benchmarking/evaluate` unit tests. AI use: I wrote this with an AI coding agent from the design, then reviewed the diff. - [x] Tests pass - [x] Docs updated Signed-off-by: Haowei Cai <haoweic@google.com> Co-authored-by: Nishanth Kotla <nishanthkotla@google.com>
…3704) Fixes agent-substrate#3701 The v1.0.0 draft job failed with `error: generating notes: gh: Server Error (HTTP 500)`; a rerun worked. This adds `gh_with_retries` (`hack/util/gh-retry.sh`). It retries a gh command **only on HTTP 5xx**, up to 5 attempts (2s, 4s, 8s, 16s apart). Anything else fails right away. Output from failed attempts is thrown away, so an error body can't end up in the release notes. **Retried:** the gh calls in `draft-release.sh` (including generate-notes) and `get-contributors.sh`. **Not retried:** `gh release create` (not safe to repeat), the "does the release exist?" check ("not found" is the normal answer), and `attach-binaries.sh` (gh reports its lookup failures as "release not found", not as a 5xx). **Known gaps (can follow up):** - A 500 during that existence check on a rerun can create a second draft (same as main). - Errors gh reports without an HTTP status aren't retried, e.g. GraphQL timeouts. #### Testing Ran the scripts locally with a fake `gh` that mimics real gh errors: - a 5xx (JSON or HTML error page) then success on generate-notes gives the correct notes - persistent 5xx gives 5 attempts, then one clear error - 404s and "not found" return immediately - a normal run makes no extra calls `hack/verify/shellcheck.sh` and `hack/verify/boilerplate.sh` pass. --------- Signed-off-by: Anna Pendleton <13793293+annapendleton@users.noreply.github.com> Co-authored-by: Anna Pendleton <13793293+annapendleton@users.noreply.github.com>
…ottleneck under test (agent-substrate#3627) Part of agent-substrate#3624: size the rig so `atenet-egress` is the bottleneck under test. Before this PR, the benchmark ran at a fixed request rate. The later PRs of agent-substrate#3624 measure the highest rate that `atenet-egress` holds, with the gateway as the system under test. So the load generator, which runs inside an actor, and the origin server should get more CPU and memory. Measured on a GKE cluster with 4 `c3-standard-22` nodes and `envoy` of `atenet-egress` at 1 vCPU. In each of the modes `http`, `mitm` and `passthrough`, `envoy` reached its CPU limit. The worker pod of the load generator peaked at 12 of its 18 vCPUs, and `nighthawk-server` at 2.1 of its 8. The run used the search of those later PRs. AI use: AI-assisted for the diff, the split and the test runs; I reviewed the diff. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Yuan Gao <ypgao@google.com>
…er for test types (agent-substrate#3918) Part of agent-substrate#3917 . Adds benchmarking/automation/workers.py, which installs and tears down the benchmark WorkerPool from a tests.yaml entry. It renders the same manifests/workloads.yaml.tmpl as deploy.sh, and the output is byte-identical for the same settings. install() or teardown() will be called by the locust hook in phase 2. Differences from deploy.sh: - workerCount must be an int of 0 or more. deploy.sh also accepts strings like "2" and negative numbers that fail later in kubectl. No tests.yaml entry uses either. - teardown() uses kubectl delete in place of ko delete, so it no longer builds and pushes the worker image just to delete the pool. - MicroVM deps and the SandboxConfig are not handled here. deploy_substrate already passes --sandbox-classes to ate-setup. AI use: AI assisted, reviewed myself and also used AI for adversarial review --------- Signed-off-by: Parnika Mandewalkar <pmandewalkar@google.com>
…ent-substrate#2420) Every ingress request calls `ext_proc` in `atenet-router`, which calls `ResumeActor` on the ATE API server to find the actor's worker. This adds an Envoy Rust dynamic module (`envoy_substrate_ingress_cache`) that caches `<atespace>/<actor> -> worker IP` in Envoy, so bodiless requests to a warm actor skip that call. It's behind the `IngressCache` preview gate, off by default. - **Cache hit**: the HTTP filter, ahead of `ext_proc`, reads the actor from `dev.ate.target.actor` filter state or a single `ate-target-actor` header (an inner header on a terminated CONNECT tunnel is ignored). It sets the `envoy.filters.listener.original_dst` metadata (worker `ip:atunnel_port`, actor port, worker SPIFFE ID), `x-ate-target-port` and `ate-target-actor`, plus `ate.ingress_cache` `hit` dynamic metadata, and clears the route cache. A dedicated route that matches that metadata, which clients can't set, has `ext_proc` disabled. - **Cache miss**: the request goes through `ext_proc` unchanged. On a successful response the filter learns the binding from the `original_dst` metadata. Failures aren't learned. - **Requests with a body**: only requests that end with their headers or have `content-length: 0` use the cache, because Envoy doesn't buffer bodies for replay. Everything else, including all gRPC, chunked or HTTP/2 GETs and upgrades, skips the lookup (`bypass`). Their responses still refresh the cache if successful. - **Eviction**: a hit that fails with `421` + `x-ate-assignment-stale: true`, `503` with `UF`/`UH`/`UC`/`UR` (Envoy flags), or `grpc-status: 14` evicts the binding it used, but not a newer one. Application 503s without flags are left alone. - **Tunnel Watcher**: on the CONNECT path a refused tunnel (never established) and a tunnel cut off mid-request looks the same to the router (`503 UC`). The `tunnel_watcher` is a network filter on the `actor_connect` internal listener, before `tcp_proxy`, that can them apart from byte direction alone. A close with `UF` marks the actor's entries for that worker **stale**; an mid-flight close with a request outstanding marks them **spoiled**. Its close callback runs inside `tcp_proxy`'s close, so the mark always lands before the router's `503`. - **Replay**: requests with no body that hit stale cache are replayed through `ext_proc` with `recreate_stream` (restoring `ate-target-actor`; the new stream starts without the hit metadata) only when we have **certainty** an actor did NOT receive it: `421` stale, `503` `UF`/`UH`, or `503 UC` with `upstream_reset_before_response_started` details AND only when the cache entry is **stale and not spoiled**. Replay of requests with body, including all gRPC is left out of scope of this initial implementation. - As of this implementation, the cache is **per Envoy worker thread** (no locks). It can be configured with `atenet-router`'s `--ingress-cache-ttl` (default 5s) and `--ingress-cache-max-cached-actors` (default 10,000 per thread) set its TTL and size. Known limitations are in the module README. On kind with the router at 2 CPUs and 50 actors, the cache raised the max RPS within a 25ms tail-latency SLO from 3936 to 3968, cut p50 from 3.77ms to 1.03ms, and cut `ext_proc` calls by ~96%. AI was used to assist with the development of this change: including knowledge gathering, adversarial testing and review, test coverage writing, refactoring, and all code writing. Line by line read of all deltas by the human author (except for autogenerated vendor/ dir), as well as benchmark and test results review. - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR --------- Signed-off-by: Pancho <panchoruy@google.com>
…ubstrate#3658) On SIGTERM, gracefulShutdown would cancel and crash any in-progress RunWorkload or RestoreWorkload call. A node drain or a WorkerPool scale-down would crash ever actor that was mid-resume. Now gracefulShutdown waits for the in-progress resume to finish, then stops the actor with the rest of the running actors, giving them time to suspend. Fixes agent-substrate#3001 AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated Signed-off-by: Scott Funkenhauser <sfunkenhauser@google.com>
…-substrate#3635) agent-substrate#3609 ### Why The k8s credential provider read the Secret from the API server on every `FetchSecret`, which is once per injected header per egress request. A busy actor spent the provider's `--kube-api-qps` budget re-reading the same Secret. ### What changed The provider now caches each Secret it reads, keyed by namespace and name, for `--secret-cache-ttl` (default 10s, 0 disables). A cache entry holds the Secret's labels and data, so all keys of one Secret share a read. Concurrent misses for one Secret share a single `Get` through singleflight. Authorization still runs on every fetch. The namespace and label checks use the cached labels, so a Secret cached for one atespace is still refused to an atespace whose grant does not cover it. A rotated, relabeled or deleted Secret can take up to the TTL to take effect. The egress credential injection guide notes this. AI-use: I used AI to create the change. I reviewed the diff. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Yufan Su <yufans@google.com>
It dials 127.0.0.1, so there is no name to resolve. <!-- The PR title becomes the release note. Write it for users. --> Why is this needed? (Or link the issue. Open one first for features, API, install or CI changes.) The server only has one endpoint, and STATIC will work and ROUND_ROBIN is the default. <!-- e.g. "AI-assisted, I reviewed and tested it." No AI co-author trailers. --> AI use: AI-assisted, I reviewed and tested it. <!-- Breaking change? Describe what users must do on upgrade and ask for the `breaking-change` label. --> - [x] Tests pass - [x] Docs updated Signed-off-by: botengyao <botengyao@gmail.com>
Filed agent-substrate#3419 to make some timeouts user configurable. part of agent-substrate#1291 - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Yan Avlasov <yavlasov@google.com>
… of an empty 504 (agent-substrate#3361) Fixes agent-substrate#3331 ### Why When an actor's resume takes longer than the parking budget plus 5s, Envoy's ext_proc timeout ends the request with a 504 and no body. gRPC clients see `Unavailable` with an empty message, and the router logs the request as canceled by the client. With the default 5s budget, this happens to the first request for an actor restored from a snapshot of about 1 GiB. ### What changed: The router now stops waiting 1s before Envoy's timeout and answers with `503 actor <ref> is still resuming, retry`. The resume keeps running, and later requests join it. Envoy's timeout stays as a backstop for when the router cannot answer. The egress handlers already cap their lookups under the ext_proc timeout the same way. The error wraps `context.DeadlineExceeded`, so the route and parking metrics count it as `timeout`. AI use: AI-assisted. I reviewed and tested it. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Yufan Su <yufans@google.com>
Part of agent-substrate#3228. The sandbox DNS relay answers a name the egress policy doesn't allow with NXDOMAIN, and nothing counted those denials. Both ateworkers now emit `ate.dns.queries` with an `ate.dns.decision` label, `allowed` or `denied`. A denied query gets NXDOMAIN. There's no actor or atespace label, per the cardinality rules. A log of which actor looked up which name could come in a follow-up. AI use: AI-assisted for code and tests, I reviewed the diff. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Lior Lieberman <liorlieberman@google.com>
…gent-substrate#3881) An actor with a `*` http or https rule can make atenet-egress connect to anything the gateway pod can reach, including the metadata server (169.254.169.254) and Envoy's own admin port on localhost. agent-substrate#2319 blocked link-local in atunnel, but the gateway resolves names itself, so a name or Host header that points at those addresses still got through. Part of agent-substrate#2086, related agent-substrate#2062. - Adds `resolved_address_filter` to the shared `egress_dns_cache`, so the cleartext, MITM and passthrough legs all drop loopback, link-local, unspecified and the IPv6 metadata addresses after resolving. This also covers a Host or SNI that is a bare IP like `169.254.169.254`. - On the cleartext and MITM legs a denied address gets a 403 with a body saying why, instead of the 503 `DNS resolution failure` Envoy sends for a name that doesn't resolve. Passthrough closes the connection, same as a ClientHello denial. Both HTTP legs now log `%RESPONSE_CODE_DETAILS%` (`dns_resolution_failure{address_denied}`). - The other six cache configs are now YAML aliases of the first one, since Envoy rejects two different configs under one cache name. - `TestEgressDNSCacheSettings` now requires the filter on every DNS cache, in the manifests and the rendered overlays. Private ranges (pod, Service, node and VPC IPs) are still reachable under a `*` rule. Blocking them needs an operator-owned exception list, because actors and our e2e reach in-cluster services on purpose. That's a followup. AI use: AI-assisted, I reviewed it and tested it against a local Envoy 1.39.5. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Lior Lieberman <liorlieberman@google.com>
## Add volume snapshot support to volume plugins Part of agent-substrate#1951 This is the first PR in the external volume snapshot series. Tags will be able to snapshot an actor's external volumes and seed new actors from those snapshots. This PR adds only the volume plugin layer that work builds on. **There is no API change, and nothing calls the new snapshot methods yet.** ### What changes **Plugin interface** (`internal/volume/plugin.go`) - `CreateVolumeRequest` gains `SourceSnapshotID`, so a volume can be seeded from a snapshot. `CreateVolumeResponse` gains `ContentSourceSnapshotID`, the source the driver reports it actually restored from. - `VolumePluginControlPlane` gains `CreateSnapshot`, `GetSnapshot`, `DeleteSnapshot` and `ControllerCapabilities`, with the `CreateSnapshotRequest`, `Snapshot` and `Capabilities` types. **CSI plugin** (`internal/volume/csi`) - The snapshot methods are built on the controller's `CreateSnapshot`, `ListSnapshots` and `DeleteSnapshot` RPCs. They use the controller capabilities the plugin already caches. `CreateSnapshot` and `GetSnapshot` drop a capability once the driver answers `Unimplemented` for it. - **`CreateSnapshot`** is refused without calling the driver if the driver lacks the capability. A response with no snapshot ID is an error. - **`GetSnapshot`** uses `ListSnapshots` filtered to one handle, because far more drivers implement it than the newer `GetSnapshot` RPC. An empty list or `NotFound` is reported as *not found*. A driver without `LIST_SNAPSHOTS`, or one that answers `Unimplemented`, returns an error wrapping `errors.ErrUnsupported`, so callers can tell a deleted snapshot from one the driver can't report on. An empty snapshot ID is rejected, so the driver is never asked for an unfiltered list. - **`DeleteSnapshot`** is always sent, even if the capability is missing, because skipping it would leak a handle the driver already issued. `NotFound` counts as success. An empty snapshot ID is rejected. - **Restores:** `CreateVolume` refuses a restore without calling the driver if it lacks `CREATE_DELETE_SNAPSHOT`. Otherwise it reads the content source from the driver's response. If the response reports no snapshot source ID, the plugin deletes the volume it just got and fails. Without this check, the caller would get back an empty volume without knowing it. If that delete fails, the error includes the volume ID but not the delete's gRPC code. `NotFound` from that delete counts as a successful cleanup, and `CreateVolume` still fails. Only presence is checked, not an exact ID match, because drivers may report the source in their own format (GCE PD reports a numeric snapshot ID). Kubernetes' external-provisioner checks the same way. **Mock plugin** - `MockVolumePlugin` implements the new methods. Its snapshots are always ready to use. ### Testing - New table tests in `plugin_snapshot_test.go` use the existing `mockCSIDriver`, which gains `CreateSnapshot`, `ListSnapshots` and `DeleteSnapshot` hooks. They cover: - create, get and delete - capability caching, and dropping a capability after `Unimplemented` - refusing `CreateSnapshot` without the capability, and rejecting an empty snapshot ID from the driver - `GetSnapshot` not-found handling (empty list, `NotFound` from the driver), `ErrUnsupported` without `LIST_SNAPSHOTS` or after `Unimplemented`, and rejecting an empty ID - `DeleteSnapshot` error handling, sending it without the capability, and rejecting an empty ID - restore source checking: a missing source fails and deletes the volume, a failed delete reports the volume ID without its gRPC code, a delete answering `NotFound` is not reported, and a source in the driver's own format is accepted - refusing a restore on a driver without snapshot support - Existing CSI plugin tests pass unchanged. - `go test -race ./internal/volume/... ./cmd/ateapi/internal/controlapi` passes. I used an AI coding agent to help write and review this change, and reviewed the result myself. - [x] Tests pass - [ ] Appropriate changes to documentation are included in the PR -- Documentation will be added once all parts of the feature are implemented. --------- Signed-off-by: Sneha Aradhey <snehaaradhey@google.com>
Removes the Trendshift "#1 repository of the day" badge from the top of the README. It's a bit confusing about what it means. AI use: Used AI agent to write the change. I reviewed it. Signed-off-by: Julian Gutierrez Oschmann <juliangut@google.com>
… range parts (agent-substrate#3462) ### Problem (agent-substrate#3921) `sparsePartCount` truncated `populated / 64 MiB` to `1` for sparse snapshots in `[64 MiB, 128 MiB)`. Because `PutSparseFile` requires `parts >= 2`, these snapshots fell back to single-stream `PutObject`, which reserves `512 MiB` on GCS (100% of `DefaultUploadMemory`) and serialized all uploads on the node to `concurrency = 1`. ### Solution Split sparse files into at least `2` parts once their encoded stream bound reaches `64 MiB` (`uploadCompositeMin`). `64–128 MiB` snapshots now use the 2-part `PutSparseFile` path and reserve `96 MiB` (`2 × 48 MiB`) instead of `512 MiB`, allowing up to 5 concurrent uploads per node (~3× higher throughput). ### Benchmark Results (`80 MiB` Sparse Snapshot, `DefaultUploadMemory = 512 MiB`) | Scenario | `main` (Before) | `sparse-upload-64m-parts` (After) | Improvement | | :--- | :--- | :--- | :--- | | **Memory reservation per `80 MiB` upload** | `512 MiB` (100% of budget, concurrency = 1) | **`96 MiB`** (18.75% of budget, concurrency = 5) | **-81% reservation (5× concurrency)** | | **1 actor (`80 MiB` `pages.img`)** | `66.8 ms/op` (`1,256 MB/s`, `118.7 MB/op` alloc) | **`59.9 ms/op`** (`1,401 MB/s`, `70.2 MB/op` alloc) | **1.12× faster, -41% heap alloc** | | **5 concurrent actors (`80 MiB` `pages.img` each)** | `394.9 ms/op` (`1,062 MB/s`, `568.9 MB/op` alloc) | **`131.5 ms/op`** (`3,190 MB/s`, `325.7 MB/op` alloc) | **3.00× faster, -43% heap alloc** | | **4 concurrent gVisor snapshots (`80 MiB` + 6 metadata files each)** | `428.6 ms/op` (`600.1 MB/op` alloc) | **`136.1 ms/op`** (`394.1 MB/op` alloc) | **3.15× faster, -34% heap alloc** | ### Testing - `go test ./pkg/objectstorage/...` - Added `80 MiB` (`two_ranges`) test case in `TestUploaderPlansFromPopulatedBytes` and updated `TestUploaderGCSSnapshotBurstFitsDefaultBudget` to exercise `[64 MiB, 128 MiB)` snapshots. --------- Signed-off-by: Chenyi Wang <chenyiwang@google.com>
…-substrate#3532) Under load many actors on a full node are resumed at once. Each resume detaches the actor first, which uploads its snapshot, so dozens of uploads run against the object store at the same time. An attempt can run out of its own upload timeout. The tracker keeps the local snapshot and retries the upload on the next attempt. But the error it returned had no gRPC code, so the detach failed as Internal: DetachFromFullNode: while calling atelet DetachActor: ... while uploading snapshot manifest: DeadlineExceeded The router answered 500, which the client cannot retry. One case of agent-substrate#646. Return Unavailable when the attempt timed out while the caller's context is still live. `detachActorError` maps Unavailable to a retryable failure, so the router keeps the request parked and retries the resume. Written with Claude Code: it found the path in api-server logs and wrote the change and the test. Signed-off-by: Davanum Srinivas <davanum@gmail.com>
…strate#3212) When the CSI node plugin restarts, any actor that suspends or resumes on that node during the restart crashes, because atelet can't unmount or mount its external volume. The actors stay crashed until `RevertActor`. Actors that keep running are not affected, since atelet only calls the node plugin on mount and unmount. I hit this while load testing with the R2 driver, where every actor on the node suspended during the 32 second restart. While the plugin restarts, its socket refuses connections. atelet tries once, gets `Unavailable`, and gives up. Now atelet waits up to 30 seconds for the plugin to come back. It uses the same `pluginsocket` code that atelet already uses to wait for the object store plugin. This only applies to the local socket. The controller plugin, which ateapi reaches over TCP, still fails right away. The new test starts a call while the plugin is down, then brings the plugin up. The test fails without this change. --------- Signed-off-by: Anish Gangu <anishgang@google.com>
…startup (agent-substrate#3731) This is the first of two releases that move each actor's snapshot-state.json from /var/lib/ate/actors/<uid>/ to /var/lib/ate/snapshots/<uid>/, so its writes stop waiting on the boot disk. The version skew policy needs a node layout change to span two minor releases. This release still keeps the file in the old place. At startup, before the snapshot tracker is created, atelet moves any file the next release left in the snapshot directory back to the old place, so a rollback from that release keeps every actor's snapshots. Each moved file is synced before the original is removed, and atelet exits if a move fails. The follow up PR that writes the new place is agent-substrate#3732, and will merge in the next minor release. AI use: Ran CL review - [x] Tests pass Signed-off-by: Anish Gangu <anishgang@google.com> Co-authored-by: Michelle Au <msau@google.com>
…oot (agent-substrate#3730) When atelet starts after a node reboot, it drops local snapshots written before the reboot. For a snapshot that was already uploaded, it only deleted the local checkpoint directory, so the rest of the actor's files stayed on the node after the detach was reported. atelet now removes them the same way a normal detach does. The actor's directory is removed only for an actor that hasn't started since. AI use: Ran CL review - [x] Tests pass Signed-off-by: Anish Gangu <anishgang@google.com> Co-authored-by: Michelle Au <msau@google.com>
Follow-up to agent-substrate#2940, from msau42's review there. `finishDetach` locked the actor to record the detach, unlocked it to log, then locked it again in `endOp` to end the op and requeue the actor. It now logs first, while the op's context is live, and records the detach, ends the op, and requeues the actor under one lock, as `backgroundUpload` does. `endOp` had no other caller, so it's removed. The retry branch reads `ctx.Err()` under the actor's lock, since Forget cancels the context under the same lock, and before `endOpLocked` cancels it. `TestTrackerFailedDetach` fails if it reads it after. The record is saved only when it changed, as in `backgroundUpload`. No API changes. AI use: Claude Code wrote the change and this description. I reviewed both. Signed-off-by: Ivy <igooch@google.com>
…gent-substrate#2963) Fixes agent-substrate#2950 Worker pods with many concurrent sandboxes or cached image layers accumulate thousands of entries in `/proc/self/mountinfo`. Calling `imagecache.UnmountAllUnder` on every teardown and failure path scanned the entire table, scaling unmount cost with total mounts in the namespace rather than with the actor being torn down. See agent-substrate#2950 and the fleet measurements in the comments below from `vicentefb` (gVisor) and `Nishanth29` (microVM). - Replace the `/proc/self/mountinfo` scan in `internal/imagecache/bundle_linux.go` with `unix.Statx` (`AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_STATX_DONT_SYNC`, `STATX_TYPE`) checking `STATX_ATTR_MOUNT_ROOT` (requires Linux 5.8; `mountOverlay` already requires Linux 6.7 or 6.6.23, so no `mountinfo` fallback). - Add `UnmountBundlesUnder` for OCI bundle dirs (`actorDirs.GetOciBundleDir()`), checking only `<container>/rootfs` and `<container>/volumes/*` without walking `upper/` or `work/`. Switch `ateworker-gvisor` (`releaseContainers`) and `ateworker-microvm` (`coldBootActor`, `cleanupFailedRestoreRootfs`, `teardownActor`, `restore_linux_test.go`) to it. - Keep `UnmountAllUnder` as a full directory walk for `runsc-state` and `pidfiles` (`resetRunscStateAndPidFileDirs` in `cmd/ateworker-gvisor/actorpath.go`). - Reject empty or relative paths, pass `MNT_DETACH | UMOUNT_NOFOLLOW`, repeat up to 8 passes plus a confirming check for stacked/shadowed mounts, continue past failed entries with `errors.Join`, and attempt detach when `statx` fails (e.g., dead FUSE mounts). - Delete unused `internal/imagecache/mountinfo.go` and `internal/imagecache/mountinfo_test.go`, update `internal/imagecache/README.md`, and add unit plus root-gated mount tests in `internal/imagecache/bundle_linux_test.go`. AI use: AI-assisted, I reviewed and tested the changes (`-race` unit tests and `unshare -rm` mount tests). - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Besher Massri <besher@google.com>
…e its microVM stays up (agent-substrate#4250) PR 2 of 2 for agent-substrate#4111. ateworker-microvm now writes the `Actor container exited` line from agent-substrate#4145 when a container exits while its microVM stays up. - **Detection.** The worker already reads each container's stdout and stderr through the kata agent. When both streams end, it calls the agent's `WaitProcess` for the exit code. A container that closed its own stdout and stderr still gets a line: the call blocks until the exit. The watch starts with the log forwarding, when the container starts, so a container that exits during a boot also gets a line. - **Order.** The wait starts after the streams end. The agent drops the output that is still in the pipes when a wait collects the exit. With a wait already in progress, a container that wrote 109 KB and exited lost about 60 KB in each test run. With the wait after the streams, it lost nothing. - **Stops.** What the worker writes when the actor or the worker stops: - **Suspend, terminate, microVM death:** no line. These close the agent connection, so the wait fails. `Micro-VM died` reports the death. - **Graceful shutdown:** no line. The drain signals the workloads, so their exits are intended. - **A container that exits by itself at the same time as a suspend or a terminate:** a line, if the agent reports the exit before the stop. The gVisor worker cannot tell this case from the stop and writes none. - **An exit in the last milliseconds before a suspend:** the line can come at the next restore, with the restore time, or not at all. With the kill 1 to 5 ms before the VM pause, 5 of 10 test runs gave no line. - **Restore.** A container whose exit was collected before a snapshot gives no second line after a restore. If the exit was not collected, each restore of that snapshot gives the line. - **Drain.** After the watch collects an exit, the agent has no record of that process, and the drain's SIGTERM and wait get `NotFound`. The drain now reads that as "already exited". Today's worker does not hit this case. Tested on a GKE cluster, kata agent 4.3.1, with this change and agent-substrate#3263 applied to the deployed version: - Output of 109 KB to stdout or stderr, then exit: all bytes arrive, one line for each container, 1 to 2 ms after the last output. - A container that exits during a boot: its output and one line, also when the boot then fails on the wakeup probe. A failed boot returns with no delay. - SIGKILL to the container after a restore: code 137. - SIGKILL just before the VM pause of a suspend: one line with code 137 at the next restore, also when the wakeup probe then fails. - Suspend, delete, a killed VMM, and a pod shutdown: no line and no warning, also with a wait in progress. The suspend and delete times do not change. Before the rebase on agent-substrate#3263, the same rule also passed these: a 1.3 MB output, SIGKILL on a cold boot, an actor with six containers, and SIGKILL 10 ms or more before the VM pause (one line, before `Actor checkpointed`). No e2e test in this PR. The follow-up from agent-substrate#4145 adds one for both runtimes. Part of agent-substrate#4111 AI use: AI-assisted. I reviewed and tested it. - [x] Tests pass - [x] Docs updated Signed-off-by: Tim Bai <timbai@google.com>
An actor could keep writing without a newline until its worker ran out of memory. Oversized records could also interrupt `kubectl ate logs` for other actors on the worker. `WrapContainerLogs` now limits each input line or text chunk to 32 KiB before JSON encoding. JSON objects up to that limit keep their fields. Longer lines stream as plain-text `message` chunks that preserve UTF-8 boundaries. Oversized JSON lines lose their structure. Each non-final chunk carries `ate.log.partial: true`. MicroVM records identify stdout or stderr with `log.iostream`. gVisor reads a combined pipe and omits that field, even if the actor supplies it at the top level. The actorlog tests passed three times with race detection and shuffling on macOS and Linux. The pipe test checks two successive writes before EOF and the final chunk after close. All 17 repository verifier checks passed on Linux before the last test-only change. The full Linux race run had failures in five packages involving root permissions, overlay mounts, or network interfaces. Fixes agent-substrate#3534 AI tools helped implement, review, and test the changes. --------- Signed-off-by: cloudonly <enrondg@gmail.com> Signed-off-by: Luomu <enrondg@gmail.com>
…substrate#4162) OTel gen_ai events recommend using `execution` to track the entire lifecycle of the agent (in Substrate this is actor_uid) open-telemetry/semantic-conventions-genai#445. To avoid overloading `execution` and to stay consistent with other Substrate observability features (agent-substrate#1041), we should use `activation` instead. Part of agent-substrate#3733 AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated Signed-off-by: Scott Funkenhauser <sfunkenhauser@google.com>
…agent-substrate#4281) Fixes agent-substrate#4277 Releases before agent-substrate#4127 (`v1.0.0` and `v1.0.1`) declared field preview gates with `+ate:preview=<Gate>` doc comments instead of `(field).preview_gate` proto options. Without a fallback, `apitool generate-docs` renders those release pages without preview badges and cannot filter them with the **Show preview-gated features** toggle. - Add `hasFieldAnnotation` and `legacyPreviewGate` in `tools/apitool/internal/model/model.go` so `buildField` falls back to `+ate:preview=<Gate>` comments only when the compiled proto does not declare the `(field)` `FieldOptions` extension (`v1.0.x`). - Keep `main` and future releases restricted to `(field).preview_gate` proto options so legacy comment directives are ignored once the extension is present. - Add `TestBuild_LegacyPreviewGate` in `tools/apitool/internal/model/model_test.go` covering legacy protos (including `#` notes and ignored internal notes) and schemas that declare the `FieldOptions` extension. Verified with `go -C tools/apitool test -race -count=3 -shuffle=on ./...`, `go -C tools/apitool run . validate`, and `hack/site.sh content` (confirming `v1.0.0`, `v1.0.1`, and `latest` all emit `ExternalVolumes`, `GoldenEgressPolicy`, and `PerTemplateSnapshotLocation` badges). AI disclosure: Used Antigravity (Gemini) to implement the legacy fallback and unit tests; I reviewed the diff and verification results. Signed-off-by: Pancho <panchoruy@google.com>
…rate#4054) Fixes agent-substrate#2935 stageVolume and unstageVolume joined the raw volume ID under the staging prefix. An ID with / or .. could escape that prefix. Rejecting / would break legitimate CSI IDs such as GCE PD paths. agent-substrate#3744 keeps / in ExternalVolume.volume_id and asks atelet to stop joining the raw ID into the staging path before that resource reaches a node. The staging path is now `<prefix>/<driver>/<sha256(volumeID)>/mount`. The digest is one path component, IDs are unique only within a driver, and stage and unstage use the same path. Tests cover `..`, absolute paths, and nested IDs. A volume already staged under the old raw-ID path will not be found at the new path on unstage after this lands. This change does not address CSI NodeSocketOverride TLS. AI use: an AI assistant drafted the implementation and this text; I reviewed every change. ### Upgrade note: CSI staging paths **Before upgrading `atelet`:** On each affected node, suspend running actors that use external CSI volumes. Wait for any snapshots you need to be durable and confirm the old volume mounts have been cleaned up before upgrading. Delete an actor only if you no longer need it. Resume suspended actors after the upgraded `atelet` is ready. **If the node was upgraded first:** The new `atelet` looks for the hashed staging path when unstaging a volume. It won't find a mount left at the old path, so cleanup can leave a stale mount behind. Depending on the CSI driver, that can also interfere with staging the volume again. **Recovery:** On the affected node, verify the exact legacy mount under `/var/lib/ate/staging/` and confirm that no actor or process is using it. If the CSI driver has a documented cleanup procedure, use it. Once the legacy mount is unmounted, remove only its empty staging directory. Do not delete volume contents or remove directories that are still mounted. --------- Signed-off-by: Anpoo Sivanadi <sivanadi08@gmail.com>
…ServiceAccount token (agent-substrate#4125) The ate-api-server, atelet and atenet-router pods each run a sidecar next to the container that calls the Kubernetes API. Kubernetes mounts the pod's ServiceAccount token into every container, so the objectstore-plugin sidecars and Envoy held a credential they never use. Envoy parses untrusted ingress traffic, and agent-substrate#3651 lets operators run a provider's image as the objectstore-plugin. A compromise of either would get the pod's Kubernetes API permissions. Automount has no per-container setting. These pods now turn it off and mount a `kube-api-access` projected volume (`token`, `ca.crt`, `namespace`) only into the client container, at the path client-go reads. No code or flags change. In Cloud SQL installs, the `cloud-sql-proxy` sidecar in ate-api-server also stops getting the token. It authenticates through Workload Identity, not a Kubernetes token. The token test from agent-substrate#3466 now checks each container. `kubeAPIClients` names the one container per workload that calls the API. That container must get a complete token at the standard path, and no other container may get one. In the agentgateway router variant the overlay replaces the client container, so that pod now gets no token. That is correct, since nothing in it calls the API. Fixes agent-substrate#3469 AI use: AI-assisted, I reviewed and tested it. - [X] Tests pass - [ ] Docs updated --------- Signed-off-by: Ivy <igooch@google.com>
Part of agent-substrate#3887. Volumes shared across actors come with the ExternalVolume work in agent-substrate#1637. Containers run as their image's `USER` since agent-substrate#2392, and nothing set ownership on external volumes, so non-root containers couldn't write to them. atelet now gives each external volume the primary group of the non-root containers that mount it, through `volume_mount_group` for drivers that support `VOLUME_MOUNT_GROUP`, and otherwise with chgrp plus owner and group rwx and setgid, keeping the others bits as Kubernetes `fsGroup` does. The chgrp is best effort. If the filesystem refuses it, like root_squash NFS or FUSE, atelet logs a warning and mounts the volume as it is. Drivers that report `VOLUME_MOUNT_GROUP` now receive `volume_mount_group`. Only unit tests cover that path, since `ate-setup` installs no driver that supports it. AI use: AI-assisted with Claude Code. I reviewed the diff. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Johnny Shehade <johnnyshehade@google.com>
…rate#4021) Shared Volumes (agent-substrate#1637) introduces an atespace-scoped `ExternalVolume` resource in agent-substrate#3744. A later PR will introduce a status field for this API, however the name `ExternalVolumeStatus` is taken by the message under `ActorStatus.external_volumes`, which is one actor's view of a volume it mounts. This renames that message to `ActorExternalVolumeStatus` and will merge before agent-substrate#3744. The `ExternalVolumes` wrapper and `ActorStatus.external_volumes` are unchanged. `ExternalVolumes.volumes` keeps its name and number; only its element type changes. No field names, numbers or validation tags change. The custom validator for `volume_context` in `apivalidation` is renamed to match the generated name. The message carries a TODO to delete it once `ExternalVolume` replaces `ActorStatus.external_volumes`. **Breaking check.** `buf breaking` reports a rename as a delete plus an add. Without an override, exactly two rules fail: `PACKAGE_MESSAGE_NO_DELETE` and `FIELD_SAME_TYPE`. `buf.yaml` gains an `ignore_only` entry for those two rules on `api/ateapi/v1/ateapi.proto`. `ignore_only` keys on the file path, so while the entry is on `main` it disables both rules for every message in that file, not only the renamed message. It carries a TODO and is removed when the `ExternalVolume` API lands in agent-substrate#3744. **Compatibility.** `ate-api-server` stores resources as binary protobuf keyed by field number, and no field number changes, so stored actors read back unchanged. protojson writes field names, not message names, so `kubectl ate get actor -o yaml` output is also unchanged. What changes is the Go type name in the public `go.ate.dev/substrate/api/ateapi/v1` package and the proto full name of the message. **AI use.** Claude Code (Claude Fable 5.1) wrote this change from a written brief: the proto edit, the search-and-replace in the hand-written Go files, the `buf.yaml` override, and the local verification. Claude Code (Claude Fable 5.2) also rebased the branch onto main, resolved the conflicts, and made the changes requested in review. I reviewed the diff. The first review comments on this PR were posted by an AI agent I ran; the fixes for them were also written with Claude Code and reviewed by me. **Verified locally** - `go build ./...` and `go vet ./cmd/ateapi/... ./api/...` - `go test -race ./cmd/ateapi/...`, all 17 packages pass, including the Docker-backed store, authz and controlapi suites - `go -C tools/apitool run . validate`, all 20 rules pass with no exemption changes - `hack/verify/proto-breaking.sh` passes with the override and fails on exactly the two listed rules without it - `hack/verify-all.sh`. Every verifier passes except `proto-fmt.sh`, which cannot run on this machine because `clang-format` is not installed. CI covers it. **Not verified** - e2e tests and `proto-fmt.sh`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Elijah Rodriguez <elijahrb@google.com>
agent-substrate#4266 declares `--no-atenet-router` and `--no-atenet-egress` and rejects a set value. This PR sits on agent-substrate#4266 and adds the install logic behind them: the first commit here is that PR, so please only review the last two. With a setting, `deploy ate-system` and `deploy atenet` do not apply the objects of that gateway on both dataplanes. Without `atenet-egress` they also skip Secret `egress-mitm-ca-pool` and the bundled credential provider, and need no `--credential-provider`. They wait only for the Deployment they install. `ate-setup` still rejects `--no-atenet-router` and `--no-atenet-egress`. Follow-up PRs drop the egress address that ate-api-server sends to actors, reject the settings that only a skipped gateway reads, and then accept the two settings. **Testing**: On kind, with the settings accepted by the follow-up changes, `deploy ate-system` on a new cluster without `atenet-egress`, and without `atenet-router`, completes with no object of the skipped gateway. Part of agent-substrate#3870 AI use: AI-assisted for the diff, the unit tests and the kind runs. - [x] Tests pass - [x] Docs updated (none needed beyond agent-substrate#4266) --------- Signed-off-by: Yuan Gao <ypgao@google.com>
…nt-substrate#3777) Fixes agent-substrate#3779 Resuming an actor from a memory snapshot could scan the worker fleet twice. The scheduler first looked only for workers able to restore the snapshot's memory state. If none had room, it dropped that requirement and scanned again, accepting any worker of the same sandbox class for a cold boot from the snapshot's files. Each scan locks the worker cache and copies the fleet, and the retry had to be mirrored wherever an existing assignment is re-checked. The scheduler now does this in one pass. It rates each worker by how much of the snapshot it can restore and keeps only the best-rated workers that have room. A worker that can restore memory state always wins over one that can only cold boot, and the existing random choice applies within that group. Callers state up front whether a cold boot is acceptable. The set of workers an actor can land on and the choice among them are unchanged. Only the number of scans changes. AI use: AI-assisted, I reviewed and tested the changes. - [x] Tests pass - [x] Docs updated (none needed; the existing docs already describe the cold-boot fallback) --------- Signed-off-by: Shrutiya <shrutiyam@google.com>
…nt-substrate#2953) A canceled CONNECT (the router reset the stream, or the actor was deactivated for a checkpoint) made `relayWithHalfClose` close the actor side and return. Its actor-to-router goroutine could still be writing. Go's HTTP/2 server panics when a ResponseWriter is used after the handler returned, and nothing recovers that goroutine. The worker process exits and every actor it hosts is lost: ``` panic: Header called after Handler finished net/http/internal/http2.(*responseWriter).FlushError ... internal/atunnel/ingress.flushingWriter.Write ``` The gVisor worker uses the same code. **Change.** On cancel, abort the downstream first, then wait for the copy to finish before returning. - HTTP/2: a write deadline at a fixed past time. It resets the stream at once, so a copy blocked on the router's flow-control window returns too. A stream the router reset is closed already and gets no reset. - HTTP/1.1: close the hijacked connection. - Both listeners set `WriteByteTimeout` to 10 s. Go writes the reset after the frame in flight, so a router that stopped reading the connection would hold the wait until the checkpoint deadline. The timeout closes that connection, which ends the copy. A reverse proxy response blocked on such a connection ends the same way. `docs/guides/dataplane-timeouts.md` lists the timeout. **On the wire.** A tunnel that is open when its actor is deactivated now ends with `RST_STREAM(INTERNAL_ERROR)`. Before, it ended with END_STREAM and `RST_STREAM(NO_ERROR)`, and a tunnel whose copy was blocked on the stream window stayed open. **Tests.** - The relay does not return while the copy is inside a Write, and it aborts the downstream on cancel. - An HTTP/2 CONNECT whose client stops reading the stream: Deactivate still returns and the client sees a reset. - A client that stops reading the connection: the write timeout closes it and Deactivate returns. - A stream the router reset gets no reset, and the deadline is in the past when the relay sets it. Each fails without its part of the change. The package passes with `-race`. - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR --------- Signed-off-by: Davanum Srinivas <davanum@gmail.com>
Part 1 of Shared Volumes agent-substrate#1637 (design: [Substrate Shared External Volumes](https://docs.google.com/document/d/13fgjsGTmK9_gfp-I9NZl66FklQgbddCmRehedXdsXiU/edit?tab=t.4n3ofxm0prp9)). Depends on agent-substrate#4021, which frees the `ExternalVolumeStatus` name. Until it merges, this PR also shows its two commits and `hack/verify/proto-breaking.sh` fails. Review the last commit. An `ExternalVolume` is an atespace-scoped record of a storage volume. It is read-only for users for now: the server creates the record. `status.csi` is a `CsiVolumeStatus` holding `driverName`, `volumeId` and `volumeContext`, which the node plugin needs to mount the volume. - Resource, Postgres tables (`000002_external_volumes.sql`; `external_volumes` is `ON DELETE RESTRICT` to atespaces), store methods and contract tests. `external_volume_keys` keeps `(driver_name, volume_id)` unique across atespaces. - `GetExternalVolume` and `ListExternalVolumes`. They are not behind the `ExternalVolumes` preview gate, so records stay readable with the gate off. There is no Create, Update or Delete RPC. - OpenFGA `external_volume` type. Atespace viewers get and list. - `kubectl ate get external-volume`, docs. Nothing creates an `ExternalVolume` yet, so the functional tests cover only `NOT_FOUND`, the empty list, validation and authorization. The store keeps `CreateExternalVolume` and `DeleteExternalVolume` for the follow-up that writes records. Validation: `status.csi` is set once (`+k8s:update=NoModify` and `NoUnset`), and `status` cannot be unset. `volume_context` is bounded to the CSI spec's 4 KiB limit for map fields: at most 128 entries, 256-byte keys, 4095-byte values. validation-gen only generates code for types a request carries, so nothing enforces the tags yet. The two custom checks are kept as `ValidateCsiVolumeStatusID` and `ValidateCsiVolumeStatusContext` until a request carries a `CsiVolumeStatus`. Changed since the earlier review rounds: `CreateExternalVolume`, `DeleteExternalVolume`, the global-owner create permission, and `kubectl ate {create,delete} external-volume` are removed. The fields moved from the top level to `status.csi`. Follow-ups: 1. The server records each volume it provisions for an actor as an `ExternalVolume` (agent-substrate#3746). agent-substrate#2935 (staging path built from the raw volume ID) lands first, since `volumeId` allows `/`. 2. An `ImportExternalVolume` RPC to register a volume that already exists in the storage system. 3. Actor references on the record, then sequential and concurrent sharing. AI use: Claude Code drafted parts of the implementation, the rework to the read-only shape, the review fixes and this description; I reviewed every change. - [x] Tests pass: `go test -race` for `cmd/ateapi/...` (apivalidation, authz, store on Postgres, controlapi, the functional suite) and `cmd/kubectl-ate/...`; golangci-lint, gofmt, proto-fmt, boilerplate, codegen. Not run locally: `apitool validate`, the rest of `hack/verify-all.sh`. No e2e: nothing creates the resource on a cluster yet. - [x] Docs updated --------- Signed-off-by: Elijah Rodriguez-Beltran <elijahrb@google.com> Signed-off-by: Elijah Rodriguez <elijahrb@google.com>
Adds `v8` (gVisor nightly `2026-12-02`, `google/gvisor@ce0884fa5472`) as `defaultVersion` in `gvisor-default` while keeping `v6` and `v7` enabled so actors with older memory snapshots still restore. Updates the `SandboxConfig` example in `docs/reference/api-guide.md` to match. This nightly includes the sub-container restore fix (`google/gvisor@61d3a87e5a4f`) and host filesystem seccomp filter tightening on top of `release-20261130.0`. Adds arm64 HWCAP bits 24-27 (`dit`, `uscat`, `ilrcpc`, `flagm`) to `arm64CPUFeatures` in `internal/hardware/cpufeatures_table.go` so `atelet` encodes `runsc cpu-features` output from this build on arm64 nodes. Fixes agent-substrate#4304 AI use: AI-assisted for release diff analysis, drafting the patch, and running tests; I reviewed it. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Fabricio Voznika <fvoznika@google.com>
Today `manifests/ate-install/ate-api-server.yaml` hardcodes ate-api-server's `--default-egress-gateway-address=atenet-egress.ate-system.svc:443`. To support pluggable PEPs agent-substrate#3869, introduce a new flag `--default-egress-gateway-address` to set that argument on `deploy ate-system` and `deploy apiserver`. The default is the same address `atenet-egress.ate-system.svc:443`. An empty value leaves actors with no TCP egress. To upgrade: `ate-setup` now replaces the address argument in the manifest. Verified on a kind cluster with an unreachable address: `deploy apiserver --default-egress-gateway-address=192.0.2.1:9443` rolls ate-api-server out with that argument, and a new actor's egress in `TestActorEgress` fails. With an empty value it fails at once, and without the setting the test passes again. Part of agent-substrate#3870 AI use: AI-assisted for the diff and the test runs. - [x] Tests pass - [x] Docs updated Signed-off-by: Yuan Gao <ypgao@google.com>
`deploy ate-system` and `deploy atenet` now delete what an earlier deploy applied for a skipped gateway: - its workload objects - also the bundled credential provider for `--no-atenet-egress` Three things stay: - The NetworkPolicy of the gateway and the router PodMonitoring. `deploy atenet` applies neither, so a gateway that it installs again needs the NetworkPolicy in place. - An object that `ate-setup` never applied. The delete needs a server-side apply by `ate-setup` in the `managedFields` of the object. The API server records no manager for an object that sets no field, such as ServiceAccount `k8s-credential-provider`. Such an object goes when `ate-setup` applied another object of the same gateway or of the provider. - Secret `egress-mitm-ca-pool` and ConfigMap `k8s-credential-provider-namespace-policy`. Nothing changes for a user yet. `ate-setup` still rejects a set `--no-atenet-*` value. Not handled yet: A gateway that `ate-setup` installed and another tool took over later still holds the apply by `ate-setup`, so the first deploy with the setting deletes it. Unit tests cover what a deploy deletes and what stays. They seed a fake cluster through the field manager that the API server uses, so each object holds the `managedFields` that a real server writes. A manual run on kind with the `envoy` dataplane, with the settings accepted by a follow-up change, covers both commands. Each command with a setting exits 0 and leaves only the objects above. Part of agent-substrate#3870 AI use: AI-assisted for the diff, the unit tests and the kind run. - [x] Tests pass - [ ] Docs updated (none needed) Signed-off-by: Yuan Gao <ypgao@google.com>
Fixes agent-substrate#4341 ## Motivation `workercache.Cache.watchEvents()` currently schedules full paginated `ListWorkers` relists with an unjittered `time.NewTicker(5 * time.Minute)`. When multiple `ate-api-server` replicas roll out together at large worker counts, they fire periodic `ListWorkers` scans in lockstep every 5m, creating synchronized read spikes against PostgreSQL. Additionally, after a watch disconnect + `resync()` (which already runs a full `relist()`), the old ticker could fire another full `ListWorkers` immediately afterward. ## Changes ### `cmd/ateapi/internal/workercache` - Replace `time.NewTicker(c.relistInterval)` in `watchEvents` with a `time.NewTimer` jittered via `wait.Jitter(c.relistInterval, 0.2)` (`[1.0×, 1.2×]`, spreading `5m` relists across a `60s` window and re-jittering every cycle). - Reset the relist timer after `resync()` completes so a fresh full relist isn't immediately followed by a redundant periodic relist. - Treat `relistInterval <= 0` safely as disabled periodic relists instead of panicking in `time.NewTicker`. ## Verification - Added `TestNextRelistDelay_JitteredWithinBounds`, `TestCache_Relist_NonPositiveIntervalDisablesPeriodicRelist`, and `TestCache_Relist_ContinuesAfterDisconnectResync`. - Ran `go vet ./cmd/ateapi/internal/workercache/...` and `go test -race -count=1 ./cmd/ateapi/internal/workercache/... ./cmd/ateapi` — all passed. --- AI use: Implementation and unit tests were drafted with an AI coding assistant and verified with `go vet` and `go test -race`. --------- Signed-off-by: Vicente Ferrara <vicenteferrara@google.com>
…gent-substrate#3631) Fixes agent-substrate#3626 Fixes a suspend regression in benchmarks after agent-substrate#3353 / agent-substrate#3485: - agent-substrate#3485 starts write-out of every snapshot as soon as it's taken. Because `atelet` only deletes the previous snapshot after the next one finishes, the disk is still writing ~520 MiB that is about to be unlinked when the next checkpoint starts, and that checkpoint stalls behind it in `balance_dirty_pages`. Before agent-substrate#3353 nothing forced the write, so the old snapshot's dirty pages were simply dropped when `atelet` deleted it. - `snapshotcache.StartWriteback` now takes a `flush func() (bool, <-chan struct{})`. While `flush` returns false, poll passes still close files that are clean or unlinked without starting write-out; `flush` is re-checked on each pass or immediately when its channel closes, and write-out restarts from the fast initial poll interval. - `memborrow.Ledger.Tight()` starts background write-out once unbooked memory left after active loans drops to `limit/3`, free pod memory drops below `margin`, or a placement is blocked in `Wait` (`Wait` also closes a wakeup channel so sleeping writers re-check immediately). `ateworker-gvisor` passes `Tight` via `checkpointFlush` when the pod lent the whole checkpoint and `nil` otherwise so pages outside the ledger start flushing right away. `ateworker-microvm` passes `nil` so write-out starts immediately as before. - Why `limit/3` (hardcoded default for now, can be tuned or exposed later if workloads need it): I also tested `0` headroom (`unbooked - bytes < 0`), which kept roomy pods fast (`780ms` p99) but delayed write-out onto resume in 100% bin-packed pods (`7.8s -> 12.0s` p50), and a Linux `vm.dirty_ratio`-style `20%` dirty cap (`bytes >= limit/5`), which sped up bin-packed (`5.8s` resume p50) but tripped on back-to-back ~530 MiB checkpoints in a `4Gi` roomy pod (~26% overlap before `atelet` unlinks the prior snapshot, `14.0s` p99). `limit/3` unbooked headroom keeps roomy pods in page cache while starting write-out early on packed workers. Tested on GKE across gVisor and microVM (0 OOM kills, 0 worker restarts; preliminary benchmark results are posted in the comments below): - gVisor roomy (`4Gi` pod limit and no pod limit, 1 x 512Mi actor) - gVisor half-packed (`5248Mi` pod, 3 x 1Gi actors) and 100% bin-packed (`5248Mi` pod, 5 x 1Gi actors) - gVisor agent-substrate#3353 tight-pod OOM test (`1088Mi` pod, 4 x 256Mi actors, 6 concurrent waves) - microVM roomy (`4Gi` pod limit, 1 x 1Gi actor, and no pod limit, 5 x 512Mi actors) - microVM half-packed (`4272Mi` pod, 2 x 1Gi actors) and 100% bin-packed (`3236Mi` pod, 3 x 1Gi actors; `1132Mi` tight pod) AI use: AI-assisted debugging, benchmarks, and implementation. I reviewed and tested everything. - [x] Tests pass --------- Signed-off-by: Anna Pendleton <13793293+annapendleton@users.noreply.github.com> Co-authored-by: Anna Pendleton <13793293+annapendleton@users.noreply.github.com>
…HTTPS origins (agent-substrate#4297) Part of agent-substrate#3648 ## Why For an `https` rule the egress gateway verifies the origin against the public roots in the Envoy image, so an origin signed by a private CA fails. This PR lets an operator replace the gateway's upstream roots with a bundle from a ConfigMap. The setting is gateway-wide. ## What's changed: - `ate-setup` setting `--egress-upstream-ca-bundle-configmap NAME[/KEY]`. It names a ConfigMap in `ate-system`, and the key defaults to `ca.crt`. It requires the Envoy dataplane. - The three MITM upstream clusters in `atenet-egress.yaml` read their roots from a file SDS resource, `egress_upstream_validation_context`, in place of an inline `trusted_ca`. Envoy only reloads roots that come through SDS. The default resource names the image roots, so an install without the setting trusts what it did before. - With the setting on, `ate-setup` points that resource at `/run/egress-upstream-ca/ca-bundle.pem` with a `watched_directory`, and mounts the ConfigMap key there on the `envoy` container. A CA rotates by editing the ConfigMap, with no gateway restart. - The bundle **replaces** the public roots, so operators should pre-merge public and private CA if needed. Followup: an e2e to cover the new use case. AI use: I used Claude Code to write the code, I reviewed the change and verified it on kind. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Yufan Su <yufans@google.com>
) Part of agent-substrate#1661. - Adds `tokenexchange.Broker`, minting `TokenExchangeSource.subject_actor_jwt` through `actorjwt.Minter`, exchanging via `Client`, and caching tokens per actor (atespace/name) and SHA-256 of an internal `tokenexchangepb.TokenCacheKey` proto (`internal/proto/tokenexchangepb/cachekey.proto`) in `cache.Expiring` (matching `actorjwt.Minter`). - Reuses a token until a third of its lifetime or 30 seconds remains (60 seconds without `expires_in`). Detached singleflight exchanges use a 10-second deadline, skip already-canceled callers, and wrap mint errors with `ErrMint` (mapping context errors so timeouts retry as 503). - Updates `Client.Exchange` (per @ahmedtd's review) to anchor `ExpiresAt` to before `httpClient.Do` so request latency and backend processing time are not added to `expires_in`, and to reject access tokens exceeding `16 * 1024` bytes as `FailedPrecondition`. Nothing calls the broker until agent-substrate#3345 wires it into `applyEffects`. Cache keys omit actor UID (matching `actorjwt.Minter`), so a recreated actor can inherit a cached token until both caches refresh. Testing: `go vet`, `go test -race -count=5` on `cmd/atenet/internal/router/egress/tokenexchange`, `go test -race` on `internal/protoredact`, and `hack/verify/{boilerplate,codegen,gofmt,golangci-lint,proto-breaking,proto-fmt}.sh` pass; full cluster e2e was not run. AI use: AI-assisted for code and tests. - [x] Tests pass - [ ] Docs updated (none until agent-substrate#3349) --------- Signed-off-by: Wanxin Yuan <wyuan1704@gmail.com> Signed-off-by: Max Thompson <maxthomp@google.com> Co-authored-by: Wanxin Yuan <wyuan1704@gmail.com>
…ent-substrate#3592) `python -m evaluate` judges stored runs, local or `gs://`, with the runner's code, to try new thresholds or to backfill older runs. - A run in the runner's layout reads other tests' runs (`from_test:`) the same way as in the runner; `gs://` runs download only the artifacts sources request. - Outputs go to `--out`, never into the stored run. - `--check-config` validates a tests file offline. Part of agent-substrate#3298. Last of four: agent-substrate#3551, agent-substrate#3550, agent-substrate#3552, agent-substrate#3592 (this). AI use: AI-assisted, I reviewed and tested it. Goodput matches the agent-substrate#2526 prototype on 248 stored Prow runs. - [x] Tests pass - [x] Docs updated Signed-off-by: Haowei Cai <haoweic@google.com>
… retry (agent-substrate#3359) Under load, a microVM checkpoint or restore can fail because cloud-hypervisor is slow to answer its api-socket. Nothing has changed at that point that a retry can't redo, but the worker returns a plain error and ateapi crashes the actor. We saw this crash an actor on an untuned node under snapshot load (restore: VMM api-socket not ready after 15s). Part of agent-substrate#3046 - Checkpoint: `WaitReady` now runs before `tunnel.Deactivate`, so a failed wait leaves the actor serving. A `WaitReady` timeout returns Unavailable while the worker still tracks a running VMM and the checkpoint deadline has not passed. After three unanswered waits in a row on a live VMM, the worker returns Internal so the actor crashes. - Restore: `LaunchVMM` and `RestoreWithNetFDs` timeouts and transient api-socket errors return Unavailable. The existing defers stop the VMM and undo host state. Errors CH itself returns, other socket errors, and a CH that exited during vm.restore stay Internal. - `ch.WaitReady`'s timeout error matches the new `ch.ErrNotReady`. This builds on agent-substrate#2744 (restore) and agent-substrate#3123 (checkpoint), which keep Unavailable through atelet. AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [ ] Docs updated --------- Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
…gent-substrate#4270) Part of agent-substrate#3917 deploy.sh --delete has stopped on "ACTOR_MEMORY_BYTES: unbound variable" since agent-substrate#2769: substitute fills the actor limits into every manifest, the pool's included, but only deploy() set them. So --delete never removed the WorkerPool or its namespace, and the orchestrator's run_no_check hid the failure. Found by Anish while testing the storage benchmarks agent-substrate#4262 . Both values are now computed before the action runs. Tested: substitute on the pool manifest with delete's variables fails on main and succeeds with the fix; hack/verify/shellcheck.sh passes. Signed-off-by: Parnika Mandewalkar <pmandewalkar@google.com>
…-substrate#4131) Benchmark runs record client-side latency, sampled trace spans, and Prometheus metrics, so diagnosing CPU regressions, memory growth, or goroutine buildup in Go daemons requires manual cluster access during a run. Part of agent-substrate#3954 (1 of 3: adds opt-in `pprof` listeners across the Go binaries, paired with agent-substrate#4132 and agent-substrate#4133). - `internal/serverboot/pprofserver` serves the five `net/http/pprof` handlers on a private `http.ServeMux` (since importing `net/http/pprof` registers them on `http.DefaultServeMux`) and stays disabled when `--pprof-listen-addr` / `ATE_PPROF_LISTEN_ADDR` is empty. - `ate-controller` propagates `--worker-pprof*` settings to `WorkerPool` pods via `ATE_PPROF_*` environment variables rather than CLI flags so older worker images do not exit on unknown flags during rollouts. - Adds `T-44` under Misconfiguration Risks in `docs/security/threat-model.md` (and `docs/threats.json`) for enabling benchmark-only `pprof` listeners on a cluster serving real actors. AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Sairaj Pokale <sairajpokale@google.com>
…-substrate#4132) Benchmarks need an install-time switch to enable `:6060` `pprof` listeners, gRPC method goroutine labels, and scrape ingress on the instrumented `ate-system` and worker Go workloads without changing default cluster installs. Part of agent-substrate#3954 (2 of 3: pairs with the `pprofserver` flags in agent-substrate#4131 and the runner-side observer in agent-substrate#4133). - **Built-in `ate-setup` setting (`--pprof=off|on|contention`, `ATE_INSTALL_PPROF`):** Wired as a built-in setting so benchmark profiling does not depend on `agent-substrate#3179`. `on` layers `manifests/ate-install/components/pprof` (enabling `:6060` on `ate-api-server`, `ate-controller`, `atelet`, `atenet-router`, `atenet-egress`'s `ext-proc`, and worker pods through `ate-controller`, skipping `agentgateway` and `fake-atelet`), and `contention` layers `components/pprof-contention` on top to sample 1 in 10 mutex contention events and about one blocking event per 1ms spent blocked. - **Exclusion labels:** `components/agentgateway`, `components/agentgateway-egress`, and `components/fake-data-plane` label their workloads (`ate.dev/dataplane: agentgateway`, `ate.dev/fake-atelet: "true"`) so `pprof` and `pprof-contention` skip them via `labelSelector`. Without those selectors, strategic-merge patches inject an imageless `atenet-router` or `ext-proc` container into `agentgateway` Deployments and expose an unserved port on `fake-atelet`. - **NetworkPolicy:** `components/pprof` appends a separate ingress rule on `ate-system-observability` for TCP `port: pprof` mirroring `ate-api-server`'s `api-access` peer (admitting non-worker pods in namespaces labeled `ate.dev/api-access: "true"`, blocking worker pods and unlabeled namespaces, and keeping `k8s-credential-provider` excluded). Both component headers and the `--pprof` help text warn never to use them on a cluster serving real actors. AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [x] Docs updated --------- Signed-off-by: Sairaj Pokale <sairajpokale@google.com>
…gent-substrate#4232) This spawns the ateworker-gvisor process with effective `GOMAXPROCS=16` on hosts with more than 16 cores. This prevents the creation of `O(num_threads)` Go procs, which end up as host threads which mostly stay idle. On hosts with large core count, these threads do nothing on their own, but they slow down other kernel operations that gVisor does, specifically `pivot_root(2)` which holds a kernel lock for `O(num host threads)` which is the concurrency bottleneck for spawning sandboxes. As actors get created, the number of procs increases (at a rate of 1 proc per 2 actors, experimentally measured to be sufficient to sustain high bandwidth). In addition, the reaper process (PID 1) uses a single proc, since it is essentially doing a single-threaded job and thus doesn't need any more than that. Tested at various concurrency levels (these are very expensive to run so I didn't run them all to significance, but they directionally almost all agree): ``` │ base │ pr │ │ p50-sec │ p50-sec vs base │ OnePodStarts35AtOnce/ResumeActor 510.0m ± ∞ ¹ 475.0m ± ∞ ¹ ~ (p=0.333 n=2) ² Create500Actors50AtATime/ResumeActor 650.0m ± ∞ ¹ 475.0m ± ∞ ¹ ~ (p=0.200 n=3+2) ² ActiveDensity/FirstResumeActor 680.0m ± ∞ ¹ 445.0m ± ∞ ¹ -34.56% (p=0.016 n=5+4) SuspendResume10PerSecond/ResumeActor 110.0m ± ∞ ¹ 110.0m ± ∞ ¹ ~ (p=1.000 n=2) ³ SuspendResume20PerSecond/ResumeActor 160.0m ± ∞ ¹ 140.0m ± 7% -12.50% (n=4+6) TenPodsStart350AtOnce/ResumeActor 3.800 ± ∞ ¹ 3.750 ± 12% ~ (p=0.581 n=4+6) geomean 497.0m 423.9m -14.72% ¹ need >= 6 samples for confidence interval at level 0.95 ² need >= 4 samples to detect a difference at alpha level 0.05 ³ all samples are equal | │ base │ pr │ │ p90-sec │ p90-sec vs base │ OnePodStarts35AtOnce/ResumeActor 685.0m ± ∞ ¹ 675.0m ± ∞ ¹ ~ (p=1.000 n=2) ² Create500Actors50AtATime/ResumeActor 850.0m ± ∞ ¹ 670.0m ± ∞ ¹ ~ (p=0.200 n=3+2) ² ActiveDensity/FirstResumeActor 2.100 ± ∞ ¹ 1.800 ± ∞ ¹ -14.29% (n=5+4) SuspendResume10PerSecond/ResumeActor 140.0m ± ∞ ¹ 135.0m ± ∞ ¹ ~ (p=1.000 n=2) ² SuspendResume20PerSecond/ResumeActor 200.0m ± ∞ ¹ 180.0m ± 6% -10.00% (p=0.010 n=4+6) TenPodsStart350AtOnce/ResumeActor 5.400 ± ∞ ¹ 5.600 ± 18% ~ (p=0.695 n=4+6) geomean 754.8m 693.0m -8.18% ¹ need >= 6 samples for confidence interval at level 0.95 ² need >= 4 samples to detect a difference at alpha level 0.05 ``` Network bandwidth benchmarks (relevant because this uses CPU in the ateworker): ``` │ base │ pr │ │ carried-B/s │ carried-B/s vs base │ ProxyIngressStream1MiB/Actors=70/OfferedRPS=2400 2.341Gi ± ∞ ¹ 2.341Gi ± ∞ ¹ ~ (p=0.743 n=4) ProxyIngressStream1MiB/Actors=70/OfferedRPS=4800 4.679Gi ± ∞ ¹ 4.679Gi ± ∞ ¹ ~ (p=0.743 n=4) ProxyIngressStream1MiB/Actors=70/OfferedRPS=9600 9.269Gi ± ∞ ¹ 9.290Gi ± ∞ ¹ ~ (p=0.343 n=4) ProxyIngressStream1MiB/Actors=70/OfferedRPS=11500 9.694Gi ± 2% 9.274Gi ± 2% -4.33% (p=0.000 n=8) ProxyIngressStream1MiB/Actors=70/OfferedRPS=13200 9.775Gi ± 2% 9.134Gi ± 2% -6.56% (p=0.000 n=8) ProxyEgressStream1MiB/Generators=22/OfferedRPS=7500 6.579Gi ± ∞ ¹ 6.746Gi ± ∞ ¹ ~ (p=0.343 n=4) ProxyEgressStream1MiB/Generators=22/OfferedRPS=9000 6.463Gi ± ∞ ¹ 7.537Gi ± ∞ ¹ ~ (p=0.114 n=4) ProxyBothWays/In=Stream1MiBAt4800RPS/Out=Stream1MiBAt2400RPS/Ingress 4.680Gi ± ∞ ¹ 4.681Gi ± ∞ ¹ +0.02% (p=0.029 n=4) ProxyBothWays/In=Stream1MiBAt4800RPS/Out=Stream1MiBAt2400RPS/Egress 2.237Gi ± ∞ ¹ 2.297Gi ± ∞ ¹ ~ (p=0.314 n=4) ProxyBothWays/In=Stream1MiBAt6000RPS/Out=Stream1MiBAt3600RPS/Ingress 5.826Gi ± ∞ ¹ 5.828Gi ± ∞ ¹ +0.05% (p=0.029 n=4) ProxyBothWays/In=Stream1MiBAt6000RPS/Out=Stream1MiBAt3600RPS/Egress 2.313Gi ± ∞ ¹ 2.552Gi ± ∞ ¹ ~ (p=0.114 n=4) ProxyBothWays/In=Stream1MiBAt2400RPS/Out=KeepAliveAt30000RPS/Ingress 2.342Gi ± ∞ ¹ 2.341Gi ± ∞ ¹ ~ (p=0.229 n=4) ProxyBothWays/In=Stream1MiBAt2400RPS/Out=KeepAliveAt30000RPS/Egress 6.008Mi ± ∞ ¹ 6.008Mi ± ∞ ¹ ~ (p=1.000 n=4) ² ProxyBothWays/In=Stream1MiBAt4800RPS/Out=KeepAliveAt30000RPS/Ingress 4.681Gi ± ∞ ¹ 4.681Gi ± ∞ ¹ ~ (p=0.886 n=4) ProxyBothWays/In=Stream1MiBAt4800RPS/Out=KeepAliveAt30000RPS/Egress 6.008Mi ± ∞ ¹ 6.008Mi ± ∞ ¹ ~ (p=1.000 n=4) ² ProxyBothWays/In=SmallAt60000RPS/Out=Stream1MiBAt1200RPS/Ingress 9.251Mi ± ∞ ¹ 9.251Mi ± ∞ ¹ ~ (p=1.000 n=4) ² ProxyBothWays/In=SmallAt60000RPS/Out=Stream1MiBAt1200RPS/Egress 1.149Gi ± ∞ ¹ 1.149Gi ± ∞ ¹ ~ (p=0.429 n=4) ProxyBothWays/In=SmallAt60000RPS/Out=Stream1MiBAt2400RPS/Ingress 9.251Mi ± ∞ ¹ 9.251Mi ± ∞ ¹ ~ (p=1.000 n=4) ² ProxyBothWays/In=SmallAt60000RPS/Out=Stream1MiBAt2400RPS/Egress 2.297Gi ± ∞ ¹ 2.297Gi ± ∞ ¹ ~ (p=0.057 n=4) ProxyBothWays/In=SmallAt90000RPS/Out=Stream1MiBAt1200RPS/Ingress 13.78Mi ± 2% 13.69Mi ± 2% ~ (p=1.000 n=8) ProxyBothWays/In=SmallAt90000RPS/Out=Stream1MiBAt1200RPS/Egress 1.149Gi ± 0% 1.149Gi ± 0% ~ (p=0.082 n=8) ProxyBothWays/In=SmallAt90000RPS/Out=Stream1MiBAt2400RPS/Ingress 13.83Mi ± 3% 13.78Mi ± 2% ~ (p=0.478 n=8) ProxyBothWays/In=SmallAt90000RPS/Out=Stream1MiBAt2400RPS/Egress 2.074Gi ± 5% 2.276Gi ± 6% +9.73% (p=0.001 n=8) geomean 782.0Mi 791.5Mi +1.21% ¹ need >= 6 samples for confidence interval at level 0.95 ² all samples are equal ``` Fixes agent-substrate#4231 AI use: AI-assisted, reviewed manually - [x] Tests pass - [x] Docs updated Signed-off-by: Etienne Perot <eperot@google.com>
…#4322) Follow-up to agent-substrate#4145 and agent-substrate#4250. The `Actor container exited` record had only unit tests with a fake runtime, and agent-substrate#4145 had no cluster test of a cold boot. `TestContainerExitIsLogged` makes the probe's container exit with a known code while its sandbox stays up, and reads the worker pod's log. - **Record.** One record for the actor, at WARN, with the container's name and the exit code, after the container's last line. Its label group has the actor's identity and no container label. - **Boot paths.** One actor cold-boots and one is restored from a snapshot. A worker starts the watch on each path separately. - **Intended stops.** One actor is suspended while its container runs, and a third actor is deleted while its container runs. The test counts the records after each delete, on each worker pod the actor ran on. A suspend and a terminate must add none. - **Runtimes.** The suite runs on gVisor and on microVM, with no skip. - **Forged record.** Before it exits, the probe writes a line that imitates the record. The worker removes the `ate.*` key from it, so the count stays at one. - **Probe.** The probe fixture gets `/exit?code=N`. It sends the whole response, writes the imitation and a last line, and exits with the code. Tested before the rebase: - kind on arm64 with gVisor: 3 of 3 with `-count=3 -shuffle=on`. - The four PR e2e lanes passed in a fork run on top of agent-substrate#4250 before it merged. - On gVisor the test fails when the watch is removed from `RunWorkload` or `RestoreWorkload` (only the matching case fails), when the worker drops the exit code, and when a terminate writes a record. Part of agent-substrate#4111 AI use: AI-assisted. I reviewed and tested it. - [x] Tests pass - [x] No docs to update --------- Signed-off-by: Tim Bai <timbai@google.com>
…te#3846) (agent-substrate#3865) Why is this needed? (Or link the issue. Open one first for features, API, install or CI changes.) Out-of-tree sandbox gateways and compute drivers (such as the OpenShell driver) authenticating actors via an `ActorJwtSource` egress rule need to verify injected Actor JWTs against `ate-idp-server` OIDC discovery and JWKS endpoints without importing `internal/oidcjwt`. Following the pattern established in agent-substrate#3358 for `pkg/objectstore/actorauthz`, this exports a public verifier API under `pkg/oidcjwt`: - `New(ctx, Config)` initializes the public verifier and fetches OIDC discovery and JWKS keys. - `Verify(ctx, rawJWT)` and `VerifyAt(ctx, rawJWT, now)` validate actor and worker-for-actor JWTs and extract Substrate actor claims (`ActorUID`, `Atespace`, `ActorName`, `Node`). - `hack/verify/package-deps.sh` is updated to ban cloud SDKs and client-go from `pkg/oidcjwt`. - `hack/verify/pkg-external-import.sh` builds and verifies the package from an external module. Fixes agent-substrate#3846 AI use: AI-assisted, I reviewed and tested it. - [x] Tests pass - [ ] Docs updated --------- Signed-off-by: Toka Nani <tokananiy@gmail.com>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Syncs agent-substrate
mainatb440f1e1dintomain, 176 upstream commits.Merge this PR with a merge commit so upstream ancestry is preserved. Never squash or rebase it.
Draft:
kubectl-atedoes not build. Upstream moved to Kubernetesv0.38.0-beta.0(agent-substrate#4053). helm v4.3.1'spkg/action/lazyclient.golacksDeleteWithResultfor client-go 0.38, and no helm release supports 0.38 yet. Options: areplaceto a patched helm, syncing only up to before agent-substrate#4053, or having the installer call the helm CLI.What changes for fork users:
v0.38.0-beta.0. Areplacepinscontroller-runtimeto upstream's pseudo-version, because helm requires v0.25.2. Modules that import this one get the 0.38 beta.ateapimoves to upstream'sserverpackage. The fork's--actor-workflow-deadlineand--atelet-insecureflags now go throughserver.Config.ParseURInow accepts an empty fragment (bare#), which the fork rejected.Related Issues
None. This is a routine upstream sync.
Testing
Run locally on this branch:
go test -raceon every main-module package except the helm-dependent ones. One failure,internal/netns TestSetSysctlReportsAnUnrelatedError, also fails on the fork base: the container's/proc/sysis read-only.go test -raceonpkg/kagent/install/...andcmd/kubectl-ate/...with a-overlaythat adds the two missing helm methods.helm linton the four charts, helm unittest (80/80),hack/render-manifests.sh --checkandhack/verify/crd-chart.sh.hack/verify-all.sh: codegen and licenses pass on Linux. golangci-lint and pkg-external-import fail on the helm break. proto-fmt was not run.Change Type
/kind cleanup
Changelog
Additional Notes
The merge is
463481a2c, with598c317e2andb440f1e1das parents. Upstream now covers these fork patches: therelease-1.0push-branch regex, the golangci-lint cache, thee2e-testcheck name, and the credential provider's nil-authorizer and NotFound bypass. The router's service account hardening is not ported, because the fork's router is agentgateway.AI use: Claude Code prepared the merge, resolved conflicts and ran local validation.