Skip to content

fix(adk/filesystem): fix emptyStreamConcatErr when streaming execute command has no output#790

Merged
hi-pender merged 4 commits intomainfrom
fix/stream_shell
Feb 14, 2026
Merged

fix(adk/filesystem): fix emptyStreamConcatErr when streaming execute command has no output#790
hi-pender merged 4 commits intomainfrom
fix/stream_shell

Conversation

@hi-pender
Copy link
Contributor

@hi-pender hi-pender commented Feb 13, 2026

Problem

When using ExecuteStreaming to run commands that produce no stdout output (e.g., mkdir, touch), the operation fails with concat stream reader fail: stream reader is empty, concat fail error, even though the command itself succeeds.

Root Cause

Call chain:

  1. local.ExecuteStreaming executes the command and sends &filesystem.ExecuteResponse{ExitCode: new(int)} to indicate successful completion (ExitCode=0) when there's no stdout
  2. newStreamingExecuteTool calls convExecuteResponse(chunk) for each chunk
  3. convExecuteResponse returns an empty string "" because Output="", ExitCode=0 doesn't match the != 0 condition, and Truncated=false
  4. Since str == "", the streaming logic skips this chunk and sends nothing
  5. concatStreamReader receives only EOF with an empty items slice, triggering emptyStreamConcatErr

Solution

Refactored the streaming logic in newStreamingExecuteTool:

  1. During stream consumption:

    • Track exitCode across chunks
    • Combine Output and Truncated info within the same chunk before sending (avoiding multiple sends per chunk)
    • Track whether any content has been sent
  2. After stream completion:

    • If exitCode != 0, append failure message with error code
    • If no content was sent, send [Command executed successfully with no output]
  3. Preserved convExecuteResponse: Used by non-streaming newExecuteTool, with the same fix applied

Changes

  • adk/middlewares/filesystem/filesystem.go: Refactored streaming logic
  • adk/middlewares/filesystem/filesystem_test.go: Added test case for "successful command with no output"

…command has no output

When executing commands with no stdout output (e.g., mkdir, touch) via
ExecuteStreaming, the stream would fail with emptyStreamConcatErr because
convExecuteResponse returned empty string for successful commands with no output.

Changes:
- Refactor newStreamingExecuteTool to handle stream chunks properly:
  - Collect exitCode across chunks, process truncated per-chunk
  - Combine Output and Truncated info within the same chunk before sending
  - Send success message when no content was sent and command succeeded
- Add test case for successful command with no output
- Keep convExecuteResponse for non-streaming newExecuteTool with same fix~
@hi-pender hi-pender changed the title fix(adk/filesystem): fix emptyStreamConcatErr when streaming execute command has no output fix(filesystem): fix emptyStreamConcatErr when streaming execute command has no output Feb 13, 2026
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 20.83333% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.40%. Comparing base (b443cd9) to head (3e07579).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
adk/middlewares/filesystem/filesystem.go 20.83% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #790      +/-   ##
==========================================
- Coverage   80.51%   80.40%   -0.11%     
==========================================
  Files         129      129              
  Lines       13007    13026      +19     
==========================================
+ Hits        10472    10473       +1     
- Misses       1733     1753      +20     
+ Partials      802      800       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hi-pender hi-pender changed the title fix(filesystem): fix emptyStreamConcatErr when streaming execute command has no output fix(adk/filesystem): fix emptyStreamConcatErr when streaming execute command has no output Feb 13, 2026
@hi-pender hi-pender merged commit 65f8955 into main Feb 14, 2026
17 of 19 checks passed
@hi-pender hi-pender deleted the fix/stream_shell branch February 14, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants