Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion test/e2e/live/launch-agent-turn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,8 +1264,18 @@ if ! printf '%s\r' "$NEMOCLAW_LAUNCH_SECOND_INPUT" >&3; then
fi
wait_for_turn_count 2

exit_command_write_status=0
if [[ -n "$NEMOCLAW_LAUNCH_EXIT_COMMAND" ]]; then
printf '%s\r' "$NEMOCLAW_LAUNCH_EXIT_COMMAND" >&3
# The TUI may finish cleanly immediately after publishing the two required
# structured turns. Preserve that successful child status even when its
# input reader wins the race with the best-effort exit command.
trap '' PIPE
if printf '%s\r' "$NEMOCLAW_LAUNCH_EXIT_COMMAND" >&3; then
:
else
exit_command_write_status=$?
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
trap - PIPE
else
# Some TUIs have no exit command. They may close the FIFO after the first
# interrupt, so ignore SIGPIPE while sending the second one.
Expand All @@ -1285,6 +1295,9 @@ fi
session_pid=""

if [[ "$launch_status" != 0 ]]; then
if [[ "$exit_command_write_status" != 0 ]]; then
echo "launch PTY closed before the exit command was submitted (status $exit_command_write_status)" >&2
fi
echo "launch exited with status $launch_status" >&2
terminal_diagnostic
exit "$launch_status"
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/support/launch-agent-turn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ if (process.argv[2] !== "tui") {
const second = await ask();
append("user", second);
append("assistant", "second response");
if (mode === "delayed-input-attachment") process.exit(0);
const exitCommand = await ask();
if (mode === "late-extra") append("user", firstInput);
rl.close();
Expand Down Expand Up @@ -1043,7 +1044,7 @@ it.runIf(process.platform === "linux").each(["absent", "ansi", "reordered"] as c
);

it.runIf(process.platform === "linux")(
"waits for the OpenClaw TUI input mode before submitting PTY input (#9160)",
"waits for OpenClaw input mode and accepts a clean exit after two turns (#9160, #9384)",
() => {
const { baselineRemoved, result, ttyObserved } = runLaunchSessionFixture(
"delayed-input-attachment",
Expand Down
Loading