fix(harness): retain empty prompt ranges · openclaw/openclaw@6084442
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,6 +7,21 @@ afterEach(() => {
|
7 | 7 | }); |
8 | 8 | |
9 | 9 | describe("resolveAgentHarnessBeforePromptBuildResult", () => { |
| 10 | +it("retains an empty prompt range without hooks", async () => { |
| 11 | +const result = await resolveAgentHarnessBeforePromptBuildResult({ |
| 12 | +prompt: "", |
| 13 | +developerInstructions: "base instructions", |
| 14 | +messages: [], |
| 15 | +ctx: {}, |
| 16 | +}); |
| 17 | + |
| 18 | +expect(result).toEqual({ |
| 19 | +prompt: "", |
| 20 | +developerInstructions: "base instructions", |
| 21 | +promptInputRange: { start: 0, end: 0 }, |
| 22 | +}); |
| 23 | +}); |
| 24 | + |
10 | 25 | it("uses precomputed agent-start context without a global hook runner", async () => { |
11 | 26 | const result = await resolveAgentHarnessBeforePromptBuildResult({ |
12 | 27 | prompt: "hello", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ export async function resolveAgentHarnessBeforePromptBuildResult(params: {
|
43 | 43 | return { |
44 | 44 | prompt: params.prompt, |
45 | 45 | developerInstructions: params.developerInstructions, |
46 | | -...(params.prompt ? { promptInputRange: { start: 0, end: params.prompt.length } } : {}), |
| 46 | +promptInputRange: { start: 0, end: params.prompt.length }, |
47 | 47 | }; |
48 | 48 | } |
49 | 49 | const hookCtx = buildAgentHookContext(params.ctx); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。