AltimateAI / AltimateAI/altimate-code

fix: agent uses bash for DuckDB queries instead of sql_execute — data shown twice

Abierto
#172 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
811
Forks
134
Merge medio
3 d 2 h
PR fusionados (30 d)
50

Descripción

### What does this PR do?

When a user asks to query a local DuckDB file, the agent runs `duckdb demo.duckdb "SELECT ..."` via the bash tool instead of using `sql_execute`. This causes:

1. Raw duckdb CLI output shown in the Bash tool block (29 columns, unformatted, scrolls horizontally)
2. LLM re-formats the same data as markdown table in its text response
3. User sees the **same data twice** — once ugly, once formatted

### Expected behavior

The agent should use `sql_execute` for DuckDB queries so:
- The DataTable component renders the data **once** with type indicators, boolean ✓/✗, column stats
- No duplicate data display
- No raw CLI output flooding the screen

### Root cause

`sql_execute` requires a configured warehouse connection via the Python bridge. Local DuckDB files aren't auto-detected as connections. The agent falls back to bash because it's the only way to query the file.

### Proposed fix

Auto-detect `.duckdb` files in the working directory and register them as ephemeral warehouse connections for `sql_execute`. When the agent sees a DuckDB file, it should prefer `sql_execute` over `bash duckdb`.

### Screenshots

Data shown twice — raw bash output at top, LLM markdown table at bottom:

![duplicate data](https://github.com/user-attachments/assets/placeholder)

### Type of change

- [x] Bug fix
- [ ] New feature

### Checklist

- [ ] Auto-detect .duckdb/.db files as local connections
- [ ] Register ephemeral DuckDB connections in sql_execute
- [ ] Agent prompt guidance to prefer sql_execute over bash for queries
- [ ] Test with local DuckDB files

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.