Repository navigation
feat(hmi): sync vérité d'abord depuis moteur #157 - #4
Conversation
Backend metrics/HA/vocal/setup + IHM sans mocks ; IPs LAN anonymisees. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.
Bugbot Autofix prepared fixes for all 4 issues found in the latest run.
- ✅ Fixed: Shell placeholders in Python URLs
- Replaced literal ${HA_HOST:-…} fallbacks with os.environ.get('HA_HOST', …) in HA health, MCP tools, vocal credentials, and Tab5 pusher defaults.
- ✅ Fixed: Ollama LAN URL not resolved
- ollama_pc base_url now resolves OLLAMA_HOST via os.environ at registry load and again at provider creation in create_provider/_make_compat.
- ✅ Fixed: Provider cooldown on git errors
- mark_provider_failed is gated behind provider_execution_failed so successful pipeline runs that later fail on git/IO no longer cool down the LLM provider.
- ✅ Fixed: Governor cap uses wrong scope
- Governor budget check now uses BudgetGuard.get_total_spend_usd (all billing sources) against total_daily_budget_usd, matching get_available_provider.
Or push these changes by commenting:
@cursor push b2d07f8258
You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.
| le `.env` définit historiquement les deux. | ||
| """ | ||
| ha_token = os.environ.get("HASS_TOKEN") or os.environ.get("HA_TOKEN") | ||
| ha_url = os.environ.get("HASS_URL") or os.environ.get("HA_URL") or "http://${HA_HOST:-192.168.1.x}:8123" |
There was a problem hiding this comment.
Shell placeholders in Python URLs
High Severity
When HASS_URL / HA_URL are unset, fallbacks use literal strings like http://${HA_HOST:-192.168.1.x}:8123. Python does not expand that shell syntax, so HA health, MCP tools, vocal reads, and Tab5 pushes target an invalid host instead of a LAN IP.
Additional Locations (3)
Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.
| # Ollama démarré avec OLLAMA_HOST=0.0.0.0 (ou au moins .84) + pare-feu Windows ouvert | ||
| # sur 11434 pour le LAN, sinon connect timeout (repli cloud silencieux, pas d'erreur bruyante). | ||
| "base_url": "http://192.168.1.x:11434/v1/chat/completions", | ||
| "base_url": "http://${OLLAMA_HOST:-192.168.1.x}:11434/v1/chat/completions", |
There was a problem hiding this comment.
Ollama LAN URL not resolved
Medium Severity
The ollama_pc provider base_url is set to http://${OLLAMA_HOST:-192.168.1.x}:11434/... as a literal string. HTTP clients use that hostname verbatim, so Deck-to-PC Ollama calls fail unless another layer rewrites the URL.
Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.
| # évite qu'un provider cassé (ex: CLI Gemini/Claude non trustée) soit | ||
| # re-sélectionné sur la tâche suivante du même cycle de drainage. | ||
| from core.budget_guard import mark_provider_failed | ||
| mark_provider_failed(provider) |
There was a problem hiding this comment.
Provider cooldown on git errors
Medium Severity
DreamCoder’s shared except always calls mark_provider_failed(provider) after any pipeline-stage error. Git commit/diff failures or timeouts can mark a healthy LLM provider unavailable for 30 minutes even when the model call succeeded.
Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.
|
|
||
| dreamcoder_spent_today = await bg.get_scoped_spend_usd("dreamcoder", 86400.0) | ||
| total_cap = bg.config.get("total_daily_budget_usd", 1.0) | ||
| governor_within_budget = dreamcoder_spent_today < total_cap |
There was a problem hiding this comment.
Governor cap uses wrong scope
Medium Severity
Governor degradation compares get_scoped_spend_usd("dreamcoder", …) to total_daily_budget_usd, described as a combined daily cap. That ignores non-DreamCoder spend recorded in billing_history, so paid planner/reviewer models may keep running after the real combined budget is exhausted.
Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.



Summary
Test plan
Note
High Risk
DreamCoder exécute des pipelines LLM sur un dépôt Git configurable avec commits et drainage multi-tâches ; les changements BudgetGuard et billing touchent la sélection de providers et les coûts en prod.
Overview
Synchronisation moteur ↔ IHM v2 autour du principe « pas de donnée inventée » : nouvelles routes de lecture (
/api/setup/diagnostics,/api/vocal/*, santé et liste d’entités HA, benchmarks GET/POST avec tables SQLite), agrégation Comptes API viaGET /api/billing(quotas, soldes live, saisie manuelle), et doc ihm-v2 (auth REST + ticket SSE, pas de mocks).DreamCoder passe d’une tâche par cycle à une boucle de drainage bornée (
dreamcoder_max_cycle_minutes), avec exécuteur vs gouverneur (DeepSeek / GLM selon budget et retries), rollback, rapports de cycle, et dépôt Git optionneldreamcoder_repo_path(clone Deck +pull --ff-only).BudgetGuard réordonne la cascade (rotation round-robin des API cloud gratuites/abonnements avant Ollama), ajoute CLI Gemini/Claude, DashScope, plafond
total_daily_budget_usd, solde DeepSeek caché, cooldown après échec, etsync_source/get_scoped_spend_usdpour l’auditeur.Home Assistant : TLS centralisé avec
HA_TLS_SERVER_HOSTNAME(cert IP/DNS), sessionsrequests/aiohttppartagées (MCP, vocal, Tab5). Vocal : priorité entités « vivantes », consignes TTS sans JSON.LLM : provider DashScope Coding Plan, clés Cerebras free vs payant séparées.
.env.exampleréécrit (sécurité, ToolMaker, workspace root, placeholders${HA_HOST}etc.)./versionpréfère.deploy_meta.jsonau git local sur le Deck.Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.