Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split blocking of fulfillment from state reporting in Google Assistant #126539

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

coling
Copy link

@coling coling commented Sep 23, 2024

The Google Home Graph API says fulfillment should be sync, but in HA it's async if state reporting is turned on. This can cause some UI issues in Google Home App.

To work around this, add a separate control over whether fulfillment is async or blocking but default to the current behaviour.

See issue #125793

Proposed change

This allows fine grained control over whether the processing of EXECUTE intents is synchronous or asynchronous. It is currently tied to whether the report_state configuration is turned on or not but this seems incorrect. The upstream docs (as quoted in #125793) suggest that fulfilment should be synchronous, however this pull does not change the current behaviour - just affords more control.

Arguably, it may make more sense to just disable asynchronous fulfillment altogether if there is no compelling reason not to.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • I have followed the [perfect PR recommendations][perfect-pr]
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for [www.home-assistant.io][docs-repository]

Not yet, but I will add this based on feedback

To help with the load of incoming pull requests:

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @coling,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <email@address.com>"
      
      (substituting "Author Name" and "email@address.com" for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! ❤️

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
Copy link

Hey there @home-assistant/cloud, mind taking a look at this pull request as it has been labeled with an integration (google_assistant) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of google_assistant can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign google_assistant Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@MartinHjelmare MartinHjelmare changed the title Split blocking of fulfillment from state reporting. Split blocking of fulfillment from state reporting in Google Assistant Sep 23, 2024
@coling coling force-pushed the google-assistant-sync-fulfillment branch from 5d2e1ec to b3449b4 Compare September 23, 2024 13:09
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @coling

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@coling coling marked this pull request as ready for review September 24, 2024 15:35
@home-assistant home-assistant bot dismissed stale reviews from themself September 24, 2024 15:35

Stale

The Google Home Graph API says fulfillment should be sync, but in HA it's
async if state reporting is turned on. This can cause some UI issues
in Google Home App.

To work around this, add a separate control over whether fulfillment is async or blocking
but default to the current behaviour.

See issue home-assistant#125793
@coling coling force-pushed the google-assistant-sync-fulfillment branch from b3449b4 to cc89d03 Compare October 4, 2024 15:27
@coling
Copy link
Author

coling commented Oct 4, 2024

Is there any reason not to merge this? Is there any feedback so I can incorporate it? Thanks for all your awesome work!

@joostlek
Copy link
Member

Okay so I only recently did some tinkering to google_assistant so I know a bit about the context, but not all. So if you could help me out a bit that would be amazing :)

So Google wants to get stuff executed sync, while we do it async? Why would one have report state turned off (I think that is a question as well) and have async fulfillment turned on?

@coling
Copy link
Author

coling commented Oct 22, 2024

Okay so I only recently did some tinkering to google_assistant so I know a bit about the context, but not all. So if you could help me out a bit that would be amazing :)

So Google wants to get stuff executed sync, while we do it async? Why would one have report state turned off (I think that is a question as well) and have async fulfillment turned on?

Well, I'm a green as they come both with development for HA and with GA, so I wouldn't take what I say as gospel by any stretch.

I wrote my patch on the basis of a "don't change any current behaviour" approach (don't break it!!) but, personally, to me the docs definitely state that the response should be the new state. I don't know if there are any additional response timing constraints that need to be factored in. This doesn't actually specify that the operation has to be sync, just that the response has to be the new state. i.e. we could just respond with what the new state should be - obviously this could fail, but that should then be updated via state reporting anyway. I'm not sure if this is a healthy approach or not! I'm also not sure how easy it would be to simulate the expected new state for the response (it might be quite tricky) and thus executing sync might be the most sensible way.

Anyway, that's my rationale for the patch as it stands but happy to take feedback and adjust accordingly.

@kennylevinsen
Copy link

This doesn't actually specify that the operation has to be sync, just that the response has to be the new state.

It does specify an order of operations with the new state being returned only after transmitting requests to the various devices (e.g., sending an Zigbee genOnOff cluster command), which suggests that the EXECUTE as a whole should be sync.

As such, I'm tempted to suggest that we simplify this to always be sync without any configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Assistant Response to Execute intent includes incorrect state
4 participants