Skip to content

Commit 0d3a532

Browse files
committed
fix(e2e): normalize OSC replies in launch harness
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
1 parent 8fed52b commit 0d3a532

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ printf '%s\r' "$NEMOCLAW_LAUNCH_PROMPT" >&3
9191
reply_seen=0
9292
has_exact_reply() {
9393
tail -c "+$((response_start + 1))" "$capture" \
94+
| sed -E $'s/\x1B][^\x07\x1B]*(\x07|\x1B\\\\)//g' \
9495
| sed -E $'s/\x1B\\[[0-?]*[ -\\/]*[@-~]//g' \
9596
| tr '\r' '\n' \
9697
| LC_ALL=C tr -d '\000-\010\013\014\016-\037\177' \

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,30 @@ it.runIf(process.platform !== "win32")(
183183
},
184184
);
185185

186+
it.runIf(process.platform !== "win32")(
187+
"accepts an exact reply wrapped in a terminated OSC-8 hyperlink (#9023)",
188+
() => {
189+
for (const terminator of ["\u0007", "\u001b\\"]) {
190+
const reply =
191+
`\u001b]8;;https://example.invalid/reply${terminator}` +
192+
`PONG\u001b]8;;${terminator}`;
193+
const result = runLaunchTurnFixture(0, reply);
194+
195+
expect(result.signal, result.stderr).toBeNull();
196+
expect(result.status, result.stderr).toBe(0);
197+
expect(result.stdout).toContain("NEMOCLAW_LAUNCH_TURN_OK");
198+
}
199+
},
200+
);
201+
186202
it.runIf(process.platform !== "win32")(
187203
"rejects a reply token embedded in extra prose (#8942)",
188204
() => {
189205
for (const reply of [
190206
"The answer is PONG, with extra prose.",
191207
"The answer is \u001b[31mPONG\u001b[0m, with extra prose.",
208+
"\u001b]8;;https://example.invalid/reply\u0007PONG with extra prose\u001b]8;;\u0007",
209+
"\u001b]8;;https://example.invalid/replyPONG",
192210
]) {
193211
const result = runLaunchTurnFixture(0, reply, true);
194212

0 commit comments

Comments
 (0)