iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

A stack with no telemetry tables makes no Pipelines stream, bucket or log export #2

merged token-free-stack-no-streams was squashed into main as e194fc9 by jonas, 2026-11-26 14:18 UTC. jonas opened it 2026-11-26 14:15 UTC.

## What

A stack with no telemetry tables (mode `off`, which is every stack that a deploy makes now) no longer makes:

- the three Pipelines streams (`events`, `logs`, `spans`),
- the telemetry R2 bucket,
- the two OTLP destinations that export the other Workers' logs and spans,
- the OTLP secret, and the telemetry Worker's public workers.dev address.

The telemetry Worker stays, with the Analytics SQL binding and the `metrics` dataset. `sendEvents` still writes the metric points. A stack with tables (mode `minted` or `given`) declares the same resources as before.

The stack file has one rule: no tables, no streams. It has no second mode for old stacks.

## Why

No code can make a pipeline on a token-free stack's streams, so its rows were written and never read. An account has room for 20 streams, and the dev account was full at 7 stacks (21 of 21 on 26 Nov 2026, 14:14 UTC).

Jonas, on the card `tasks/verify-dev-cloudflare-pipelines-quotas-and-per-mind-usage.md` of `/repos/task-board`:

- 12:33 UTC, to "may I make the core pull request that stops a token-free mind from making them?": "yes rip any mention of this stuff out".
- 14:13 UTC, to "at its next deploy, may an existing mind with no telemetry tables lose its 3 unused Pipelines streams, its empty telemetry bucket and its log export, or must existing minds keep them?": "yes yes but main priority is to keep a clean vanilla alchemy stack file without much edge casing. there aren't many minds so we can also manually delete them if it's not easy to do automatic".

## Effect on a stack that exists

- Mode `minted` or `given` (a stack with tables, the four live minds among them): no change in the declared resources.
- Mode `off`: the next deploy deletes 8 state rows. Six are Cloudflare resources: the three streams, the telemetry bucket, and the two destinations (the log export). `TelemetryOtlpSecret` is the random value that the two destinations sent as a bearer. `TelemetryTablesOfTheMind` names what a mind made itself: its delete removes the pipelines, the sinks and the catalog that the mind's own code made on those streams, and its provider stays registered for this delete alone. Jonas's ask named the streams, the bucket and the export; the secret and that row go with them.
- **A mind that turned its tables on itself** (possible until 25 Nov 2026, with a token that a member gave it) is also in mode `off`. Its bucket is not empty: the next deploy deletes its pipelines, sinks, catalog and the table rows in the bucket (`forceDestroy`). No code can read those rows since 25 Nov 2026. On the dev account no stack of a mind has such pipelines (only the unowned `afoop` names have). A mind that never turned its tables on has an empty bucket.
- `STACK_SCOPES` keeps `pipelines.write`: a deploy needs it for that delete and for stacks with tables.

## Risk map

1. **Highest: the next deploy of a stack in mode `off` deletes resources, and on a mind that turned its tables on itself, the rows of those tables.** Correctness rests on the mode being read right: `telemetryModeOf` reads the state, and a state that cannot be read stops the deploy. A stack with tables that was read as `off` would lose them; that reading is not changed here. Review `core/alchemy/src/stack.ts` first.
2. **The apply of those deletes is not proven.** The plan is proven (below). If a delete fails on a stack, the fallback that Jonas named is a manual delete of that stack's streams and bucket.
3. **The telemetry Worker with no stream** (`http.ts`, `rpc.ts`, `config.ts`): the intake answers 404 with no secret or stream; `sendEvents` skips the stream and still writes `metrics`.
4. **What a person outside can reach:** less than before. In mode `off` the telemetry Worker has no workers.dev address.

## Proof

On the dev account, 26 Nov 2026, 12:36 to 12:41 UTC, with the same patch on iterate/private `2737b23a1` (tools and logs: `~/.iterate/stacks/pipelines-capacity/` on beelink):

