Action Button on Apple Watch Ultra 2 calls shortcut twice

Has anyone else seen this issue?

When the Action Button on an Apple Watch Ultra 2 is connected to a Shortcut, it seems to run the shortcut twice. I'm on watchOS 10.0.2.

A user of an app I built reported the issue, which is how I knew about it in the first place.

I'm wondering if it's an issue on my watch specifically, or if many other people are seeing the same thing.

I replicated the issue using a fresh project, and it only seems to happen when the shortcut responds with dialog.

Does anyone know why this is happening and how to fix it? The shortcut with a dialog response works fine everywhere else, and only exhibits this behavior when run with the Action Button.

Here is the full code with instructions to replicate the issue, so I'm curious if other people see the same thing:

// When running a shortcut that returns dialog
// with the Apple Watch Ultra Action Button,
// the shortcut runs twice.

// Create a new iOS project and add this:

import AppIntents

// AppIntent

struct LogEventNow: AppIntent
{
    static var title: LocalizedStringResource = "Log an Event"

    @MainActor
    func perform() async throws
//        -> some IntentResult
    // When just returning a successful result with .result(),
    // the shortcut only runs once as expected
    
    // Add ProvidesDialog to be able to return .result(dialog:)
     -> some IntentResult & ProvidesDialog
    {
        let loggedDate = Date()

        let formattedLoggedDate =
            loggedDate.formatted(date: .omitted,
                                 time: .complete)

        // Print the time of the event that was logged
        print(formattedLoggedDate)

        // This gives the expected result
        // Shortcut runs once, and prints one time to the console
//        return .result()
        
        // This gives unexpected result
        // Shortcut seems to run twice
        // and prints two date a 1–2 seconds apart
        return .result(dialog: "Successfully logged.")
    }
}

// AppShortcut
// This makes it show up in the Shortcuts app

struct EventShortcuts: AppShortcutsProvider
{
    static var appShortcuts: [AppShortcut]
    {
        AppShortcut(
            intent: LogEventNow(),
            phrases: ["Log in \(.applicationName)"],
            shortTitle: "Log Event Now",
            systemImageName: "calendar"
        )
    }
}

// Steps to reproduce the issue:
// - Long press the AppShortcut in Shortcuts app
// - Tap "Add to Shortcut"
// - Tap the "i" at the bottom
// - Turn on "Show on Apple Watch" toggle
// - Open the Watch app on iPhone
// - Tap "Action Button"
// - Under "Action" choose "Shortcut"
// - Select the Shortcut that was created in the Shortcuts app
// - Push the Action Button and observe two dates printed to the console

// Sometimes I'm also seeing "Remote execution timed out" on Apple Watch a minute or so after the shortcut has run, but only when leaving the Shortcuts app open after it runs from the Action button.

I'm also trying to figure out how I should handle this for different watchOS versions, seeing the behavior here... typically it seems like a better user experience to provide dialog, because that's what the user hears or sees when running the shortcut via Siri. On watchOS 9, when there is no dialog, it almost seems like it failed. The behavior on watchOS 10 seems different, like it completed successfully. However, I have not found a way to create separate AppIntents for watchOS 9 and watchOS 10.

Action Button on Apple Watch Ultra 2 calls shortcut twice
 
 
Q