DSH CJK Heredoc timeout
DSH CJK Heredoc Timeout: Agent Teams State Analysis
- Author
- DeepSeekAgent.io Editorial Team
- Published
- Updated
A DeepSeek Harness Desktop 0.2.1-rc.3 community reproduction shows four child Agents completing successfully before the parent submits a Bash command containing a Python heredoc and CJK UI strings. The command produces no output for 300 seconds, then exits with a timeout or memory error and resets the persistent shell.
The UI can make this look like Agent Teams never finished. The event timeline says otherwise: every child is done, and the parent is blocked inside one Bash tool call. That distinction changes the investigation.
The reproduction timeline
The report uses DSH Desktop 0.2.1-rc.3, bundled DSH 0.1.208, and macOS arm64. Four delegated tasks finish after roughly 6:46 to 10:02 each.
At 17:37:14.997, the parent starts step 121: a roughly 970-character Bash command that uses a Python heredoc to write a file containing CJK interface text. There is no output until 17:42:21.817. Once the 300-second ceiling is reached, the parent immediately resumes. A later 511-character git apply && perl -0pi command makes a comparable CJK edit successfully.
The control case narrows the fault to the way multiline input crosses an interactive or persistent PTY. CJK text alone, filesystem writes, and child-Agent scheduling do not explain it.
Why the UI can mislead diagnosis
Agent Teams presents parent work, delegated work, and active tools together. Child completion does not imply parent completion: the parent may still be waiting on a shell command, file update, or synthesis step.
Inspect three separate state lines:
- the final event and output of every child Agent;
- whether the parent received all delegated results;
- whether the parent still owns an active tool call.
If every child is complete while a parent Bash call remains silent until timeout, record a blocked parent tool. Adding more child Agents or waiting for the Team badge to refresh will not resolve the command.
Why heredocs are fragile on this path
A heredoc requires the shell to keep reading lines until an exact terminator arrives. When content crosses the Agent, tool protocol, PTY, shell, and a nested interpreter, newline handling, input-complete signaling, or encoding boundaries can leave the shell waiting for another line.
The DSH community has also reported CJK/readline and multiline PTY failures. Together, these cases argue against sending long source bodies through an interactive shell by default, especially when the command combines non-ASCII text, nested quoting, and a second interpreter.
Safer execution patterns
Prefer patch or file-write tools for code and configuration so the body travels as structured data. When a shell is required:
- split the edit into reviewable patches;
- use a noninteractive process with an explicit stdin boundary;
- avoid nesting Bash, heredoc, Python, and heavy escaping in one command;
- add a short no-output warning while retaining a separate total timeout;
- show the active tool name, start time, and elapsed time in parent events.
Timeout recovery should preserve the last command, process tree, and input state. Resetting the persistent shell lets later work continue, but discarding the diagnostic context makes the next reproduction just another unexplained stall.
Implications for Agent Teams
Team status should distinguish “all children complete” from “parent complete.” While the parent waits on Bash, the UI could say “4/4 child tasks complete; parent running Bash” and expose a way to stop the active tool. Users can then see that results already exist without mistaking a tool timeout for a multi-Agent scheduling failure.
For a stable delay near 30 seconds on every turn, compare the DSH fixed 30-second scheduling analysis. That problem sits at a turn boundary; this 300-second case occurs inside an already-started shell tool.