GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client): a subagent prompt that opens with comment dividers no lo… · HNRow/r3code@f70eb5c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/client-runtime/src/state
    • subagentRuntime.test.ts
    • subagentRuntime.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/client-runtime/src/state/subagentRuntime.test.ts‎

Copy file name to clipboardExpand all lines: packages/client-runtime/src/state/subagentRuntime.test.ts
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,5 +316,17 @@ describe("resolveWorkflowOpening", () => {
316316
false,
317317
);
318318
expect(isWorkflowScriptMessage({ role: "assistant", text: SCRIPT })).toBe(false);
319+
expect(
320+
isWorkflowScriptMessage({ role: "user", text: `// a\r// b\u2028/* c\n * d */\r\n${SCRIPT}` }),
321+
).toBe(true);
322+
expect(isWorkflowScriptMessage({ role: "user", text: "// export const meta = {}" })).toBe(
323+
false,
324+
);
325+
// Divider comments ahead of ordinary code must reject without catastrophic backtracking.
326+
const dividers = `${"/".repeat(40)}\n`.repeat(40);
327+
expect(isWorkflowScriptMessage({ role: "user", text: `${dividers}const x = 1;` })).toBe(false);
328+
expect(
329+
isWorkflowScriptMessage({ role: "user", text: `${"/**/".repeat(200)}const x = 1;` }),
330+
).toBe(false);
319331
});
320332
});
Collapse file

‎packages/client-runtime/src/state/subagentRuntime.ts‎

Copy file name to clipboardExpand all lines: packages/client-runtime/src/state/subagentRuntime.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,9 @@ export function deriveWorkflowGroups(
325325
}
326326

327327
// Workflow scripts open with their `meta` export, after any leading comments.
328-
const WORKFLOW_SCRIPT_START = /^\s*(?:(?:\/\/[^\n]*|\/\*[\s\S]*?\*\/)\s*)*export\s+const\s+meta\b/;
328+
// Each comment has one way to match, so a prompt of `////` divider lines cannot backtrack.
329+
const WORKFLOW_SCRIPT_START =
330+
/^\s*(?:(?:\/\/[^\r\n\u2028\u2029]*(?:[\r\n\u2028\u2029]|$)|\/\*(?:[^*]|\*(?!\/))*\*\/)\s*)*export\s+const\s+meta\b/;
329331

330332
/**
331333
* Whether a user message is the script a provider-native workflow runs. Servers mark every

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.