An open-source, faster Devin alternative
TypeScript
Dashboard: superseded behaves as cancelled, recoverable manifest keeps its retry
Igor Zalutski110d59d85892
diff --git a/web/src/managed-agents/Slack.test.tsx b/web/src/managed-agents/Slack.test.tsxindex da8a2d0d..4053f5f3 100644--- a/web/src/managed-agents/Slack.test.tsx+++ b/web/src/managed-agents/Slack.test.tsx@@ -500,13 +500,8 @@ describe('ManagedProjectSlack', () => {},}),title: 'This setup no longer owns the connection',- offered: ['Set up manually'],- withheld: [- 'Authorize again',- 'Authorize in Slack',- 'Cancel setup',- 'Create Slack bot',- ],+ offered: ['Set up manually', 'Create Slack bot'],+ withheld: ['Authorize again', 'Authorize in Slack', 'Cancel setup'],once: ['Set up manually'],},{@@ -794,7 +789,10 @@ describe('ManagedProjectSlack', () => {() => document.body.textContent?.includes('authorize failed') ?? false,'the error',)- expect(text()).toContain('Approve its installation')+ await settle(+ () => text().includes('Approve its installation'),+ 'the created app on the row',+ )await settle(() => api.findManagedSlackSetup.mock.calls.length > lookups,'the lookup to be refreshed',@@ -1002,7 +1000,8 @@ describe('ManagedProjectSlack', () => {first.resolve(setup({requestKey: firstCall.requestKey,- name: 'Patch',+ // The platform normalised the name; that is the intent from now on.+ name: 'Patch Bot',error: {code: 'slack_configuration_token_invalid',message: 'invalid_auth',@@ -1020,8 +1019,9 @@ describe('ManagedProjectSlack', () => {) ?? false,'the rejection',)+ expect(nameInput.value).toBe('Patch Bot')act(() => typeInto(nameInput, 'Other'))- expect(nameInput.value).toBe('Patch')+ expect(nameInput.value).toBe('Patch Bot')api.startManagedSlackSetup.mockResolvedValueOnce(setup({requestKey: firstCall.requestKey,@@ -1037,8 +1037,55 @@ describe('ManagedProjectSlack', () => {)expect(api.startManagedSlackSetup.mock.calls[1][0]).toMatchObject({requestKey: firstCall.requestKey,- name: 'Patch',+ name: 'Patch Bot',configurationToken: 'xoxe.xoxp-second',})})++ it('offers a fresh setup on a superseded record, whether connected or cancelled', async () => {+ for (const phase of ['connected', 'cancelled'] as const) {+ client.clear()+ api.findManagedSlackSetup.mockResolvedValue(+ setup({+ phase,+ app: { id: 'A1', name: 'Patch' },+ workspace: { id: 'T1', name: 'Acme' },+ actions: ['manual'],+ error: {+ code: 'slack_setup_superseded',+ message: 'superseded',+ recoverable: false,+ at: '2026-09-18T08:00:00.000Z',+ },+ }),+ )+ render()+ await settle(+ () => text().includes('This setup no longer owns the connection'),+ `the ${phase} superseded note`,+ )+ const offered = buttons(container)+ expect(offered, phase).toContain('Create Slack bot')+ expect(+ offered.filter((label) => label === 'Set up manually'),+ phase,+ ).toHaveLength(1)+ expect(offered, phase).not.toContain('Cancel setup')+ expect(offered, phase).not.toContain('Authorize in Slack')+ expect(text(), phase).not.toContain('Slack app installed')++ act(() => button(container, 'Create Slack bot').click())+ await settle(+ () => document.body.querySelector('#managed-slack-setup-name') !== null,+ 'the dialog',+ )+ const nameInput = document.body.querySelector(+ '#managed-slack-setup-name',+ ) as HTMLInputElement+ expect(nameInput.readOnly, phase).toBe(false)+ act(() => root.unmount())+ root = createRoot(container)+ document.body.replaceChildren(container)+ }+ })})diff --git a/web/src/managed-agents/Slack.tsx b/web/src/managed-agents/Slack.tsxindex 3fa6d5d6..a11900d3 100644--- a/web/src/managed-agents/Slack.tsx+++ b/web/src/managed-agents/Slack.tsx@@ -358,8 +358,11 @@ function SlackAutomaticSetup({})// The lookup answers the latest non-cancelled setup, so after Disconnect it// is the old connected one: that is history, and a new setup starts fresh.+ const superseded = (record: ManagedSlackSetup | null | undefined) =>+ record?.error?.code === 'slack_setup_superseded'const setup =- connected || setupQuery.data?.phase === 'connected'+ connected ||+ (setupQuery.data?.phase === 'connected' && !superseded(setupQuery.data))? undefined: setupQuery.dataconst highlighted =@@ -470,7 +473,10 @@ function SlackAutomaticSetup({const view = describeSlackSetup(setup)// A cancelled record is shown for its message only; a new setup starts// fresh, with its own request key.- const resumable = setup && setup.phase !== 'cancelled' ? setup : undefined+ const resumable =+ setup && setup.phase !== 'cancelled' && !superseded(setup)+ ? setup+ : undefinedconst actions = resumable?.actions ?? ['create']const busy = view.tone === 'pending' || setupQuery.isLoadingconst showCreate =@@ -658,7 +664,9 @@ function SlackSetupDialog({return result},onSuccess: (result) => {+ // The platform may normalise the name; show what retries will send.intentName.current = result.name+ setName(result.name)if (result.phase === 'prepared' && result.error?.recoverable) {// An explicit rejection with no side effect: fix the token, same key.setOutcome(result)diff --git a/web/src/managed-agents/slack-setup.test.ts b/web/src/managed-agents/slack-setup.test.tsindex 5dfcfcd9..9ddff387 100644--- a/web/src/managed-agents/slack-setup.test.ts+++ b/web/src/managed-agents/slack-setup.test.ts@@ -347,7 +347,7 @@ describe('setup copy', () => {setup({phase: 'app_created',app: { id: 'A1', name: 'Patch' },- actions: ['cancel'],+ actions: ['manual'],error: {code: 'slack_setup_superseded',message: 'superseded',@@ -356,7 +356,7 @@ describe('setup copy', () => {},}),).primary,- ).toBeUndefined()+ ).toEqual({ action: 'create', label: 'Create Slack bot' })})it('does not offer a retry for a rejected manifest, which needs a redeploy and a new setup', () => {@@ -378,8 +378,33 @@ describe('setup copy', () => {expect(view.primary).toBeUndefined()})- it('reports a setup that lost its connection in any phase', () => {- for (const phase of ['app_created', 'exchanging', 'prepared'] as const) {+ it('keeps the retry for a manifest rejection an older platform marks recoverable', () => {+ const view = describeSlackSetup(+ setup({+ actions: ['create', 'cancel'],+ error: {+ code: 'slack_manifest_rejected',+ message: 'Slack rejected the app manifest.',+ recoverable: true,+ at: '2026-09-18T08:00:00.000Z',+ },+ }),+ )+ expect(view.primary).toEqual({+ action: 'create',+ label: 'Try another token',+ })+ expect(view.description).toContain('redeploy')+ expect(view.description).not.toContain('Cancel')+ })++ it('treats a setup that lost its connection like a cancelled one, in any phase', () => {+ for (const phase of [+ 'connected',+ 'cancelled',+ 'app_created',+ 'prepared',+ ] as const) {const view = describeSlackSetup(setup({phase,@@ -393,7 +418,10 @@ describe('setup copy', () => {}),)expect(view.title, phase).toBe('This setup no longer owns the connection')- expect(view.primary, phase).toBeUndefined()+ expect(view.primary, phase).toEqual({+ action: 'create',+ label: 'Create Slack bot',+ })}})diff --git a/web/src/managed-agents/slack-setup.ts b/web/src/managed-agents/slack-setup.tsindex 013632f0..73bee6cb 100644--- a/web/src/managed-agents/slack-setup.ts+++ b/web/src/managed-agents/slack-setup.ts@@ -161,6 +161,15 @@ function retryAfter(ms?: number) {export function describeSlackSetup(setup: ManagedSlackSetup | null | undefined,): SlackSetupView {+ if (setup?.error?.code === 'slack_setup_superseded') {+ return {+ title: 'This setup no longer owns the connection',+ description:+ 'A manual connection or reconnect replaced it. Set up manually, or create a new bot.',+ tone: 'error',+ primary: { action: 'create', label: 'Create Slack bot' },+ }+ }if (setup?.phase === 'cancelled') {// The record carries what a cancellation leaves behind: possibly an app// in the workspace's app list, which the platform never deletes.@@ -184,14 +193,6 @@ export function describeSlackSetup(}const name = setup.app?.name ?? setup.nameconst error = setup.error- if (error?.code === 'slack_setup_superseded') {- return {- title: 'This setup no longer owns the connection',- description:- 'A manual connection or reconnect replaced it. Use Set up manually, or start again.',- tone: 'error',- }- }switch (setup.phase) {case 'prepared': {if (!error) {@@ -227,8 +228,13 @@ export function describeSlackSetup(case 'slack_manifest_rejected':return {title: 'Slack rejected the app manifest',- description: `${error.message} Fix the channel declaration and redeploy, then Cancel this setup and create the bot again, or set it up manually.`,+ description: `${error.message} Fix the channel declaration and redeploy, then ${+ error.recoverable+ ? 'submit a token again.'+ : 'Cancel this setup and create the bot again, or set it up manually.'+ }`,tone: 'error',+ primary: retry,}case 'slack_app_limit_reached':return {