Questions spanning thousands of tables force the model to hand-write 20k-character UNION ALL statements (19% of cost in one batch of sessions)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 18/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- sql, typescript
Direção de pesquisa
Start with the write classifier in packages/opencode/src/altimate/tools/sql-classify.ts (around lines 27 and 226-235) and the denial path in sql-execute.ts (lines 113-121) to see which session-local statements are blocked. The issue offers three alternative designs, so the scope needs a maintainer decision before any code. Done would be a question over 1,000+ tables finishing with no single model output above 2k tokens.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Problem
A warehouse with one table per entity (2,753 tables) has no tool-supported way to query across a set of tables. Every route that would let the engine iterate over a table list is rejected or classified as a write, so the model generates the full UNION ALL text itself and re-types it into sql_execute.
Mechanism
- DuckDB
query_table([...])rejects subqueries and lateral arguments ("Table function cannot contain subqueries" 36 times, "does not support lateral join column" 34, "Invalid named parameter" 12). An engine limit. - The statements that work around it (
SET max_expression_depthwhich DuckDB's own error recommends,SET VARIABLE+query_table(getvariable(...)),EXECUTE IMMEDIATE,CREATE TEMP MACRO ... AS TABLE) are denied as writes (packages/opencode/src/altimate/tools/sql-classify.ts:27,:226-235;sql-execute.ts:113-121). - The model builds the text with
string_agg; the single huge result cell is clipped in the preview (sql-result-format.ts:40,:178,:342), so it reads the spill file viabash/readand re-types the SQL (output tokens).
Evidence
- 33 of 44 preview truncations are generated SQL.
- Median output tokens per session on the affected question: 42,355 (Claude Opus) and 23,545 (gpt-5.6-sol), against 362-3,404 on other questions on the same warehouse.
- 246-675 s and $5.98-$10.87 per Opus session, the 8 costliest of a 270-session batch; $58.2 of $307.9 (19%) for the two affected questions; context up to 144k tokens; one session used 675 of an 840 s budget; gpt-5.6-sol sessions ran 621-851 s and contributed to budget misses.
- Generations of 15-25k tokens took 100-160 s each.
Impact
Time and cost, with budget risk. No incorrect answers caused directly in Opus sessions.
Proposed fix
Pick one or more:
- A table-set primitive on
sql_materialize/sql_execute(for exampletables: "A*"or a list obtained from a scratch query) that expandsUNION ALL BY NAMEserver-side. - Allow session-local non-writing settings (
SET max_expression_depth,threads,memory_limit) on read-only connections, andCREATE [TEMP] MACROin scratch. - A
query_from: {warehouse, sql}option that classifies the generated text before running it.
Acceptance check
A question over 1,000+ tables completes without any single model output above 2k tokens; median output tokens and cost drop by at least 5x on the affected workload.
- Linguagem predominante
- TypeScript
- Estrelas
- 810
- Forks
- 121
- Merge médio
- 1d 12h
- PRs com merge (30d)
- 94
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de AltimateAI/altimate-code
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
AltimateAI/altimate-code#1454 ·
Mantenedores costumam responder em até 1 dia
-
test: MCP tests fail when the developer's ~/.claude.json has MCP servers (HOME is not sandboxed)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
AltimateAI/altimate-code#1386 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
AltimateAI/altimate-code#1384 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
AltimateAI/altimate-code#1323 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
AltimateAI/altimate-code#1288 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de AltimateAI/altimate-code
Issues semelhantes
-
area: app type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
ExpidetGames/code-reviewer#585 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 83/100
module-federation/core#5205 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
LanternOps/breeze#9392 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
engine-rs P3 review-deferral wasm
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
maniator/verticopolis#1154 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia