fix(cli): preserve image interrupts when re-queueing - #5202
Conversation
|
Likely duplicate of #12751 — same root cause: Ctrl+C requeue crashes on multimodal tuples due to join() on mixed str/tuple payloads. |
|
Likely duplicate of #12751 |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing this to the interrupt requeue path. The underlying defect remains on current main: attached images are queued as (text, images) at cli.py:13500-13531, while the requeue branch still executes "\n".join(all_parts) at cli.py:12716-12732.
Problems
tests/test_cli_interrupt_payloads.pytests the proposed helpers in isolation, but does not exercise the liveHermesCLI.chat()requeue branch. The existing acknowledged-interrupt test attests/cli/test_cli_interrupt_ack_race.py:155-193covers that branch only for text payloads.
Suggested changes
- Add a tuple/image case to that live-path test and assert the queued next-turn payload retains
(text, [Path, ...]). - When salvaging onto current main, keep the focused type-aware merge at
cli.py:12716-12732; current process_loop already consumes that tuple format atcli.py:15186-15189.
Automated hermes-sweeper review.
| @@ -6578,14 +6666,15 @@ def run_agent(): | |||
| all_parts.append(extra) | |||
There was a problem hiding this comment.
Please add a regression through HermesCLI.chat() as well as helper tests. tests/cli/test_cli_interrupt_ack_race.py:155-193 already drives the acknowledged requeue branch; queue an ("", [tmp_path / "clip.png"]) payload there and assert _pending_input retains the tuple.
Summary
(text, [Path, ...])CLI payloads when merging interrupted input back into_pending_input"\n".join(...)on tuple payloads, which crashed when a running turn was interrupted with attached clipboard imagesReproduction (before fix)
Interactive CLI repro:
hermesin interactive mode.Before this patch, the re-queue path treated every queued item as a string and attempted
"\n".join(all_parts). If one of those items was the image payload tuple, Hermes crashed with:TypeError: sequence item 0: expected str instance, tuple foundThe exact failing payload shape looked like:
("", [PosixPath("/Users/.../.hermes/images/clip_*.png")])Minimal code-level repro:
Root cause
The interactive CLI queues image attachments as
(text, images)tuples. When a turn was interrupted, the requeue path treated every pending item as a string and did"\n".join(all_parts), which raised the TypeError above.Validation
~/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts='' tests/test_cli_interrupt_payloads.py tests/test_cli_file_drop.py tests/tools/test_interrupt.py -q~/.hermes/hermes-agent/venv/bin/python -m py_compile cli.py tests/test_cli_interrupt_payloads.pygit diff --check