Canceling a query
When QRY is generating a response — running a SQL query, calling the LLM, executing Python — you can stop it. Canceling preserves whatever has streamed so far so you don't lose partial output.
Two ways to cancel
Click the Stop button
While QRY is responding, the Send button in the prompt area swaps to a Stop button. Click it.
Press ESC
With the prompt input focused, press ESC. Same effect as clicking Stop.
What happens when you cancel
- The frontend sends
POST /api/chat/cancel/{chat_id}to the backend. - The backend sets a Redis cancellation flag for the conversation.
- The streaming worker sees the flag on its next polling tick (typically within 1–2 seconds) and aborts the LLM call.
- Any in-flight database query is cancelled at the driver level.
- The partial response is saved to the conversation with a "cancelled" badge so you can see exactly what was produced before stopping.
When to cancel vs. when to wait
Cancel when:
- The query is going off-track and you want to refine the prompt.
- The streaming response is much longer than you wanted.
- You realised you typed the wrong question.
Wait when:
- You see Processing Details still ticking — the LLM is reasoning, often only seconds from the answer.
- A SQL query is running but bounded by the 30-second timeout — let it finish or time out cleanly.
- The model is using tools (file read, python execution) — interrupting mid-tool can leave a tool call in a half-finished state, which is messier than just letting it complete.
After canceling
The conversation stays exactly where it is. You can:
- Refine and re-ask — type a more specific prompt and send.
- Rewind — use Checkpoints and rewind to drop the cancelled turn entirely and restart from before it.
Common issues
The Stop button is unresponsive. The cancel signal takes 1–2 seconds to propagate through Redis to the worker. If nothing happens after a few seconds, the worker may have already crashed or the conversation may have completed between your click and the network round-trip — refresh the page.
The cancellation didn't kill the SQL query. For some database drivers (older PostgreSQL connections via legacy pools, certain SAP HANA configurations) the cancel doesn't fast-fail the underlying query — it'll still run to completion in the database, but QRY stops waiting for it. The conversation is unblocked even if the SQL keeps churning.
ESC didn't work. The keyboard shortcut only fires when the prompt input has focus. Click into the prompt first.
See also
- Checkpoints and rewind — drop a cancelled turn and re-ask cleanly.
- Starting a conversation — the canonical first-turn walkthrough.
- Query Cancellation reference — backend implementation details.