Skip to content

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

TypeScript

fix: preserve plugin notification recipient in async grant form

Alfredo Lopez7d5607c60930
diff --git a/control-ui/app/plugin-workload-sdk/page.tsx b/control-ui/app/plugin-workload-sdk/page.tsx
index 81e250a4b..c9a6c8f84 100644
--- a/control-ui/app/plugin-workload-sdk/page.tsx
+++ b/control-ui/app/plugin-workload-sdk/page.tsx
@@ -1,6 +1,6 @@
'use client'
-import React, { useCallback, useEffect, useMemo, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useRouter } from 'next/navigation'
import { useConfirmDialog } from '@components/ConfirmDialog'
import { DashboardLayout } from '@components/DashboardLayout'
@@ -417,6 +417,11 @@ function GrantFormModal({
const [allowedCallers, setAllowedCallers] = useState((grant?.allowedCallers ?? []).join(', '))
const [users, setUsers] = useState<AdminUser[]>([])
const [userSearch, setUserSearch] = useState('')
+ // Recipe prefill resolves the access grant asynchronously. Keep that
+ // response from overwriting an operator's explicit recipient choice when
+ // the request finishes after the user has opened the picker.
+ const recipePrefillRequest = useRef(0)
+ const allowedUserRefsEdited = useRef(false)
useEffect(() => {
let cancelled = false
@@ -488,6 +493,8 @@ function GrantFormModal({
// users from the recipe's access grant — so the operator configures access
// once and the notify allowlist defaults to it (narrowable, security kept).
async function applyRecipePrefill(key: string) {
+ const requestId = ++recipePrefillRequest.current
+ allowedUserRefsEdited.current = false
setRecipeKey(key)
const info = sdkRecipes.find(r => `${r.namespace}/${r.name}` === key)
if (!info) return
@@ -506,12 +513,21 @@ function GrantFormModal({
setCredentialSlot('')
try {
const res = await listWorkflowGrants(info.namespace, info.name)
+ // A later recipe selection invalidates this response. Once the operator
+ // edits the picker, preserve that explicit decision instead of applying
+ // a stale/default access grant over it.
+ if (requestId !== recipePrefillRequest.current || allowedUserRefsEdited.current) return
setAllowedUserRefs((res.items ?? []).map(u => u.id))
} catch {
// Best-effort: leave users empty if the access grant can't be read.
}
}
+ function handleAllowedUserRefsChange(next: string[]) {
+ allowedUserRefsEdited.current = true
+ setAllowedUserRefs(next)
+ }
+
const eventTypesList = parseList(allowedEventTypes)
const callersList = parseList(allowedCallers)
const wildcardPresent =
@@ -908,7 +924,7 @@ function GrantFormModal({
<SelectionDropdown
id="sdk-userrefs"
value={allowedUserRefs}
- onChange={setAllowedUserRefs}
+ onChange={handleAllowedUserRefsChange}
onSearchQueryChange={setUserSearch}
options={userOptions}
placeholder="Select users…"
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index b30ac5619..ef871d768 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.383",
+ "version": "0.1.384",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.383",
+ "version": "0.1.384",
"dependencies": {
"@clerum/llm-providers": "file:../packages/llm-providers",
"@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",
diff --git a/control-ui/package.json b/control-ui/package.json
index 4d2a3ffe8..ccdef272f 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.383",
+ "version": "0.1.384",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/desktop-app/package-lock.json b/desktop-app/package-lock.json
index 7bca2fe3a..c570f6b7d 100644
--- a/desktop-app/package-lock.json
+++ b/desktop-app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "evenfire",
- "version": "0.1.335",
+ "version": "0.1.336",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "evenfire",
- "version": "0.1.335",
+ "version": "0.1.336",
"license": "MPL-2.0",
"dependencies": {
"@clerum/desktop-app-links": "file:../packages/desktop-app-links",
diff --git a/desktop-app/package.json b/desktop-app/package.json
index 65ce5d94f..7b2c01bbf 100644
--- a/desktop-app/package.json
+++ b/desktop-app/package.json
@@ -1,7 +1,7 @@
{
"name": "evenfire",
"productName": "Evenfire",
- "version": "0.1.335",
+ "version": "0.1.336",
"private": true,
"license": "MPL-2.0",
"description": "Evenfire desktop client for secure agent and workflow access",
diff --git a/desktop-app/test/e2e-playwright/plugin-workload-sdk-sandbox-ui.spec.ts b/desktop-app/test/e2e-playwright/plugin-workload-sdk-sandbox-ui.spec.ts
index 70cd7eb74..36d08c04e 100644
--- a/desktop-app/test/e2e-playwright/plugin-workload-sdk-sandbox-ui.spec.ts
+++ b/desktop-app/test/e2e-playwright/plugin-workload-sdk-sandbox-ui.spec.ts
@@ -9,6 +9,7 @@ import {
finalizeRecording,
launchDesktopApp,
login,
+ openSettings,
requireRecorderConfirm,
} from './qa-recorder-helpers'
import {
@@ -468,6 +469,26 @@ test('Desktop Apps executes promptBridge and clientNotifications inside the real
page = launched.page
await login(page, credentials)
+ await test.step('configure in-app notifications through visible Desktop settings', async () => {
+ await openSettings(page!)
+ await page!.getByRole('tab', { name: 'Notifications', exact: true }).click()
+ const inAppSection = page!.locator('form').filter({
+ has: page!.getByRole('heading', { name: 'In App Notifications', exact: true }),
+ })
+ const always = inAppSection.locator('input[type="radio"][value="always"]')
+ await expect(always).toBeVisible()
+ if (!(await always.isChecked())) {
+ await always.check()
+ }
+ const save = inAppSection.getByRole('button', { name: 'Save changes', exact: true })
+ if (await save.isVisible()) {
+ await save.click()
+ await expect(
+ page!.getByText('In app notification settings saved.', { exact: true })
+ ).toBeVisible()
+ }
+ })
+
await page.getByTestId('nav-sandbox-ui').click()
await expect(page.getByRole('heading', { name: 'Apps', exact: true })).toBeVisible()
// The sidebar also exposes an "Open <app>" control for the same app. Scope