shell: say what a long command line's timeout probably means - #6
Merged
Conversation
Past a limit of its own a remote shell truncates the typed line and says nothing; the exit-code marker goes with it, so -c waits for output that cannot come and eventually reports a bare "timed out waiting for command to finish", which explains nothing. The limits differ by shell — a megabyte with bash, 4094 characters under dash, 8190 on cmd.exe — and dwshell cannot know which shell answers, so it cannot predict this. What it can do is read two things it already has: how long the line it sent was, and whether anything ran at all. Past 4000 characters, the lowest point any measured shell truncates at, the timeout now names truncation as a possible cause and points at `dwshell put`. It stays a possibility, never a diagnosis: a command still running looks the same from here, which is why the hint is gated on a length that could actually have been cut. Below that length the message is unchanged. Nothing is added to the wire and nothing is typed at the remote — the lesson of the reverted probe (v1.3.9), whose extra typed line was eaten by commands reading stdin. Verified live: a 12000-character line on a Windows agent gets the hint, while `sleep 60` against an 8s timeout still gets the plain message. Closes #3. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MvidAFW9a2r4hTgHPW9ywG
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.
Closes #3.
The problem
Past a limit of its own, a remote shell truncates the typed command line and says nothing at all. The exit-code marker sits at the end of that line, so it goes with it, and
-cwaits for output that cannot come — then reports:which explains nothing. That is what the reporter of #1 hit, and why they spent time bisecting.
Why not something better
The limits belong to the remote shell and differ by shell — roughly a megabyte with
bash/zsh, 4094 characters undersh/dash/ash(the tty cutting a canonical-mode read), 8190 oncmd.exe. dwshell cannot know which shell will answer, so it cannot predict this, and guessing would deny commands the remote would have run.Detecting it properly was tried and reverted: the probe in v1.3.9 typed an extra line at the remote, which any command reading stdin consumed —
dwshell host -c "cat > file"wrote dwshell's own marker into the user's file. Trading a hang for silent data corruption is the worse outcome.What this does instead
Nothing is added to the wire and nothing is typed at the remote. The timeout reads two things dwshell already has locally — the length of the line it sent, and whether anything ran — and past 4000 characters, the lowest point any measured shell truncates at, names truncation as a possible cause:
It stays a possibility, never a diagnosis. A command that is simply still running looks identical from here, which is why the hint is gated on a length that could actually have been cut. Below that length the message is unchanged.
Verification
sleep 60against an 8 s timeoutgofmt,go vet,go test -race ./...green.🤖 Generated with Claude Code
https://claude.ai/code/session_01MvidAFW9a2r4hTgHPW9ywG