Commit 5c5ac79
fix: surface ha_deep_search scene-fetch partial failures + scenes bucket in response
Addresses kingpanther13's PR homeassistant-ai#1168 review Boy-Scout finding on silent
failures in the deep_search scene branch, plus two latent bugs the
DEEP_SEARCH_KEYS test gap had been hiding:
1. final_results dict was missing the 'scenes' key — any scene match
reaching pagination would KeyError on final_results['scenes'].append.
Added the missing initialization.
2. response dict didn't include the 'scenes' field at all. Made it
conditional on 'scene' in search_types, mirroring the dashboards
pattern.
3. Scene Attempt-C fetch tracked failed_count and a budget-exhaustion
skipped count locally but never surfaced them. Now promoted to
outer scope and merged into response as 'partial: True' plus a
'partial_reason' string when either count is non-zero. Pre-existing
in the script branch; KP13 asked for it at least in the new scene
branch (this PR's scope).
The tuning hint in the partial_reason references the configurable
HAMCP_SCENE_CONFIG_TIME_BUDGET env var so callers know how to raise
the budget if the wall-clock keeps tripping.
ruff + mypy clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ac2c213 commit 5c5ac79
1 file changed
Lines changed: 27 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1185 | 1185 | | |
1186 | 1186 | | |
1187 | 1187 | | |
| 1188 | + | |
| 1189 | + | |
1188 | 1190 | | |
1189 | 1191 | | |
1190 | 1192 | | |
| |||
1322 | 1324 | | |
1323 | 1325 | | |
1324 | 1326 | | |
1325 | | - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
1326 | 1330 | | |
1327 | 1331 | | |
1328 | 1332 | | |
1329 | 1333 | | |
1330 | | - | |
| 1334 | + | |
| 1335 | + | |
1331 | 1336 | | |
1332 | 1337 | | |
1333 | 1338 | | |
| |||
1340 | 1345 | | |
1341 | 1346 | | |
1342 | 1347 | | |
| 1348 | + | |
1343 | 1349 | | |
1344 | 1350 | | |
1345 | 1351 | | |
| |||
1565 | 1571 | | |
1566 | 1572 | | |
1567 | 1573 | | |
| 1574 | + | |
1568 | 1575 | | |
1569 | 1576 | | |
1570 | 1577 | | |
| |||
1590 | 1597 | | |
1591 | 1598 | | |
1592 | 1599 | | |
1593 | | - | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
1594 | 1603 | | |
1595 | 1604 | | |
1596 | 1605 | | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
1597 | 1621 | | |
1598 | 1622 | | |
1599 | 1623 | | |
| |||
0 commit comments