Skip to content

Fix terminal command completion marker handling - #2160

Open
xxstar-01 wants to merge 1 commit into
FoundationAgents:mainfrom
xxstar-01:fix/terminal-marker-final-line
Open

xxstar-01 wants to merge 1 commit into
FoundationAgents:mainfrom
xxstar-01:fix/terminal-marker-final-line

Conversation

@xxstar-01

Copy link
Copy Markdown

Fixes #2110

Summary

The persistent terminal reader could hang forever when the command-completion marker was the final newline-terminated line. splitlines(True) assigned that complete line to the temporary buffer instead of processing it, so the marker was never detected.

This change treats a trailing newline as a complete line and adds a regression test covering a marker-only final line.

Validation

  • python -m compileall -q metagpt/tools/libs/terminal.py tests/metagpt/tools/libs/test_terminal.py
  • Direct async runtime check against the actual reader implementation passed with a byte-at-a-time fake stdout.
  • The repository pytest module was attempted but collection requires the legacy semantic_kernel==0.4.3.dev0 dependency, which is unavailable for this Python 3.13 environment.

AI assistance

Tool(s) used: Codex

How you used it: Investigated Issue #2110, implemented the minimal reader fix, added a regression test, and ran syntax plus targeted runtime validation.

This branch had an error being deployed

1 failed deployment
unittest — 904fad31 Deployed Sep 24, 2026 by xxstar-01 via build (3.9) #1737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal.run_command() hangs indefinitely on Linux/WSL2 — end-of-command marker never yielded from splitlines/tuple-unpack

1 participant