Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
E2E cleanup: delete only names the harness builds, not every e2e- name
Petr Bauche3cee3562c70
diff --git a/console/tooling-e2e/README.md b/console/tooling-e2e/README.mdindex 0e6c34751..7e464702a 100644--- a/console/tooling-e2e/README.md+++ b/console/tooling-e2e/README.md@@ -57,9 +57,12 @@ With `SWITCH_E2E_LANE` unset every end-to-end scenario is skipped, which iswhat `pnpm -r test` and PR CI see. The unit tests (configuration, the read-onlyguard, naming, scenario headers) run either way.-Housekeeping after an interrupted run deletes every `e2e-*` agent and room on-the Switch server and archives every `e2e-*` Mattermost channel older than the-age you give, and nothing else. The age floor is what lets a scheduled wipe of a+Housekeeping after an interrupted run deletes every agent and room on the+Switch server, and archives every Mattermost channel, that is named the way the+harness names things (`e2e-<six-character run id><scope letter>-<role>`) and is+older than the age you give, and nothing else. A name that merely starts with+`e2e-` is not enough: people name their own test agents and rooms that way on a+shared deployment. The age floor is what lets a scheduled wipe of adeployed environment run while a suite is in progress; make it longer than thelongest run. `0` takes everything, which is only right when nothing else isrunning against the server:diff --git a/console/tooling-e2e/src/cleanup.ts b/console/tooling-e2e/src/cleanup.tsindex baf7446c8..b774365ea 100644--- a/console/tooling-e2e/src/cleanup.ts+++ b/console/tooling-e2e/src/cleanup.ts@@ -1,10 +1,12 @@/*** Remove artefacts that interrupted runs left behind: Switch agents, Switch- * rooms and Mattermost channels whose names start with `e2e-` and that are- * older than `--older-than <minutes>`.+ * rooms and Mattermost channels named the way the harness names things+ * (`e2e-<runId><scope>-<role>`, see `isHarnessArtifact`) and older than+ * `--older-than <minutes>`.*- * Scoped strictly to that prefix — an operator's real agents and their rooms are- * never in scope, and the script prints everything it touches. The age floor is+ * Scoped strictly to that shape, not just the `e2e-` prefix: people name their+ * own test agents and rooms `e2e-…` too. The script prints everything it+ * touches. The age floor is* what lets a scheduled wipe of a deployed environment run while a suite is in* progress: a run's own artefacts are younger than the floor, so it is left* alone. Pick a floor longer than the longest run; `0` takes everything, which@@ -12,7 +14,7 @@** SWITCH_E2E_LANE=fast node --experimental-strip-types src/cleanup.ts --older-than 120*/-import { ARTIFACT_PREFIX } from './core/run.ts';+import { isHarnessArtifact } from './core/run.ts';import { message, resolveLane } from './core/suite.ts';export async function cleanup(@@ -24,7 +26,7 @@ export async function cleanup(const { env, switchClient, mattermost } = lane.target;const cutoff = Date.now() - olderThanMinutes * 60_000;const stale = (name: string, createdMs: number): boolean =>- name.startsWith(ARTIFACT_PREFIX) && createdMs <= cutoff;+ isHarnessArtifact(name) && createdMs <= cutoff;let failures = 0;for (const room of await switchClient.listRooms()) {diff --git a/console/tooling-e2e/src/core/core.test.ts b/console/tooling-e2e/src/core/core.test.tsindex 9a0e56173..052be69d2 100644--- a/console/tooling-e2e/src/core/core.test.ts+++ b/console/tooling-e2e/src/core/core.test.ts@@ -9,7 +9,7 @@ import { FAST_SCENARIOS } from '../fast/index.ts';import { SCENARIOS as PROVIDER_SCENARIOS } from '../provider/scenarios.ts';import { laneFrom, loadEnv, MissingConfigError, strictFrom, type HarnessEnv } from './env.ts';import { assertAllowed, ReadOnlyEnvironmentError } from './guard.ts';-import { isValidMattermostUsername, RunContext } from './run.ts';+import { isHarnessArtifact, isValidMattermostUsername, RunContext } from './run.ts';import { admit, assertValidHeaders, headerProblems, type ScenarioHeader } from './scenario.ts';import { IssuedSecrets } from './secrets.ts';@@ -201,6 +201,25 @@ describe('admission', () => {});});+describe('cleanup scope', () => {+ it('takes every name the harness builds, and none of the e2e- names people choose', () => {+ const scope = new RunContext('k3x9q2').scope();+ for (const role of ['sender', 'room', 'hub.a', 'm-1']) {+ expect(isHarnessArtifact(scope.name(role))).toBe(true);+ }+ for (const name of [+ 'e2e-709-slack',+ 'e2e-bundle-6d5e40',+ 'e2e-hub-isolated',+ 'e2e-hub-shared',+ 'e2e-k3x9q2a',+ 'my-e2e-k3x9q2a-x',+ ]) {+ expect(isHarnessArtifact(name)).toBe(false);+ }+ });+});+describe('cleanup age floor', () => {it('reads server timestamps with an offset, and refuses ones without', () => {expect(timestampMs('2026-10-16 17:08:52.123456+00:00')).toBe(diff --git a/console/tooling-e2e/src/core/run.ts b/console/tooling-e2e/src/core/run.tsindex 19eca0312..f2bb2ee9e 100644--- a/console/tooling-e2e/src/core/run.ts+++ b/console/tooling-e2e/src/core/run.ts@@ -12,9 +12,22 @@* thing is for.*/-/** Everything the harness creates starts with this. The cleanup script deletes by it. */+/** Everything the harness creates starts with this. */export const ARTIFACT_PREFIX = 'e2e-';+/**+ * The whole shape of a name {@link NameScope.name} builds: the prefix, a+ * six-character run id, a scope letter, then the role. The cleanup script+ * deletes by this, not by the prefix alone: people name their own test+ * agents and rooms `e2e-…` on a shared deployment too, and those are not the+ * harness's to remove.+ */+const ARTIFACT_NAME = /^e2e-[a-z0-9]{6}[a-z]-[a-z0-9._-]+$/;++export function isHarnessArtifact(name: string): boolean {+ return ARTIFACT_NAME.test(name);+}+/*** Mattermost usernames: lowercase, 3-22 chars, `[a-z0-9._-]`, must start* alphanumeric. Agent names become Mattermost bot usernames verbatim, so every