fix: Terraform Agent uses SQLite RAG only, terminal shows errors properly

- Skip ADB vector search for Terraform Agent (uses local SQLite resource reference instead)
- Show error message in terminal when plan fails validation (no more stuck "Aguardando execução")
- Write region validation error to plan_output field for terminal display
- Fix Plan/Re-plan button visibility for all workspace states (including stuck planning/applying)
This commit is contained in:
nogueiraguh
2026-03-12 08:45:54 -03:00
parent e4ba2cfaab
commit 981f77b1eb
2 changed files with 9 additions and 7 deletions

View File

@@ -3962,7 +3962,7 @@ async def _chat_background(mid: str, sid: str, msg: ChatMsg, user: dict, genai_c
log.info(f"RAG: filtering by tenancy '{rag_tenancy}'")
rag_context = ""
adb_cfgs = _get_active_adb_configs(user["id"])
adb_cfgs = _get_active_adb_configs(user["id"]) if agent_type != "terraform" else []
if adb_cfgs:
all_documents = []
for adb_cfg in adb_cfgs:
@@ -5176,8 +5176,8 @@ async def _terraform_exec(wid: str, action: str, user: dict):
)
log.warning(f"Workspace {wid}: missing variable 'region' — blocking plan")
with db() as c:
c.execute("UPDATE terraform_workspaces SET status='failed', error=?, updated_at=datetime('now') WHERE id=?",
(error_msg, wid))
c.execute("UPDATE terraform_workspaces SET status='failed', plan_output=?, error=?, updated_at=datetime('now') WHERE id=?",
(error_msg, error_msg, wid))
return
region_value = 'var.region'