1. **A fresh deploy with the stream quota full.** `iterate deploy --domain blumset.com`: exit 0. The account held 21 streams before and after; main gets 422 "Quota exceeded" in that state. The stage had 6 Workers, the files bucket, and no telemetry bucket, stream, sink or pipeline.
2. **The Dash Analytics page, signed in as the mind's member:** `https://dash.blumset.com/analytics` answered 200 and drew its charts ("Events delivered 692 in the last hour", "Events committed 678 in the last 24 hours").
3. **A read-only plan over a stack that has streams** (`alchemy plan`, stage `bimplin-com`): "5 to update, 8 to delete, 5 binding changes"; 63 resources noop. The deletes are the 8 rows named above.
4. **Destroy:** "30 succeeded"; the stage's inventory is empty.

Checks on this branch (rebased on main `5214eaa`): `pnpm install --frozen-lockfile`, `pnpm -r typecheck` and `pnpm -r test` each exit 0. Tests: 9 packages, 3219 pass, 0 fail (core/alchemy 52, core/telemetry-worker 22).

Not in this repository, so they follow apart: `docs/telemetry.md` of iterate/private and the template's `cloudflare.md`.

Session: claude af65f9bb-e33f-44c7-a07b-01ed34ab0b56 on beelink

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Conversation

jonas, 2026-11-26 14:17 UTC

The reviewer's finding (a mind that turned its tables on itself has a bucket with rows, and this pull deletes them at its next deploy) went to Jonas as an ask on the card. His answer, 26 Nov 2026 14:17 UTC, to "a mind that turned its telemetry tables on itself before 25 Nov still has rows in its bucket that no code can read now; may its next deploy delete them too?": "delete". So the code stays as it is and I merge.

Session: claude af65f9bb-e33f-44c7-a07b-01ed34ab0b56 on beelink

Sign in to comment or to merge.

Files

11 files changed

M core/alchemy/README.md
@@ -174,11 +174,12 @@
     dashboard page to delete it on, and the next deploy deletes it again.
   - **`given`:** the state holds `TelemetryToken`, an owner-created token: the stack keeps using
     it. **Do not delete or roll it:** the sinks keep the token they were made with.
-  - **`off`:** neither. The stack makes the telemetry bucket, the three streams and the OTLP
-    destinations, and no catalog, sink, pipeline or token. The stack has no `events`, `logs` or
-    `spans` table: its mind reads Cloudflare's own datasets and `metrics` through
-    `itx.telemetry.query`, with no token. Until 25 Nov 2026 a mind could turn its tables on with
-    a member's token: a destroy removes what such a mind made
+  - **`off`:** neither, which is every stack that a deploy makes now. The stack has no `events`,
+    `logs` or `spans` table, so it makes nothing that only fills them: no telemetry bucket, no
+    Pipelines stream, sink or pipeline, no OTLP destination and no token. Its mind reads
+    Cloudflare's own datasets and `metrics` through `itx.telemetry.query`, with no token. A
+    stack that an earlier deploy gave a bucket, three streams and two destinations loses them at
+    its next deploy, with what a mind made on them with a member's token
     (`src/mind-made-telemetry-tables.ts`).
 - The deploy makes a Realtime SFU app and a TURN key (`src/realtime.ts`), which need the
   permission to make Realtime (Calls) resources: "Calls Write" (`calls.write`), which the deploy
M core/alchemy/src/mind-made-telemetry-tables.ts
@@ -1,10 +1,11 @@
-// mind-made-telemetry-tables.ts โ€” THE TELEMETRY TABLES THAT A MIND MADE ITSELF, AS A RESOURCE. A
-// stack with no telemetry token makes the bucket and the streams. The mind's own code, with a
-// token of the account that a member gave it, may have made the catalog, the sinks and the
-// pipelines on them; the default config has no code that makes them. This resource makes
-// nothing. Its delete removes what the mind made, with the deploy's own credential: the
-// pipelines, then the sinks, then the catalog with its tables. It reads the bucket's and the
-// streams' names from their resources, so a destroy runs it before they go.
+// mind-made-telemetry-tables.ts โ€” THE TELEMETRY TABLES THAT A MIND MADE ITSELF, AS A RESOURCE
+// THAT A DEPLOY ONLY DELETES. Until 26 Nov 2026 a stack with no telemetry token made a bucket and
+// three streams, and declared this resource beside them. Until 25 Nov 2026 the mind's own code,
+// with a token that a member gave it, could make a catalog, sinks and pipelines on them. A stack
+// declares none of this now (./stack.ts), so the next deploy of such a stack deletes the state's
+// row of this resource, before the bucket and the streams that the row names. Its delete removes
+// what the mind made, with the deploy's own credential: the pipelines, then the sinks, then the
+// catalog with its tables. The provider stays for that delete alone.
 import type * as Cloudflare from "@alchemy.run/cloudflare";
 import * as pipelines from "@distilled.cloud/cloudflare/pipelines";
 import * as catalog from "@distilled.cloud/cloudflare/r2-data-catalog";
