Skip to content

Studio: don't stop long running tool calls that print nothing - #11969

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:studio-tool-heartbeat-renews-lease
Sep 27, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:studio-tool-heartbeat-renews-lease

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

When a tool call runs for a long time without printing anything, like a build or a download, the chat was stopped after about 20 minutes with "Generation stopped making progress". This happened even when Max Tool Call Duration was set to 30 minutes or Max. The signal that says a tool is still running was treated the same as an idle connection.

That signal is now counted as progress, so a tool can run until the limit the user picked. A chat that is really stuck is still stopped as before.

Before / after

A durable local chat (Qwen3-4B-Instruct-2507 GGUF Q4_K_M) runs one silent terminal command, sleep 75 && printf 'DONE-11969\n'. The run lease is shortened to 30s on both sides (UNSLOTH_STUDIO_CHAT_RUN_LEASE_TIMEOUT_S=30, sweep 5s) so the 20 minute case shows in about a minute. BEFORE is the merge base d4d224e, AFTER is this PR at fa95f2b, each a separate install.sh --local build.

before and after, run ended

BEFORE: the run fails after 36.8s with "Generation stopped making progress". AFTER: the run completes at 78.9s and the reply is DONE-11969.

before and after, tool card expanded

With the tool card expanded, BEFORE has no tool output and AFTER shows DONE-11969 as the command output.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Codex review (mirror)

Mirrored at NilayYadav#76 (base = upstream merge base a8d998f, diff is this PR only).

Round Commit Result
1 a262d30 (current head) No findings, 👍

Converged on the current head; no retrigger needed.

A/B on the new tests (same tests, only the implementation changed):

Variant Result
head 5/5 pass; related suites (supervisor, lease compat, GGUF/SF passthrough, Anthropic messages) pass
heartbeat relayed as : keep-alive again both relay tests fail at assert ': tool-heartbeat' in chunks
producer ignores : tool-heartbeat lease test fails, run reaped (['run-1'] == [])

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

UI evidence: before / after

A durable local chat runs one silent terminal call (sleep 75 && printf 'DONE-%s\n' 11969). The two sides use the same model (Qwen3-4B-Instruct-2507 GGUF Q4_K_M) and the same prompt. The lease is shortened to 30s on both (UNSLOTH_STUDIO_CHAT_RUN_LEASE_TIMEOUT_S=30, sweep 5s) so the 20 minute case reproduces in about a minute. BEFORE is the merge base a8d998f; AFTER is the head a262d30. Each side is a separate install.sh --local build with its own home and port.

At the moment the run ended:
pair 00

Final transcript with the tool card expanded:
pair 01

Fact BEFORE AFTER
Run status failed / interrupted completed / stop
Run error Generation stopped making progress none
Time from tool start to run ending 30.8s 75.7s
Lease renewals while the tool was silent 0 7 (every 10.0s)
Longest time without progress 30.0s 9.9s
Lease-expired log lines 1 0
Tool result none DONE-11969
DONE-11969 shown in chat no yes

The frontend's own stall timer is 30 min, so the failure BEFORE comes only from the backend lease sweeper.

@danielhanchen

Copy link
Copy Markdown
Member

Review record for #11969, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#152.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror d6f662384d (this PR's fa95f2b4f)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: d6f662384d

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror d6f662384d (this PR's fa95f2b4f).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 27, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 27, 2026
@danielhanchen
danielhanchen merged commit 1d8c891 into unslothai:main Sep 27, 2026
49 checks passed
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…hai#11969)

* Studio: renew durable run lease on tool heartbeats

* Trim tool heartbeat test comment

---------

Co-authored-by: Daniel Han <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants