Skip to content

Enforce --timeout in query run and run-sql - #73

Open
ivpusic wants to merge 2 commits into
mainfrom
fix-query-run-timeout
Open

ivpusic wants to merge 2 commits into
mainfrom
fix-query-run-timeout

Conversation

@ivpusic

@ivpusic ivpusic commented Nov 20, 2026

Copy link
Copy Markdown
Member

dune query run and dune query run-sql now stop waiting at --timeout and fail with execution <id> is still EXECUTING after <n>s; .... Before, a query that kept running was waited on forever. Follow-up from Norbert's review of #69.

Impact

  • query run and query run-sql without --no-wait. They used the SDK's WaitGetResults, whose maxRetries counts only errors.
  • They now wait with execution.WaitForExecution (exported from cmd/execution, the status poll execution results uses since Enforce --timeout when waiting for unshaped execution results #69) and then fetch the rows once with GetResults. So the same rules apply: a still-running query fails at the deadline, transient errors (network, 5xx, 429) are retried with a note on stderr, and any other 4xx fails at once.
  • WaitForExecution now takes a status function, so execution results passes client.QueryStatus and query run passes exec.GetStatus.

Context for reviewers

  • TestRunStopsAtTheTimeout checks that a query stuck in EXECUTING fails within about --timeout, after several status polls.

  • The query test mock now implements GetStatus/GetResults instead of WaitGetResults; the existing run and run-sql tests are otherwise unchanged and pass.

  • No visual surface: CLI change with no rendered UI; verified with unit tests (go vet ./..., go test -race ./...).

They waited with the SDK's WaitGetResults, whose maxRetries counts only
errors, so a query that kept running was waited on forever. They now
wait with execution.WaitForExecution, the status poll execution results
uses, and fetch the rows once it finishes.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f46d-4de8-7404-a66a-7e2a8be6632a
Co-authored-by: Amp <amp@ampcode.com>
@norbertdurcansk

Copy link
Copy Markdown
Contributor

@claude review

…in test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants