Skip to content

Commit 119c9f4

Browse files
Sg312Vikhyath Mondreti
authored andcommitted
Remove default Mship execution cutoff and expose Slack agent prerequisites
1 parent 8333731 commit 119c9f4

4 files changed

Lines changed: 42 additions & 27 deletions

File tree

‎apps/sim/app/api/copilot/chat/stream/route.test.ts‎

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,33 +141,43 @@ describe('copilot chat stream replay route', () => {
141141
})
142142
})
143143

144-
it('stops replay polling when run becomes cancelled', async () => {
145-
getLatestRunForStream
146-
.mockResolvedValueOnce({
147-
status: 'active',
148-
executionId: 'exec-1',
149-
id: 'run-1',
150-
})
151-
.mockResolvedValueOnce({
152-
status: 'cancelled',
153-
executionId: 'exec-1',
154-
id: 'run-1',
144+
it.each([0, 2 * 60 * 60_000])(
145+
'delivers cancellation after %i ms of replay',
146+
async (elapsedMs) => {
147+
const now = Date.now()
148+
const clock = vi.spyOn(Date, 'now').mockReturnValue(now)
149+
readEvents.mockImplementationOnce(async () => {
150+
clock.mockReturnValue(now + elapsedMs)
151+
return []
155152
})
153+
getLatestRunForStream
154+
.mockResolvedValueOnce({
155+
status: 'active',
156+
executionId: 'exec-1',
157+
id: 'run-1',
158+
})
159+
.mockResolvedValueOnce({
160+
status: 'cancelled',
161+
executionId: 'exec-1',
162+
id: 'run-1',
163+
})
156164

157-
const response = await GET(
158-
new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
159-
)
165+
const response = await GET(
166+
new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
167+
)
160168

161-
const chunks = await readAllChunks(response)
162-
expect(chunks[0]).toBe(': accepted\n\n')
163-
expect(chunks.join('')).toContain(
164-
JSON.stringify({
165-
status: MothershipStreamV1CompletionStatus.cancelled,
166-
reason: 'terminal_status',
167-
})
168-
)
169-
expect(getLatestRunForStream).toHaveBeenCalledTimes(2)
170-
})
169+
const chunks = await readAllChunks(response)
170+
expect(chunks[0]).toBe(': accepted\n\n')
171+
expect(chunks.join('')).toContain(
172+
JSON.stringify({
173+
status: MothershipStreamV1CompletionStatus.cancelled,
174+
reason: 'terminal_status',
175+
})
176+
)
177+
expect(getLatestRunForStream).toHaveBeenCalledTimes(2)
178+
clock.mockRestore()
179+
}
180+
)
171181

172182
it('emits structured terminal replay error when run metadata disappears', async () => {
173183
getLatestRunForStream

‎apps/sim/app/api/mothership/chat/stream/route.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { NextRequest } from 'next/server'
22
import { mothershipChatStreamQuerySchema } from '@/lib/api/contracts/mothership-chats'
33
import { validationErrorResponse } from '@/lib/api/server'
4-
import { GET as copilotStreamGet, maxDuration } from '@/app/api/copilot/chat/stream/route'
5-
6-
export { maxDuration }
4+
import { GET as copilotStreamGet } from '@/app/api/copilot/chat/stream/route'
75

86
export function GET(request: NextRequest) {
97
const validation = mothershipChatStreamQuerySchema.safeParse(

‎apps/sim/blocks/blocks/slack.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
parseOptionalNumberInput,
2020
} from '@/blocks/utils'
2121
import { getTrigger } from '@/triggers'
22+
import { SLACK_AGENT_SCOPES } from '@/triggers/slack/capabilities'
2223

2324
/**
2425
* Canonical basic/advanced pair for the channel target, shared by the card
@@ -3503,6 +3504,11 @@ export const SlackV2Block: BlockConfig = {
35033504
description: 'Manage Slack messages, channels, users, files, Lists, canvases, and Agent Sessions',
35043505
longDescription:
35053506
'Build Slack workflows with messages, conversations, files, reactions, pins, bookmarks, user groups, profiles, Lists, canvases, and Agent Sessions. Operations that need additional app scopes use custom Slack bots. Lists require lists:read/lists:write and a paid Slack plan. Native Sim connections retain their existing permissions. Page through list outputs explicitly.',
3507+
bestPractices: `${SlackBlock.bestPractices}
3508+
Native agent-session streaming uses a custom Slack bot and a supported trigger event. Enable streamResponse and select the intended outputs in streamOutputs; Sim Chat (mothership) streams its content output. The trigger owns the streamed reply, so another send needs a separate purpose.
3509+
The custom-bot manifest's baseline agent scopes are ${SLACK_AGENT_SCOPES.join(', ')}. Selected capabilities add their required scopes and event subscriptions. Verify the installed app's grants, resource access and event configuration; a saved credential or edited manifest alone does not prove access.
3510+
streamIncludeToolCalls displays tool activity; it does not authorize tool execution. Configure Sim Chat's selected operations and their credentials separately. Choose streamIncludeThinking deliberately for the destination audience.
3511+
Block Kit messages can contain buttons, selects and forms, but interactions require the app's interactivity request URL and the corresponding interaction trigger. Treat message events, button/select callbacks and modal submissions as separate paths. A control's action_id/value correlates work; runtime actor and state checks authorize it.`,
35063512
hideFromToolbar: false,
35073513
sunset: undefined,
35083514
canvasPresentation: {

‎apps/sim/lib/mothership/request/types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export interface OrchestratorOptions {
249249
/** Checks the server controller, independently of user cancellation. */
250250
assertControllerOwnership?: () => Promise<void>
251251
autoExecuteTools?: boolean
252+
/** Optional caller-requested deadline; healthy runs have no default wall-clock limit. */
252253
timeout?: number
253254
onEvent?: (event: StreamEvent) => void | Promise<void>
254255
/**

0 commit comments

Comments
 (0)