Skip to content

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

Merged
ivpusic merged 3 commits into
mainfrom
fix-query-run-timeout
Nov 23, 2026
Merged

ivpusic merged 3 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

norbertdurcansk and others added 2 commits November 20, 2026 17:22
…in test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A transient error on the final results download used to be retried by
WaitGetResults; now it fails once. Include the execution ID so the user
can fetch the results with dune execution results. Also align the
run-sql timeout test with the run one and drop a caller list from the
WaitForExecution doc comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@norbertdurcansk norbertdurcansk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Two small follow-ups, both optional: wrap the exec.GetResults() error in waitAndDisplay with the execution ID (WaitGetResults used to retry that call, so a transient 5xx after a long wait now fails with no way to find the execution), and give TestRunSQLStopsAtTheTimeout the same elapsed-time and poll-count assertions as the query run one.

@ivpusic
ivpusic merged commit a62760f into main Nov 23, 2026
6 checks passed
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