From d81f53084e4ebe59f91a92a8eed9b00b4468f4cd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 04:40:27 +0700 Subject: [PATCH 1/6] docs: edge-exposure note now describes the implemented sessionRef behaviour Re-binding terminates the tunnel instead of re-pointing it; session is polled, not watched; endpoint shape is restricted; status fields are recorded. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 48 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index a6e538a..a019172 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -1,12 +1,12 @@ # Design note: exposing a session to the outside world -Status: **proposal; decisions recorded below.** Nothing here is implemented yet. The group -renames it assumes are **pending**: until [agentops-operator#9](https://github.com/SteadyInfraTech/agentops-operator/pull/9) -and [ai-agent-edge-tunnel#5](https://github.com/SteadyInfraTech/ai-agent-edge-tunnel/pull/5) are -merged, the code still registers `agents.agentops.io` and the bare `agentops.io`. It describes how -[`ai-agent-edge-tunnel`](https://github.com/SteadyInfraTech/ai-agent-edge-tunnel) (a separate -operator that creates short-lived Cloudflare tunnels) attaches to an `AgentSession` without the -two projects sharing a repository, a Go module or a release cycle. +Status: **the edge side is implemented** in +[`ai-agent-edge-tunnel`](https://github.com/SteadyInfraTech/ai-agent-edge-tunnel) +(`spec.sessionRef`, ai-agent-edge-tunnel#6), and both API groups are renamed to `steadyinfra.com` +(agentops-operator#9, ai-agent-edge-tunnel#5). It has not been run against a real cluster with both +operators together. The shared client library (decision 4) is not built yet. This note describes how +`ai-agent-edge-tunnel` (a separate operator that creates short-lived Cloudflare tunnels) attaches to +an `AgentSession` without the two projects sharing a repository, a Go module or a release cycle. ## Goal @@ -32,8 +32,7 @@ Everything the edge operator needs from AgentOps is already in `AgentSession`: | Field read by the edge operator | Meaning | |---|---| | `status.phase` | `Bound` means there is a target to expose. `Pending` waits. `Completed`, `Expired`, `Failed` end the tunnel. | -| `status.endpoint` | In-cluster URL of the bound agent, `http://..svc:`. This becomes the connector's ingress target. | -| `status.assignedAgent` | The `AgentService` name; shown in the edge object's status for debugging. | +| `status.endpoint` | In-cluster URL of the bound agent, `http://..svc:`. This becomes the connector's ingress target. Only that exact shape, with `` equal to the tunnel's own namespace, is accepted. | | `metadata.uid` | Identity of the session the tunnel was created for (see below). | `spec.maxDurationSeconds` is deliberately **not** read. AgentOps already turns it into a phase change @@ -101,19 +100,28 @@ current "expose this Service" behaviour for anything that is not an `AgentSessio Reconciliation, in addition to what the operator does today: -1. **Pending**: the session is not `Bound` (or does not exist yet). Nothing is created in - Cloudflare; status says what it is waiting for. A missing session is retried, not failed, so - the two objects can be applied in either order. -2. **Active**: the session is `Bound`. The connector's ingress target is taken from - `status.endpoint`. The session reference and the resolved endpoint are recorded in status. -3. **Terminated**: the session reaches `Completed`, `Expired` or `Failed`, or is deleted. The - edge operator removes the connector, DNS, Access application and tunnel in its usual order, - then marks the object `Terminated`. -4. **Re-binding**: if the session's `status.assignedAgent` changes, the connector is updated to - the new endpoint; the hostname and Access policy are unchanged. +1. **Pending**: the session does not exist yet, is not `Bound`, or exposes an endpoint the edge + operator will not accept. Nothing is created in Cloudflare; status says what it is waiting for. + A missing session is retried, not failed, so the two objects can be applied in either order. +2. **Active**: the session is `Bound`. Its UID and endpoint are recorded in status + (`status.sessionUID`, `status.sessionEndpoint`) **before** anything is created, and the + connector's ingress target is the recorded endpoint. +3. **Terminated**: the session reaches `Completed`, `Expired` or `Failed`, is deleted, has a + different UID, is being deleted, or is bound to a different endpoint. The edge operator removes + the connector, DNS, Access application and tunnel in its usual order, then marks the object + `Terminated`. A session that merely reports an unexpected phase ends nothing: the tunnel keeps + running and the TTL cap and connector upkeep continue. +4. **Re-binding ends the tunnel; it does not re-point it.** If the session's `status.endpoint` + changes after the tunnel was bound, the tunnel is terminated. An earlier draft of this note + updated the connector in place. cloudflared does not reload its config, and silently re-pointing + an Access-protected hostname at a different agent is the riskier default. A client that needs a + new hostname for the new binding creates a new `AgentEdgeTunnel`. + +The session is read as `unstructured` and polled every 10 seconds, not watched, so the edge +operator starts without AgentOps installed. A tunnel can outlive its session by up to that long. Because the edge object only *reads* the session, it never needs write access to AgentOps -resources. RBAC: `get`, `list`, `watch` on `agentsessions` in the namespaces it manages. +resources. RBAC: `get` on `agentsessions` in the namespaces it manages (polling needs no `list` or `watch`). ## API group From 39849b97d3a355496ccb07aa14da41860a9b022e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 04:46:20 +0700 Subject: [PATCH 2/6] docs: terminal beats pending; teardown is not a deadline Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index a019172..ccc83c1 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -100,8 +100,10 @@ current "expose this Service" behaviour for anything that is not an `AgentSessio Reconciliation, in addition to what the operator does today: -1. **Pending**: the session does not exist yet, is not `Bound`, or exposes an endpoint the edge - operator will not accept. Nothing is created in Cloudflare; status says what it is waiting for. +1. **Pending**: the session does not exist yet, is `Pending` (not yet `Bound`), or exposes an + endpoint the edge operator will not accept. A session that is already `Completed`, `Expired` or + `Failed` is not waited for: terminal beats pending, so an object first reconciled after the session + ended goes straight to Terminated. Clients should treat only `Terminated` as final. Nothing is created in Cloudflare; status says what it is waiting for. A missing session is retried, not failed, so the two objects can be applied in either order. 2. **Active**: the session is `Bound`. Its UID and endpoint are recorded in status (`status.sessionUID`, `status.sessionEndpoint`) **before** anything is created, and the @@ -118,7 +120,10 @@ Reconciliation, in addition to what the operator does today: new hostname for the new binding creates a new `AgentEdgeTunnel`. The session is read as `unstructured` and polled every 10 seconds, not watched, so the edge -operator starts without AgentOps installed. A tunnel can outlive its session by up to that long. +operator starts without AgentOps installed. A tunnel can outlive its session by roughly that long, and longer if the controller, the API +server or Cloudflare cleanup is failing: the interval is a polling period, not a deadline. The +optional `spec.ttl` is also enforced by reconciliation, so it is a cap that holds while the operator +is healthy, not an independent cutoff. Because the edge object only *reads* the session, it never needs write access to AgentOps resources. RBAC: `get` on `agentsessions` in the namespaces it manages (polling needs no `list` or `watch`). From 05e271dc5467c4eb5407e44995b0d31b58a2eff7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 04:59:58 +0700 Subject: [PATCH 3/6] docs: limit Pending retries to before the session is pinned Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index ccc83c1..3416595 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -101,10 +101,14 @@ current "expose this Service" behaviour for anything that is not an `AgentSessio Reconciliation, in addition to what the operator does today: 1. **Pending**: the session does not exist yet, is `Pending` (not yet `Bound`), or exposes an - endpoint the edge operator will not accept. A session that is already `Completed`, `Expired` or - `Failed` is not waited for: terminal beats pending, so an object first reconciled after the session - ended goes straight to Terminated. Clients should treat only `Terminated` as final. Nothing is created in Cloudflare; status says what it is waiting for. - A missing session is retried, not failed, so the two objects can be applied in either order. + endpoint the edge operator will not accept. These are waited for only until the session's UID has + been recorded in status; after that, see Terminated and the unexpected-phase rule below (a pinned + session whose endpoint is rejected or changes terminates the tunnel). A session that is already + `Completed`, `Expired` or `Failed` is not waited for: terminal beats pending, so an object first + reconciled after the session ended goes straight to Terminated. Clients should treat only + `Terminated` as final. Nothing is created in Cloudflare while Pending; status says what it is + waiting for. A missing session is retried, not failed, so the two objects can be applied in + either order. 2. **Active**: the session is `Bound`. Its UID and endpoint are recorded in status (`status.sessionUID`, `status.sessionEndpoint`) **before** anything is created, and the connector's ingress target is the recorded endpoint. From 596a9459686e0d774448876eb3c2d45df52e89d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 06:00:18 +0700 Subject: [PATCH 4/6] docs: endpoint parser leniency is not contract; Pending can have Cloudflare resources after pinning Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index 3416595..2f31efb 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -32,7 +32,7 @@ Everything the edge operator needs from AgentOps is already in `AgentSession`: | Field read by the edge operator | Meaning | |---|---| | `status.phase` | `Bound` means there is a target to expose. `Pending` waits. `Completed`, `Expired`, `Failed` end the tunnel. | -| `status.endpoint` | In-cluster URL of the bound agent, `http://..svc:`. This becomes the connector's ingress target. Only that exact shape, with `` equal to the tunnel's own namespace, is accepted. | +| `status.endpoint` | In-cluster URL of the bound agent, `http://..svc:`. This becomes the connector's ingress target. The parser currently also accepts an omitted port (defaults to 80) and an optional trailing `/`; these are current behaviour, not guaranteed contract. `` must equal the tunnel's own namespace. | | `metadata.uid` | Identity of the session the tunnel was created for (see below). | `spec.maxDurationSeconds` is deliberately **not** read. AgentOps already turns it into a phase change @@ -106,8 +106,9 @@ Reconciliation, in addition to what the operator does today: session whose endpoint is rejected or changes terminates the tunnel). A session that is already `Completed`, `Expired` or `Failed` is not waited for: terminal beats pending, so an object first reconciled after the session ended goes straight to Terminated. Clients should treat only - `Terminated` as final. Nothing is created in Cloudflare while Pending; status says what it is - waiting for. A missing session is retried, not failed, so the two objects can be applied in + `Terminated` as final. While waiting for an unpinned session the operator provisions no + Cloudflare resources; once pinned, Cloudflare resources can exist while the tunnel is still + `Pending`. Status says what it is waiting for. A missing session is retried, not failed, so the two objects can be applied in either order. 2. **Active**: the session is `Bound`. Its UID and endpoint are recorded in status (`status.sessionUID`, `status.sessionEndpoint`) **before** anything is created, and the From e0e8134e6757fc8172bc2954c1115d91721d41a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 06:15:42 +0700 Subject: [PATCH 5/6] docs: TTL starts after provisioning Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index 2f31efb..ea2992d 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -84,8 +84,10 @@ With `sessionRef`, **the session's phase ends the tunnel, not a timer.** Consequ Active, which is why a lifetime copied from the session would go stale. - `maxDurationSeconds: 0` (no limit) means the tunnel lives until the session reaches a terminal phase or is deleted. Nothing in the edge operator needs a finite remaining lifetime. -- `spec.ttl`, if set, is a hard cap: the tunnel ends at `ttl` even if the session is still `Bound`. - Set it when a bounded exposure matters more than session continuity. It is optional. +- `spec.ttl`, if set, starts after provisioning succeeds and caps the tunnel's active lifetime, + even if the session is still `Bound`. Provisioning retries can leave Cloudflare resources + allocated longer than `spec.ttl` before it starts. Set it when a bounded exposure matters more + than session continuity. It is optional. ### Pinning the session identity From 202d80d475f5b3c93507d406d48b081235b707db Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 10:09:48 +0700 Subject: [PATCH 6/6] docs: TTL is not a strict exposure bound Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AuvXe8Sd1zPn6vNm5hzbdH --- docs/design/edge-exposure.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/design/edge-exposure.md b/docs/design/edge-exposure.md index ea2992d..67fc928 100644 --- a/docs/design/edge-exposure.md +++ b/docs/design/edge-exposure.md @@ -84,10 +84,11 @@ With `sessionRef`, **the session's phase ends the tunnel, not a timer.** Consequ Active, which is why a lifetime copied from the session would go stale. - `maxDurationSeconds: 0` (no limit) means the tunnel lives until the session reaches a terminal phase or is deleted. Nothing in the edge operator needs a finite remaining lifetime. -- `spec.ttl`, if set, starts after provisioning succeeds and caps the tunnel's active lifetime, +- `spec.ttl`, if set, starts after provisioning succeeds and limits the tunnel's active lifetime, even if the session is still `Bound`. Provisioning retries can leave Cloudflare resources - allocated longer than `spec.ttl` before it starts. Set it when a bounded exposure matters more - than session continuity. It is optional. + allocated, and the connector serving traffic, before the TTL starts. Exposure can exceed + `spec.ttl` if the expiry is not recorded. The TTL is optional and is not a strict exposure + bound. ### Pinning the session identity