@@ -14,7 +15,7 @@
 import * as Schedule from "effect/Schedule";
 import * as Stream from "effect/Stream";
 
-export type MindMadeTelemetryTables = Resource<
+type MindMadeTelemetryTables = Resource<
   "Iterate.MindMadeTelemetryTables",
   {
     accountId: string;
@@ -28,7 +29,7 @@
   never,
   Cloudflare.Providers
 >;
-export const MindMadeTelemetryTables = Resource<MindMadeTelemetryTables>(
+const MindMadeTelemetryTables = Resource<MindMadeTelemetryTables>(
   "Iterate.MindMadeTelemetryTables",
 );
 
M core/alchemy/src/stack-bindings.test.ts
@@ -338,7 +338,7 @@
     }
   });
 
-void test("telemetry modes: minted keeps both AccountApiToken resources, given uses TelemetryToken, and off makes the bucket and streams but no token, catalog, sink or pipeline, while other Workers stay identical", async () => {
+void test("telemetry modes: minted keeps its AccountApiToken, given uses TelemetryToken, and off makes no bucket, stream, export, token, catalog, sink or pipeline, while the other Workers' bindings stay identical", async () => {
   const config = MindConfig.parse(CASES["full-cloudflare, no mail forward"]);
   const runMode = (telemetryMode: TelemetryMode) =>
     Effect.runPromise(declaredOf(config, { telemetryMode }) as Effect.Effect<Declared>);
@@ -378,20 +378,13 @@
   assert.equal(given.resources.TelemetryToken, "Iterate.TelemetryToken");
   assert.equal(given.resources.TelemetryCatalogToken, undefined);
   assert.equal(given.resources.TelemetryAnalyticsToken, undefined);
-  // the tables that a mind made itself are only an "off" stack's
-  assert.equal(given.resources.TelemetryTablesOfTheMind, undefined);
-  assert.equal(minted.resources.TelemetryTablesOfTheMind, undefined);
 
-  // Off mode binds the three streams and declares the bucket, the streams and the destinations,
-  // and no token, catalog, sink or pipeline
+  // Off mode binds what reads Cloudflare's own datasets and writes `metrics`, and declares
+  // nothing of Pipelines or R2 for telemetry, and no export of logs and spans
   assert.deepEqual(off.workers.Telemetry, [
     "ANALYTICS:analytics",
-    "EVENTS:Cloudflare.Pipelines.Stream Telemetry_events_stream",
     "ITERATE:plain_text",
-    "ITERATE__OTLP_SECRET:output of TelemetryOtlpSecret.text",
-    "LOGS:Cloudflare.Pipelines.Stream Telemetry_logs_stream",
     "METRICS:Cloudflare.AnalyticsEngine.Dataset",
-    "SPANS:Cloudflare.Pipelines.Stream Telemetry_spans_stream",
   ]);
   for (const declared of [
     "TelemetryBucket",
@@ -400,10 +393,17 @@
     "Telemetry_spans_stream",
     "Telemetry_logs",
     "Telemetry_traces",
-    "TelemetryTablesOfTheMind",
   ])
-    assert.ok(off.resources[declared], `${declared} should be declared when off`);
+    assert.ok(given.resources[declared] && minted.resources[declared], `${declared} with tables`);
   for (const omitted of [
+    "TelemetryBucket",
+    "TelemetryOtlpSecret",
+    "Telemetry_events_stream",
+    "Telemetry_logs_stream",
+    "Telemetry_spans_stream",
+    "Telemetry_logs",
+    "Telemetry_traces",
+    "TelemetryTablesOfTheMind",
     "TelemetryToken",
     "TelemetryCatalogToken",
     "TelemetryAnalyticsToken",
M core/alchemy/src/stack.ts
@@ -8,8 +8,9 @@
 //   mind       the one Worker that hosts the mind's contexts, its repos, files and sandboxes
 //   boundary   the only Worker on the mind's zones: every request and every mail comes in here
 //
-// One more address is public: the telemetry Worker's, on workers.dev, where Cloudflare posts the
-// other Workers' logs and spans with a bearer secret. It answers nothing else.
+// One more address is public on a stack that has telemetry tables: the telemetry Worker's, on
+// workers.dev, where Cloudflare posts the other Workers' logs and spans with a bearer secret. It
+// answers nothing else.
 //
 // `config.topology` says where the mind runs. "full-cloudflare": the mind Worker is in this stack.
 // "external-mind-connects-into-cloudflare-boundary": it runs on a machine of the owner's and
@@ -18,7 +19,7 @@
 //
 // The stack generates four keys (three with an external mind) and keeps one owner-created
 // telemetry API token in state, when it is given one. With a token it makes the telemetry
-// tables; with none it makes their bucket and streams and no tables, and the mind reads
+// tables. With none it makes nothing of Pipelines or R2 for telemetry, and the mind reads
 // Cloudflare's own datasets and `metrics` through `itx.telemetry.query`. It makes no OAuth client: a
 // member connects the mind to the account through Cloudflare's MCP server, for which the mind is
 // its own client (core/configs/default/cloudflare.ts).
@@ -44,7 +45,7 @@
 import { CatalogTablesOfSinks } from "./catalog-tables-of-sinks.ts";
 import { type MindConfig, namesOf } from "./config.ts";
 import { bindAnalyticsSql } from "./analytics-sql-binding.ts";
-import { MindMadeTelemetryTables, telemetryTableNames } from "./mind-made-telemetry-tables.ts";
+import { telemetryTableNames } from "./mind-made-telemetry-tables.ts";
 import { REALTIME_SFU, realtimeConfigOf, TURN_KEY } from "./realtime.ts";
 import { type TelemetryMode, TelemetryToken } from "./telemetry-token.ts";
 
@@ -99,59 +100,54 @@
     // โ”€โ”€ keys, generated once and kept in the stack's state: each is a secret of its Worker โ”€โ”€
     const atRestKey = yield* Alchemy.makeRandom("SecretsAtRestKey", KEY);
     const authSigningKey = yield* Alchemy.makeRandom("AuthSigningKey", KEY);
-    const otlpSecret = yield* Alchemy.makeRandom("TelemetryOtlpSecret", KEY);
 
     // โ”€โ”€ telemetry: first, because every other Worker exports its logs and spans to it โ”€โ”€
     // Three modes (./telemetry-token.ts `telemetryModeOf`):
-    //   - "minted": two stack-managed AccountApiToken resources.
+    //   - "minted": a stack-managed AccountApiToken.
     //   - "given": one owner-created TelemetryToken kept in state.
-    //   A deploy takes no new token, so a stack's mode never changes from "off".
-    //   - "off": no token. The bucket, the streams and the OTLP destinations are made, and no
-    //     catalog, sink or pipeline. A destroy removes the ones that the mind's own code made
-    //     (./mind-made-telemetry-tables.ts). A stream with no pipeline keeps what it is sent,
-    //     and a pipeline made later writes it into the table (measured on 20 Nov 2026).
-    const telemetryBucket = yield* Cloudflare.R2.Bucket("TelemetryBucket", {
-      name: names.telemetryBucket,
-      forceDestroy: true,
-      // A sink leaves multipart uploads open, and a destroy can abort them only with a token
-      // that it can read. With this rule R2 aborts them itself after a day.
-      lifecycleRules: [
-        {
-          id: "abort-stale-uploads",
-          abortMultipartUploadsTransition: { condition: { type: "Age", maxAge: 86_400 } },
-        },
-      ],
-    });
-    /** The stream that a Worker writes, one for each table. A changed schema replaces the stream,
-     *  and what the old one still held is lost: a column change is a new table. */
-    const streamOf = (table: "events" | "logs" | "spans") =>
-      Cloudflare.Pipelines.Stream(`Telemetry_${table}_stream`, {
-        name: telemetryTableNames(names.telemetryTables, table).stream,
-        format: { type: "json" },
-        http: false,
-        workerBinding: { enabled: true },
-        schema: TelemetryStreamFields.parse(
-          JSON.parse(readFileSync(core(`telemetry-worker/schemas/${table}.json`), "utf8")),
-        ),
-      });
-    const streams = {
-      EVENTS: yield* streamOf("events"),
-      LOGS: yield* streamOf("logs"),
-      SPANS: yield* streamOf("spans"),
-    };
-    // The tables that the mind made itself, which a destroy removes before the bucket and the
-    // streams go. A stack's mode never changes, so a live stack never loses this resource.
-    if (telemetryMode === "off")
-      yield* MindMadeTelemetryTables("TelemetryTablesOfTheMind", {
-        accountId,
-        bucket: telemetryBucket.bucketName,
-        streams: [streams.EVENTS.name, streams.LOGS.name, streams.SPANS.name],
-        tables: names.telemetryTables,
-      });
-    let telemetryTokenBindings:
-      | { ITERATE__CATALOG_TOKEN: Output.Output<Redacted.Redacted<string>> }
+    //   - "off": no token, and a deploy takes no new one, so a stack's mode never changes from
+    //     "off". Such a stack has no tables, so it makes nothing that only fills them: no bucket,
+    //     no stream, no sink, no pipeline, and no export of the other Workers' logs and spans.
+    //     Its mind reads Cloudflare's own datasets and `metrics`.
+    /** What the telemetry Worker binds for the tables: their streams, the token that reads them,
+     *  and the secret of the export that fills two of them. */
+    let tables:
+      | (Record<"EVENTS" | "LOGS" | "SPANS", Cloudflare.Pipelines.Stream> & {
+          ITERATE__CATALOG_TOKEN: Output.Output<Redacted.Redacted<string>>;
+          ITERATE__OTLP_SECRET: Output.Output<Redacted.Redacted<string>>;
+        })
       | undefined;
     if (telemetryMode !== "off") {
+      const otlpSecret = yield* Alchemy.makeRandom("TelemetryOtlpSecret", KEY);
+      const telemetryBucket = yield* Cloudflare.R2.Bucket("TelemetryBucket", {
+        name: names.telemetryBucket,
+        forceDestroy: true,
+        // A sink leaves multipart uploads open, and a destroy can abort them only with a token
+        // that it can read. With this rule R2 aborts them itself after a day.
+        lifecycleRules: [
+          {
+            id: "abort-stale-uploads",
+            abortMultipartUploadsTransition: { condition: { type: "Age", maxAge: 86_400 } },
+          },
+        ],
+      });
+      /** The stream that a Worker writes, one for each table. A changed schema replaces the
+       *  stream, and what the old one still held is lost: a column change is a new table. */
+      const streamOf = (table: "events" | "logs" | "spans") =>
+        Cloudflare.Pipelines.Stream(`Telemetry_${table}_stream`, {
+          name: telemetryTableNames(names.telemetryTables, table).stream,
+          format: { type: "json" },
+          http: false,
+          workerBinding: { enabled: true },
+          schema: TelemetryStreamFields.parse(
+            JSON.parse(readFileSync(core(`telemetry-worker/schemas/${table}.json`), "utf8")),
+          ),
+        });
+      const streams = {
+        EVENTS: yield* streamOf("events"),
+        LOGS: yield* streamOf("logs"),
+        SPANS: yield* streamOf("spans"),
+      };
       let catalogTokenValue: Output.Output<Redacted.Redacted<string>>;
       if (telemetryMode === "minted") {
         // The stack-managed catalog token keeps existing sinks bound to the credential they were
@@ -223,7 +219,11 @@
           sql: Output.interpolate`INSERT INTO ${sink.name} SELECT * FROM ${stream.name}`,
         });
       }
-      telemetryTokenBindings = { ITERATE__CATALOG_TOKEN: catalogTokenValue };
+      tables = {
+        ...streams,
+        ITERATE__CATALOG_TOKEN: catalogTokenValue,
+        ITERATE__OTLP_SECRET: otlpSecret,
+      };
     }
     const telemetryMetrics = yield* Cloudflare.AnalyticsEngine.Dataset("TELEMETRY_METRICS", {
       dataset: names.telemetryMetrics,
@@ -235,13 +235,14 @@
       // never exported to itself: a failure to land would make more of what failed to land
       observability: { ...KEEP_ALL, logs: { ...KEEP_ALL, invocationLogs: true }, traces },
       // Cloudflare's export posts to this workers.dev address. The other Workers name the
-      // export's destinations, so the intake cannot be behind one of them.
-      workersDev: { enabled: true, previewsEnabled: false },
+      // export's destinations, so the intake cannot be behind one of them. A stack with no
+      // tables has no export, and its telemetry Worker has no public address.
+      workersDev: { enabled: Boolean(tables), previewsEnabled: false },
       env: {
         ITERATE: JSON.stringify({
           ...sharedConfigOf(config),
           accountId,
-          telemetryBucketName: names.telemetryBucket,
+          ...(tables && { telemetryBucketName: names.telemetryBucket }),
           metricsDatasetName: names.telemetryMetrics,
           // an external mind writes no log to Cloudflare, and no Worker writes its events
           workerNamesThatQueriesReadWhole: mindIsInTheStack
@@ -259,22 +260,26 @@
           ],
           eventsWriterName: mindIsInTheStack ? names.mind : "external-mind",
         }),
-        ITERATE__OTLP_SECRET: otlpSecret,
-        ...telemetryTokenBindings,
-        ...streams,
+        ...tables,
         METRICS: telemetryMetrics,
       },
     });
     // `ANALYTICS`: Cloudflare's own datasets, read with no token and cut to the mind's rows
     // (core/telemetry-worker/src/store-query.ts)
     yield* bindAnalyticsSql(telemetry, "ANALYTICS");
-    const telemetryDestination = (dataset: "logs" | "traces") =>
+    // Cloudflare's export of the other Workers' logs and spans to the telemetry Worker, which
+    // lands them in the tables' streams: only a stack with tables has it.
+    const otlpSecret = tables?.ITERATE__OTLP_SECRET;
+    const telemetryDestination = (
+      dataset: "logs" | "traces",
+      secret: NonNullable<typeof otlpSecret>,
+    ) =>
       Cloudflare.Workers.ObservabilityDestination(`Telemetry_${dataset}`, {
         name: `${names.telemetry}-${dataset}`,
         url: Output.interpolate`${telemetry.url}/v1/${dataset}`,
         headers: {
-          authorization: Output.map(otlpSecret, (secret) =>
-            Redacted.make(`Bearer ${Redacted.value(secret)}`),
+          authorization: Output.map(secret, (value) =>
+            Redacted.make(`Bearer ${Redacted.value(value)}`),
           ),
         },
         logpushDataset: `opentelemetry-${dataset}`,
@@ -282,8 +287,8 @@
         // a fresh workers.dev hostname is not routed everywhere yet (1042)
         skipPreflightCheck: true,
       });
-    const logsDestination = yield* telemetryDestination("logs");
-    const tracesDestination = yield* telemetryDestination("traces");
+    const logsDestination = otlpSecret && (yield* telemetryDestination("logs", otlpSecret));
+    const tracesDestination = otlpSecret && (yield* telemetryDestination("traces", otlpSecret));
 
     // โ”€โ”€ the settings that the four Workers below share โ”€โ”€
     const sharedWorkerProps = {
@@ -292,11 +297,11 @@
         logs: {
           ...KEEP_ALL,
           invocationLogs: true,
-          destinations: [logsDestination.slug],
+          ...(logsDestination && { destinations: [logsDestination.slug] }),
         },
         traces: {
           ...traces,
-          destinations: [tracesDestination.slug],
+          ...(tracesDestination && { destinations: [tracesDestination.slug] }),
         },
       },
       // a Durable Object runs a deploy's code at once, as the Worker in front of it does
M core/alchemy/src/telemetry-token.ts
@@ -45,9 +45,8 @@
  *    catalog token's `AccountApiToken` so catalog sinks keep their original credentials. The
  *    analytics token, which nothing reads since 22 Nov 2026, is not declared: a deploy deletes it.
  *  - `"given"`: state holds `TelemetryToken` โ€” use that one owner-created token.
- *  - `"off"`: neither โ€” the bucket and the streams are made, and no token, catalog, sink or
- *    pipeline. A destroy removes the ones that the mind's own code made
- *    (./mind-made-telemetry-tables.ts). */
+ *  - `"off"`: neither โ€” the stack has no telemetry tables and makes nothing for them: no bucket,
+ *    stream, token, catalog, sink or pipeline. */
 export type TelemetryMode = "minted" | "given" | "off";
 
 const isLiveResource = (persisted: PersistedState | undefined): persisted is ResourceState =>
M core/lib/src/cli/README.md
@@ -133,8 +133,8 @@
    another Worker, or with an A, AAAA, CNAME or MX record, is in use: the command says what is
    there and asks before it goes on. With your yes (or `--erase-records`) it erases every DNS
    record and Workers route of that domain, right before the deploy and after every other check.
-4. **Telemetry: no token.** The deploy makes the telemetry bucket and its streams, and no tables
-   (`events`, `logs`, `spans`). The mind reads Cloudflare's own datasets and `metrics` through
+4. **Telemetry: no token.** The deploy makes no telemetry tables (`events`, `logs`, `spans`), and
+   no bucket or Pipelines stream for them. The mind reads Cloudflare's own datasets and `metrics` through
    `itx.telemetry.query`, with no token (`onboarding/telemetry.md` of `/repos/onboarding`). A mind
    whose tables an earlier deploy made with a token keeps that token in the stack's state.
 5. **Workers Paid, R2 and Zero Trust.** It opens the page for each one that is off and waits
M core/telemetry-worker/src/config.test.ts
@@ -11,7 +11,7 @@
     "iterate-example-com-boundary",
   ]);
   assert.equal(config.eventsWriterName, "iterate-example-com-mind");
-  assert.equal(config.otlpSecret.exposeSecret(), "the-otlp-secret");
+  assert.equal(config.otlpSecret?.exposeSecret(), "the-otlp-secret");
   assert.equal(config.catalogToken?.exposeSecret(), "the-catalog-token");
 });
 
