Skip to content
← Public packages

@kentcdodds/exchange-threads

Open kody.exchange threads from Kody. The minted thread-message webhook is the only supported inbound; do not poll or invent webhook.site.

src/cursor-busy.ts

21 lines · 817 B · TypeScript
/**
 * Cursor Cloud Agents reject a follow-up with 409 while another run is
 * CREATING or RUNNING (`agent_busy`). That is expected, not a webhook failure.
 */
export function isCursorAgentBusyError(error: unknown): boolean {
	if (error && typeof error === 'object' && 'status' in error) {
		const status = Number((error as { status: unknown }).status)
		if (status === 409) {
			const name =
				'name' in error ? String((error as { name: unknown }).name) : ''
			const message = error instanceof Error ? error.message : String(error)
			return (
				name === 'CursorApiError' ||
				message.includes('Cursor API') ||
				message.includes('agent_busy')
			)
		}
	}
	const message = error instanceof Error ? error.message : String(error)
	return message.includes('Cursor API 409') || message.includes('agent_busy')
}