Issue with Siri Not Displaying Prompt in App Intent

Hello everyone,

I'm currently working on an App Intent for my iOS app, and I’ve encountered a frustrating issue related to how Siri prompts for a category selection. Here’s an overview of what I’m dealing with:

extension Category: AppEntity, @unchecked Sendable {
    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: "\(name)")
    }
    
    static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Category")
    typealias DefaultQueryType = ShortcutsCategoryQuery
    static var defaultQuery: ShortcutsCategoryQuery = ShortcutsCategoryQuery()
}
struct ShortcutsCategoryQuery: EntityQuery {

    func entities(for identifiers: [String]) async throws -> [Category] {

        let context = await ModelContext(sharedModelContainer)

        let categories = try CategoryDataProvider(context: context).getItems()

        return categories.filter { identifiers.contains($0.id) }
    }

    func entities(matching string: String) async throws -> [Category] {
        return try await suggestedEntities()
    }

    func suggestedEntities() async throws -> [Category] {

        let context = await ModelContext(sharedModelContainer)
        do {
            let categories = try CategoryDataProvider(context: context).getItems()
            if categories.isEmpty {
                print("No categories found.")
            }
            return categories.map { category in
                Category(
                    id: category.id,
                    name: category.name,
                    stringSymbol: category.stringSymbol,
                    symbol: category.symbol,
                    stringColor: category.stringColor,
                    color: category.color
                )
            }

        } catch {
            print(error)
            return []
        }
    }
}

The issue arises when I use Siri to invoke the intent. Siri correctly asks me to select a category but does not display any options unless I said something that Siri recognized, like "Casa(House) or *****(Test)" in portuguese. Only then does it show the list of available categories.

I would like the categories to appear immediately when Siri asks for a selection. I've already tried refining the ShortcutsCategoryQuery and debugging various parts of my code, but nothing seems to fix this behavior.

Are you seeing the categories appear as a pickable list if you configure a shortcut in the Shortcuts app, and run the shortcut? And is that pickable list what you're expecting to happen when you invoke your intent from Siri?

If the answers to both of those questions is "yes," then I'd like you to open a bug report, including a small buildable project with the snippets you have above that reproduces that you're seeing, as well as screen recording of the what you're expecting (when running through Shortcuts) and not getting when run from Siri. Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

One further note however on this code:

func entities(matching string: String) async throws -> [Category] {
        return try await suggestedEntities()
    }

The API contract here is expecting that you return entities that match the query string, which just passing back the suggested entities does not do. That won't make a difference in the experience I think you're trying to create per my comments above, but this implementation may create unexpected results for your customers when the system queries for a entity and returns one which don't match the query string.

— Ed Ford,  DTS Engineer

Issue with Siri Not Displaying Prompt in App Intent
 
 
Q