Repository navigation
fix(scenes): answer a failed routine execute with a JSON error and log it - #313
Merged
Merged
Conversation
…g it
build_execute let any exception escape, so a missing scene, a scene that
fails to parse, or an error while preparing its steps reached Starlette
as a text/plain 500 with nothing in api_server.log. Clients expect the
JSON envelope and check "success".
Catch the error, log it (warning for RoutineExecutionError, traceback
otherwise) and return {"success": false, "code": 500, "msg": ...}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lash-L
added a commit
that referenced
this pull request
Nov 29, 2026
Bump the package to 1.3.0-rc2 and point the opt-in Beta add-on at it. The v1.3.0-rc1 release build failed on a flaky test (fixed in #308), so no rc1 image was published; rc2 replaces it and adds #312, #313 and #314. The stable add-on stays on 1.2.1. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
POST /user/scene/{id}/execute(build_executeinroutes/user/scene/item.py) let any exception escape. A missing scene, a scene whose steps fail to parse, or any error while preparing the steps reached Starlette as a text/plain 500, and nothing was written toapi_server.logbecause the request line is only logged after the route returns. Clients (python-roborock, the app, Home Assistant) expect the JSON envelope and checksuccess.Now the route catches the error, logs it to the API logger (
api_server.log; a warning forRoutineExecutionError, a traceback for anything else) and returns the same error enveloperoutes/user/devices/jobs.pyuses:{"success": false, "code": 500, "msg": "...", "data": null, "result": null}The vacuum is only contacted from the background routine task after this response, so whether the vacuum is online doesn't change any of this.
Context: on a Home Assistant setup running an older build, the "Night living room" routine returned a bare 500 on every run from early November. The cause was a non-UTF-8 line in
decompiled_mqtt.jsonlthat the zone-range lookup read as strict UTF-8. Currentmainalready reads that file tolerantly, so that particular crash is gone. This PR makes sure the next failure in this route is visible and well-formed instead of an untraceable plain-text 500.Proof that it works
Tested on:
main(d09fb0f) + this changeWhat I did and what happened:
tests/test_scene_execute_500.py(new, 4 tests):success: false, not text/plain;success: falseand starts no routine;api_server.log. This test fails with a module-level logger, which writes nowhere the user can see.Full suite: 884 passed.
Open question: I couldn't confirm which error code the real cloud uses for a failed execute, so this uses 500 in the envelope, as the other routes do.
Screenshots (required for any UI change)
No UI changes.
🤖 Generated with Claude Code