Skip to content

Commit c601bb6

Browse files
committed
fix(e2e): separate launch readiness states
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com> (cherry picked from commit 4d87aa5)
1 parent 2677154 commit c601bb6

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

test/e2e/live/full-e2e.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ async function runOpenClawLaunchTurnAfterRecovery(input: {
148148
env: env(PORTABLE_PROFILE ? { DOCKER_HOST: "" } : {}),
149149
exitCommand: "/exit",
150150
host: input.host,
151+
postReplyReadyText: "connected | idle",
151152
readyText: "gateway connected | idle",
152153
redactionValues: input.redactionValues,
153154
sandboxName: SANDBOX_NAME,

test/e2e/live/launch-agent-turn.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ has_exact_reply() {
110110
has_post_reply_ready() {
111111
normalized_response | awk \
112112
-v expected="$NEMOCLAW_LAUNCH_EXPECTED_REPLY" \
113-
-v ready="$NEMOCLAW_LAUNCH_READY_TEXT" '
113+
-v ready="$NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT" '
114114
{
115115
line = $0
116116
sub(/^[[:space:]]+/, "", line)
@@ -132,7 +132,7 @@ for _ in {1..180}; do
132132
sleep 1
133133
done
134134
135-
if [[ "$reply_seen" = 1 && -n "$NEMOCLAW_LAUNCH_READY_TEXT" ]]; then
135+
if [[ "$reply_seen" = 1 && -n "$NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT" ]]; then
136136
post_reply_ready_seen=0
137137
for _ in {1..60}; do
138138
if has_post_reply_ready; then
@@ -187,6 +187,7 @@ export interface LaunchAgentTurnOptions {
187187
env: NodeJS.ProcessEnv;
188188
exitCommand?: string;
189189
host: HostCliClient;
190+
postReplyReadyText?: string;
190191
readyText?: string;
191192
redactionValues: string[];
192193
sandboxName: string;
@@ -210,6 +211,7 @@ export async function runLaunchAgentTurn(
210211
NEMOCLAW_LAUNCH_EXIT_COMMAND: options.exitCommand ?? "",
211212
NEMOCLAW_LAUNCH_EXPECTED_REPLY: options.expectedReply ?? EXPECTED_REPLY,
212213
NEMOCLAW_LAUNCH_PROMPT: options.prompt ?? PROMPT,
214+
NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT: options.postReplyReadyText ?? "",
213215
NEMOCLAW_LAUNCH_READY_TEXT: options.readyText ?? "",
214216
NEMOCLAW_LAUNCH_SANDBOX: options.sandboxName,
215217
TERM: "xterm-256color",

test/e2e/live/launch-readiness-lease-acceptance.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ test.runIf(process.platform === "linux" && SANDBOX_NAME.length > 0)(
3838
env: process.env,
3939
exitCommand: "/exit",
4040
host,
41+
postReplyReadyText: "connected | idle",
4142
readyText: "gateway connected | idle",
4243
redactionValues: [],
4344
sandboxName: SANDBOX_NAME,

test/e2e/support/launch-agent-turn.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ exit ${exitStatus}
5151
NEMOCLAW_LAUNCH_EXIT_COMMAND: closeAfterReply ? "" : "/exit",
5252
NEMOCLAW_LAUNCH_EXPECTED_REPLY: "PONG",
5353
NEMOCLAW_FIXTURE_REPLY: reply,
54+
NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT: "",
5455
NEMOCLAW_LAUNCH_PROMPT: "prompt",
5556
NEMOCLAW_LAUNCH_READY_TEXT: "",
5657
NEMOCLAW_LAUNCH_SANDBOX: "sandbox",
@@ -87,6 +88,7 @@ it.runIf(process.platform === "linux")(
8788
env: {},
8889
exitCommand: "/exit",
8990
host: host as never,
91+
postReplyReadyText: "connected | idle",
9092
readyText: "gateway connected | idle",
9193
redactionValues: [],
9294
sandboxName: "alpha",
@@ -108,11 +110,18 @@ it.runIf(process.platform === "linux")(
108110
"/exit",
109111
"/exit",
110112
]);
113+
expect(calls.slice(1).map((call) => call.env?.NEMOCLAW_LAUNCH_READY_TEXT)).toEqual([
114+
"gateway connected | idle",
115+
"gateway connected | idle",
116+
]);
117+
expect(
118+
calls.slice(1).map((call) => call.env?.NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT),
119+
).toEqual(["connected | idle", "connected | idle"]);
111120
},
112121
);
113122

114123
it.runIf(process.platform !== "win32")(
115-
"waits for OpenClaw idle before the prompt and again before the exit command (#9023)",
124+
"waits for 'gateway connected | idle' before the prompt and 'connected | idle' before exit (#9023)",
116125
() => {
117126
const fixtureRoot = mkdtempSync(join(tmpdir(), "nemoclaw-launch-turn-ready-"));
118127
const scriptStub = join(fixtureRoot, "script");
@@ -140,7 +149,7 @@ if IFS= read -r -t 1 -d $'\r' _; then
140149
echo "exit arrived before post-reply readiness" >&2
141150
exit 1
142151
fi
143-
printf 'gateway connected | idle\n' | tee -a "$capture"
152+
printf 'connected | idle\n' | tee -a "$capture"
144153
IFS= read -r -d $'\r' exit_command
145154
[[ "$exit_command" == "/exit" ]]
146155
exit 0
@@ -161,6 +170,7 @@ exit 0
161170
NEMOCLAW_LAUNCH_EXIT_COMMAND: "/exit",
162171
NEMOCLAW_LAUNCH_EXPECTED_REPLY: "PONG",
163172
NEMOCLAW_LAUNCH_PROMPT: "prompt",
173+
NEMOCLAW_LAUNCH_POST_REPLY_READY_TEXT: "connected | idle",
164174
NEMOCLAW_LAUNCH_READY_TEXT: "gateway connected | idle",
165175
NEMOCLAW_LAUNCH_SANDBOX: "sandbox",
166176
PATH: `${fixtureRoot}:${process.env.PATH ?? ""}`,

0 commit comments

Comments
 (0)