Repository navigation
Enforce --timeout when waiting for unshaped execution results - #69
Merged
Merged
Conversation
norbertdurcansk
approved these changes
Nov 20, 2026
norbertdurcansk
left a comment
Contributor
There was a problem hiding this comment.
Approved, with suggestions. The fix is right: both paths now wait on the status, rows download once, and --timeout is honoured. Tests pass locally (go test -race ./cmd/execution/...).
Two suggestions inline, both about errors that will never succeed now being retried silently until the timeout.
Out of scope: as the description notes, query run / query run-sql still use WaitGetResults in cmd/query/helpers.go, so their --timeout likely has the same gap. Worth a follow-up.
The unshaped path waited with the SDK's WaitGetResults, whose maxRetries counts only errors, so a query that kept running was waited on forever, and every row was downloaded once while waiting and again at the end. Both paths now poll the execution status until the deadline, retrying failed status calls until then, and download the rows once. Amp-Thread-ID: https://ampcode.com/threads/T-01a1f46d-4de8-7404-a66a-7e2a8be6632a Co-authored-by: Amp <amp@ampcode.com>
A 4xx status response other than 429, such as an unknown execution ID or a bad API key, cannot succeed on retry, so it is returned right away. Other failures are still retried until --timeout, each with a note on stderr so a long wait is not silent. Amp-Thread-ID: https://ampcode.com/threads/T-01a1f46d-4de8-7404-a66a-7e2a8be6632a Co-authored-by: Amp <amp@ampcode.com>
ivpusic
force-pushed
the
fix-results-timeout
branch
from
November 20, 2026 10:05
6502bf8 to
30d210e
Compare
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dune execution resultsignored--timeoutwithout--columns/--filter/--sort-by/--sample: a query that kept running was waited on forever. Both paths now poll the execution status until the deadline and download the rows once. Follow-up from Norbert's review of #67.Impact
execution resultswithout shaping flags, when waiting (the default).--no-waitis unchanged.WaitGetResults, whosemaxRetriescounts only errors. It also downloaded every row while polling and again for the final fetch. It now useswaitForExecution, the status poll the shaped path already used.execution <id> is still EXECUTING after <n>s; ...on both paths. Fix CLI issues found testing the MCP parity commands live #68 added this for the shaped path, and this PR is rebased onto it.waitForExecutionretries transient failures (network errors, 5xx, 429) until the deadline, printing a note to stderr for each retry, and then returnsretries have been exhausted: <error>. Any other 4xx, such as an unknown execution ID or a bad API key, fails on the first call.Context for reviewers
TestResultsWaitStopsAtTheTimeouthangs on main (killed at 8s) and passes here in about 1s.The wait tests now mock
QueryStatus. They assert one row download per command, error recovery, and retries until the timeout.Not changed:
query runandquery run-sqlwait the same way (cmd/query/helpers.gocallsWaitGetResults), so their--timeoutlikely has the same gap.No visual surface: CLI change with no rendered UI; verified with unit tests (
go vet ./...,go test -race ./...).