@@ -21,16 +21,18 @@
     assert.equal(printed.includes(secret), false);
 });
 
-void test("a missing otlpSecret is refused by its name, while catalogToken is optional", () => {
-  const { ITERATE__OTLP_SECRET: _, ...withoutOtlp } = stackVariables();
-  assert.throws(
-    () => telemetryWorkerConfigOf(withoutOtlp),
-    /ITERATE otlpSecret \(ITERATE__OTLP_SECRET\)/,
-  );
-
-  const { ITERATE__CATALOG_TOKEN: _catalog, ...withoutTelemetryToken } = stackVariables();
-  const config = telemetryWorkerConfigOf(withoutTelemetryToken);
+void test("a stack with no telemetry tables gives no otlpSecret, catalogToken or bucket name", () => {
+  const {
+    ITERATE__OTLP_SECRET: _,
+    ITERATE__CATALOG_TOKEN: _catalog,
+    ...noSecrets
+  } = stackVariables();
+  const { telemetryBucketName: _bucket, ...fields } = JSON.parse(noSecrets.ITERATE);
+  const config = telemetryWorkerConfigOf({ ITERATE: JSON.stringify(fields) });
+  assert.equal(config.otlpSecret, undefined);
   assert.equal(config.catalogToken, undefined);
+  assert.equal(config.telemetryBucketName, undefined);
+  assert.equal(config.metricsDatasetName, "iterate_example_com_metrics");
 });
 
 void test("one env is parsed once", () => {
M core/telemetry-worker/src/config.ts
@@ -8,8 +8,9 @@
 const own = {
   /** The Cloudflare account of the stack: both SQL APIs are addressed by it. */
   accountId: z.string().min(1),
-  /** The R2 bucket whose data catalog holds the tables `events`, `logs` and `spans`. */
-  telemetryBucketName: z.string().min(1),
+  /** The R2 bucket whose data catalog holds the tables `events`, `logs` and `spans`, on a stack
+   *  that has them. */
+  telemetryBucketName: z.string().min(1).optional(),
   /** The Analytics Engine dataset that a query reads as `metrics`. */
   metricsDatasetName: z.string().min(1),
   /** The Workers whose logs and spans a query reads whole: the mind's own. Of the stack's other
@@ -23,8 +24,8 @@
    *  or `external-mind` when the mind runs outside the stack and no Worker writes its events. */
   eventsWriterName: z.string().min(1),
   /** What Cloudflare's OpenTelemetry export proves itself with. Set by the secret variable
-   *  `ITERATE__OTLP_SECRET`. */
-  otlpSecret: redacted(z.string().min(1)),
+   *  `ITERATE__OTLP_SECRET`, on a stack that has telemetry tables. */
+  otlpSecret: redacted(z.string().min(1)).optional(),
   /** The API token that reads `events`, `logs` and `spans` (R2 SQL), set by the secret variable
    *  `ITERATE__CATALOG_TOKEN` when telemetry tables are enabled. */
   catalogToken: redacted(z.string().min(1)).optional(),
M core/telemetry-worker/src/env.ts
@@ -7,12 +7,14 @@
   /** The config that every Worker of the mind gets, with this Worker's own fields, as JSON, and
    *  its secrets beside it (./config.ts reads them all). A secret is never returned or logged. */
   ITERATE: string;
-  ITERATE__OTLP_SECRET: string;
+  /** The next five are a stack's with telemetry tables alone (core/alchemy/src/stack.ts): a stack
+   *  with no telemetry token has no tables, no stream and no export of logs and spans. */
+  ITERATE__OTLP_SECRET?: string;
   ITERATE__CATALOG_TOKEN?: string;
+  LOGS?: Pipeline<LogRow>;
+  SPANS?: Pipeline<SpanRow>;
+  EVENTS?: Pipeline<EventsRow>;
   /** Cloudflare's Analytics SQL over the whole account, with no token (./store-query.ts cuts it). */
   ANALYTICS: AnalyticsSQLBinding;
-  LOGS: Pipeline<LogRow>;
-  SPANS: Pipeline<SpanRow>;
-  EVENTS: Pipeline<EventsRow>;
   METRICS: AnalyticsEngineDataset;
 };
M core/telemetry-worker/src/http.ts
@@ -20,8 +20,13 @@
       "core/telemetry-worker: Cloudflare's OpenTelemetry export posts to /v1/logs and /v1/traces (docs/telemetry.md)\n",
       { status: pathname === "/" ? 200 : 404 },
     );
-  // 503, not 401: the destination sends the batch again, so rotating the secret loses nothing
+  // A stack with no telemetry tables has no export, no secret and no stream: nothing lands.
   const { otlpSecret } = telemetryWorkerConfigOf(env);
+  if (!otlpSecret || !env.LOGS || !env.SPANS)
+    return new Response("core/telemetry-worker: this stack has no telemetry tables\n", {
+      status: 404,
+    });
+  // 503, not 401: the destination sends the batch again, so rotating the secret loses nothing
   if (!bearerMatches(request.headers.get("authorization"), otlpSecret.exposeSecret())) {
     console.warn({ event: "telemetry.secret-refused", pathname });
     return new Response(null, { status: 503 });
M core/telemetry-worker/src/rpc.ts
@@ -92,7 +92,8 @@
         message: "rows over 1 MB, which no stream takes, never reach the events table",
         count: dropped,
       });
-    for (const chunk of sends(rows)) await this.env.EVENTS.send(chunk);
+    // a stack with no telemetry tables has no stream: its events are counted in `metrics` alone
+    if (this.env.EVENTS) for (const chunk of sends(rows)) await this.env.EVENTS.send(chunk);
     writeEventPoints(this.env.METRICS, all);
   }