diff --git a/sdk/src/query/phase-lifecycle.ts b/sdk/src/query/phase-lifecycle.ts
index 48620dbd1..dba30143f 100644
--- a/sdk/src/query/phase-lifecycle.ts
+++ b/sdk/src/query/phase-lifecycle.ts
@@ -111,8 +111,9 @@ export function replaceInCurrentMilestone(
// Fast path: the current milestone is not inside a block — the
// pattern lives in the plain text after the last .
- if (after.trim().length > 0) {
- return before + after.replace(pattern, replacement);
+ const replacedAfter = after.replace(pattern, replacement);
+ if (replacedAfter !== after) {
+ return before + replacedAfter;
}
// Slow path: the active milestone is inside the last block.