Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(e2e): read the rollout baseline before the save that rolls the agent

Alfredo Lopez44e0cc0dee43
diff --git a/tests/e2e/playwright/desktop/codex-subscription-approved-tools.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-approved-tools.spec.ts
index fd8eafd20..0474c26d1 100644
--- a/tests/e2e/playwright/desktop/codex-subscription-approved-tools.spec.ts
+++ b/tests/e2e/playwright/desktop/codex-subscription-approved-tools.spec.ts
@@ -193,23 +193,30 @@ test('authenticated user without agent access cannot select the protected agents
await expect(page.getByTestId('chat-input')).toHaveCount(0)
await expect(page.getByTestId('send-button')).toHaveCount(0)
expect(await Promise.all(cases.map(readEvidence))).toEqual(before)
+ journeyPassed = true
+ } finally {
// Sign out before the window closes. The session token lives in the macOS
// Keychain, keyed by the REST+RPC origin, which a fresh --user-data-dir does
// not isolate: leaving it behind signs the next launch in as this
- // unauthorized user, and the next test's login form never renders. Signing
- // out is part of this journey, so a failure here fails this test rather
- // than the one that inherits the session.
- await page.getByTestId('nav-settings-menu').click()
- await page.getByTestId('logout-btn').click()
- await expect(page.getByLabel('Email', { exact: true })).toBeVisible()
- journeyPassed = true
- } finally {
+ // unauthorized user, and the next test's login form never renders. This has
+ // to run on the failure path too, because a journey that fails before
+ // signing out leaks the session exactly as one that never tried.
+ let cleanupError: string | undefined
+ try {
+ await signOutDesktop(await app.firstWindow())
+ } catch {
+ cleanupError = 'Desktop sign-out failed; the session stays in the Keychain'
+ }
try {
await app.close()
} catch {
- if (journeyPassed) throw new Error('Desktop cleanup failed')
- // Preserve the original assertion failure when cleanup also fails.
+ cleanupError = cleanupError
+ ? `${cleanupError}; Desktop cleanup failed`
+ : 'Desktop cleanup failed'
}
+ // Raise cleanup problems only when the journey passed; otherwise the
+ // original assertion failure is the one worth reporting.
+ if (cleanupError && journeyPassed) throw new Error(cleanupError)
}
})
diff --git a/tests/e2e/playwright/helpers/approved-tools-workflow.ts b/tests/e2e/playwright/helpers/approved-tools-workflow.ts
index c41a3ab4e..feae78fd9 100644
--- a/tests/e2e/playwright/helpers/approved-tools-workflow.ts
+++ b/tests/e2e/playwright/helpers/approved-tools-workflow.ts
@@ -73,6 +73,12 @@ export async function workflowJourney(page: Page, testInfo: TestInfo) {
const scenario = workflowScenario()
const mode = required('APPROVED_TOOLS_UPSTREAM_MODE')
expect((await readEvidence(scenario)).calls).toEqual([])
+ // Saving the model binding changes the runtime-token contract, so HCC rewrites
+ // the pod-template annotation `clerum.io/runtime-token-revision`
+ // (`host-context-controller/src/hostReconciler.ts:3013`) and the Deployment
+ // rolls. The baseline belongs before that save: read afterwards it already
+ // holds the post-rollout generation, which nothing can exceed.
+ let rolloutBaseline = 0
await test.step('Select the isolated workflow agent and bind its subscription visibly', async () => {
await page.goto('/')
await loginControlUiVisible(page)
@@ -84,6 +90,7 @@ export async function workflowJourney(page: Page, testInfo: TestInfo) {
await model.chooseSubscription(scenario.subscriptionName)
await page.getByLabel('Current model', { exact: true }).click()
await page.getByRole('option', { name: scenario.modelName, exact: true }).click()
+ rolloutBaseline = readAgentDeploymentGeneration(scenario.agentName)
const saved = await model.saveHost(scenario.agentName)
expect(saved.spec?.model).toMatchObject({
provider: 'codex-subscription',
@@ -96,9 +103,6 @@ export async function workflowJourney(page: Page, testInfo: TestInfo) {
await expect(page.getByRole('button', { name: 'Edit', exact: true })).toBeVisible()
})
- // The approval map is part of the agent contract, so saving it rolls the
- // Deployment exactly as the model binding does. Recorded before the save.
- const rolloutBaseline = readAgentDeploymentGeneration(scenario.agentName)
await test.step('Require approval for the real native workflow trigger through Advanced settings', async () => {
await page.getByRole('tab', { name: 'Advanced', exact: true }).click()
await expect(page).toHaveURL(new RegExp(`/agents/${scenario.agentName}/advanced$`))
@@ -137,7 +141,11 @@ export async function workflowJourney(page: Page, testInfo: TestInfo) {
await expect(advanced.getByText('workflow_trigger', { exact: true })).toBeVisible()
})
- await test.step('Wait for the agent rollout the approval change triggered', async () => {
+ // The approval map is not part of the runtime-token contract: HCC never reads
+ // `spec.approval` (no match in `host-context-controller/src`), and the only
+ // consumer is `mcp-host/src/core/extensions/mcpApprovalGateController.ts`.
+ // What has to converge before Desktop launches is the model binding's rollout.
+ await test.step('Wait for the agent rollout the model binding triggered', async () => {
await waitForAgentRollout(scenario.agentName, rolloutBaseline)
})
diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.json
index 5ea3f49e9..5869bd991 100644
--- a/tests/e2e/playwright/package-lock.json
+++ b/tests/e2e/playwright/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.59",
+ "version": "0.1.60",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-playwright-tests",
- "version": "0.1.59",
+ "version": "0.1.60",
"devDependencies": {
"@playwright/test": "^1.50.0",
"@types/node": "^22.0.0",
diff --git a/tests/e2e/playwright/package.json b/tests/e2e/playwright/package.json
index 0ce24c66d..277ba51f8 100644
--- a/tests/e2e/playwright/package.json
+++ b/tests/e2e/playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.59",
+ "version": "0.1.60",
"private": true,
"description": "Playwright E2E tests for Control UI and Desktop App",
"scripts": {