Skip to content

An open-source, faster Devin alternative

TypeScript

polish managed Slack connection truth

Igor Zalutskib8ba9438509f
diff --git a/docs/agent-sessions/slack.mdx b/docs/agent-sessions/slack.mdx
index 3adfcea5..31f84bec 100644
--- a/docs/agent-sessions/slack.mdx
+++ b/docs/agent-sessions/slack.mdx
@@ -23,14 +23,14 @@ short deploying response and is not queued. Wait for the dashboard to show
<Warning>
Anyone in the connected Slack workspace who can message the app can use this
- agent, including guests with access to it. Use the shared app for evaluation
- with an agent whose tools and spend are appropriately bounded.
+ agent. Use the shared app for evaluation with an agent whose tools and spend
+ are appropriately bounded.
</Warning>
<Note>
A workspace can connect the managed app to one agent at a time. Managed Slack
accepts text direct messages and mentions in ordinary workspace channels.
- Files and mentions in Slack Connect channels are not supported yet.
+ Files and Slack Connect DMs or mentions are not supported yet.
</Note>
The same flow is available over the API:
@@ -79,9 +79,9 @@ the same session; another root message creates a new one. In a channel, invite
read unmentioned channel messages.
Slack deliveries are signature-verified and deduplicated before they enter the
-session. A transient **Working…** status may appear for a direct message. The
-final assistant response is posted to the same thread, while diagnostics and
-the full event history remain in OpenComputer.
+session. A transient **Working…** status may appear for a direct message or
+mention. The final assistant response is posted to the same thread, while
+diagnostics and the full event history remain in OpenComputer.
## Use your own Slack app
@@ -127,6 +127,8 @@ the OpenComputer app explicitly.
- A duplicate Slack event creates at most one agent turn.
- Direct-message thread replies continue their existing session.
- Channel replies require another mention.
+- The OpenComputer app replies to a message containing a file with a text-only
+ notice; resend the content as a text message.
- Responses longer than Slack's message limit include a link to the full
authenticated session in OpenComputer.
- Slack delivery can retry independently of agent execution, so a provider
diff --git a/web/src/api/mock.ts b/web/src/api/mock.ts
index 01099d0c..63bb765d 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -810,24 +810,6 @@ const slackConnection = {
updated_at: at(0, 2),
}
-const managedSlackConnection = {
- mode: 'managed',
- status: 'active',
- workspace: { id: 'T0123ABCDEF', name: 'Acme' },
- app: { id: 'A0OPENCOMPUTER', handle: 'OpenComputer' },
- open_url:
- 'https://slack.com/app_redirect?app=A0OPENCOMPUTER&team=T0123ABCDEF',
- connected_at: at(0, 2),
-}
-
-const managedSlackAuthorization = {
- mode: 'managed',
- status: 'pending',
- authorize_url:
- 'https://slack.com/oauth/v2/authorize?client_id=mock&state=opaque',
- expires_at: at(0, 10),
-}
-
// START-intent response for the Slack connect wizard (POST …/slack/manifest).
const slackManifest = {
manifest: {
@@ -1142,7 +1124,6 @@ const ROUTES: Array<[RegExp, Handler]> = [
[/^\/org$/, () => org],
[/^\/agents$/, () => []],
// Durable Agent Sessions — lists return the { data: [...] } envelope.
- [/^\/v3\/agents\/[^/]+\/slack\/managed$/, () => managedSlackConnection],
[/^\/v3\/agents\/[^/]+\/slack$/, () => slackConnection],
[/^\/v3\/github\/deploy-app$/, () => deployApp],
[
@@ -1231,14 +1212,6 @@ const POST_ROUTES: [RegExp, () => unknown][] = [
],
[/^\/v3\/agents$/, () => agents[0]],
[/^\/v3\/agents\/[^/]+\/slack\/manifest$/, () => slackManifest],
- [
- /^\/v3\/agents\/[^/]+\/slack\/managed\/authorize$/,
- () => managedSlackAuthorization,
- ],
- [
- /^\/v3\/agents\/[^/]+\/slack\/managed$/,
- () => ({ ok: true, status: 'disconnected' }),
- ],
[
/^\/v3\/agents\/[^/]+\/slack$/,
() => ({ ...slackConnection, status: 'active' }),
diff --git a/web/src/components/slack-connect.render.test.tsx b/web/src/components/slack-connect.render.test.tsx
index be59e4b9..9315f931 100644
--- a/web/src/components/slack-connect.render.test.tsx
+++ b/web/src/components/slack-connect.render.test.tsx
@@ -8,14 +8,16 @@ const agentId = 'agt_aaaaaaaaaaaaaaaaaaaaaaaa'
const connectedAgentId = 'agt_bbbbbbbbbbbbbbbbbbbbbbbb'
function renderSlackConnect(
- managed: Record<string, unknown> | null,
+ managed: Record<string, unknown> | null | undefined,
url = `/agents/${agentId}`,
connectedAgentName?: string,
) {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false, staleTime: Infinity } },
})
- queryClient.setQueryData(['slack', 'managed', agentId], managed)
+ if (managed !== undefined) {
+ queryClient.setQueryData(['slack', 'managed', agentId], managed)
+ }
queryClient.setQueryData(['slack', 'byo', agentId], null)
if (connectedAgentName) {
queryClient.setQueryData(['agent', connectedAgentId], {
@@ -34,6 +36,29 @@ function renderSlackConnect(
}
describe('SlackConnect managed states', () => {
+ it('waits for authoritative connection state before showing OAuth success', () => {
+ const loadingMarkup = renderSlackConnect(
+ undefined,
+ `/agents/${agentId}?slack=connected`,
+ )
+ expect(loadingMarkup).not.toContain('Slack connected')
+
+ const connectedMarkup = renderSlackConnect(
+ {
+ mode: 'managed',
+ status: 'active',
+ workspace: { id: 'T1', name: 'Acme' },
+ app: { id: 'A1', handle: 'OpenComputer' },
+ connected_at: '2026-07-16T18:00:00Z',
+ },
+ `/agents/${agentId}?slack=connected`,
+ )
+ expect(connectedMarkup).toContain('Slack connected')
+ expect(connectedMarkup).toContain(
+ 'OpenComputer will send messages in Acme to Support triage.',
+ )
+ })
+
it('preserves disconnected lifecycle truth and offers reconnection', () => {
const markup = renderSlackConnect({
mode: 'managed',
diff --git a/web/src/components/slack-connect.tsx b/web/src/components/slack-connect.tsx
index a3ab0ddf..625df131 100644
--- a/web/src/components/slack-connect.tsx
+++ b/web/src/components/slack-connect.tsx
@@ -253,8 +253,10 @@ export function SlackConnect({
enabled: !!sameOwnerConnectedAgentId,
})
const connectedAgentName = connectedAgentQuery.data?.name ?? null
+ const waitingForConnectedState = oauthResult === 'connected' && !managedActive
const notice =
- sameOwnerConnectedAgentId && connectedAgentQuery.isLoading
+ (sameOwnerConnectedAgentId && connectedAgentQuery.isLoading) ||
+ waitingForConnectedState
? null
: managedSlackNotice(
oauthResult,