Skip to content

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

TypeScript

fix(control-ui): stop telling operators to use a relative Teams URL as an endpoint

Jose Ramirezf2fc4b4a3704
diff --git a/control-ui/app/communication-channels/[name]/edit/page.tsx b/control-ui/app/communication-channels/[name]/edit/page.tsx
index c4825dac2..11d68d28a 100644
--- a/control-ui/app/communication-channels/[name]/edit/page.tsx
+++ b/control-ui/app/communication-channels/[name]/edit/page.tsx
@@ -776,9 +776,11 @@ export default function EditCommunicationChannelPage() {
</button>
</div>
<span className="cu-field__hint">
- {teamsRequestUrl
- ? 'Use this URL as the Messaging endpoint for the Teams bot app.'
- : 'Enter the Name above and this channel gets its Teams Request URL.'}
+ {!teamsRequestUrl
+ ? 'Enter the Name above and this channel gets its Teams Request URL.'
+ : canGenerateTeamsCommand(teamsRequestUrl)
+ ? 'Use this URL as the Messaging endpoint for the Teams bot app.'
+ : 'This is a path, not a full URL. Prefix it with your public webhook origin before using it as the Messaging endpoint.'}
</span>
</div>
{teamsRequestUrl ? (
diff --git a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
index dbcfa84ef..9e4a95436 100644
--- a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
+++ b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
@@ -532,10 +532,10 @@ describe('EditCommunicationChannelPage Teams request URL', () => {
})
})
- it('makes the Messaging endpoint hint conditional on the URL being available', async () => {
- // Slack makes the equivalent hint conditional; the Teams hint stayed
- // unconditional and kept telling the operator to use a URL that was not
- // there whenever the field renders Unavailable.
+ it('tells the operator the URL is a path when no public origin is configured', async () => {
+ // Without an origin the field renders a bare path, which Teams cannot accept
+ // as a Messaging endpoint. Saying "use this URL" there contradicts the
+ // warning directly beneath it, so the hint has three states, not two.
mockChannel('teams-support', { hostRef: 'agentjose' })
await renderLoadedPage()
@@ -546,17 +546,36 @@ describe('EditCommunicationChannelPage Teams request URL', () => {
expect(
screen.getByText('Enter the Name above and this channel gets its Teams Request URL.')
).toBeInTheDocument()
+
+ await user.type(screen.getByLabelText(/name/i), 'evenfire-bot')
+
+ // A URL now exists, but it is relative, so the hint must not claim it is usable.
+ expect(
+ screen.getByText(
+ 'This is a path, not a full URL. Prefix it with your public webhook origin before using it as the Messaging endpoint.'
+ )
+ ).toBeInTheDocument()
expect(
screen.queryByText('Use this URL as the Messaging endpoint for the Teams bot app.')
).not.toBeInTheDocument()
+ })
+ it('tells the operator to use the URL directly once a public origin is configured', async () => {
+ vi.stubEnv('NEXT_PUBLIC_WORKFLOW_APPROVAL_READER_BASE_URL', 'https://webhook.example.com')
+ mockChannel('teams-support', { hostRef: 'agentjose' })
+ await renderLoadedPage()
+
+ const user = userEvent.setup()
+ await user.click(await screen.findByRole('radio', { name: /microsoft teams/i }))
await user.type(screen.getByLabelText(/name/i), 'evenfire-bot')
expect(
screen.getByText('Use this URL as the Messaging endpoint for the Teams bot app.')
).toBeInTheDocument()
expect(
- screen.queryByText('Enter the Name above and this channel gets its Teams Request URL.')
+ screen.queryByText(
+ 'This is a path, not a full URL. Prefix it with your public webhook origin before using it as the Messaging endpoint.'
+ )
).not.toBeInTheDocument()
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index b44f846e7..a229d7083 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.420",
+ "version": "0.1.421",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.420",
+ "version": "0.1.421",
"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 461ffb085..58e9ccfbd 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.420",
+ "version": "0.1.421",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",