From e8765abac63d3882537630cbb0d15b9964161be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Tue, 28 Apr 2026 13:03:31 +0000 Subject: [PATCH] fix: pass nerveRoot to tester prompts for correct path resolution Hermes agent cwd is not necessarily the nerve workspace root. Inject nerveRoot into tester prompts so all file paths and commands use absolute paths to the workspace directory. --- workflows/sense-generator/build.ts | 2 +- workflows/sense-generator/roles/tester/index.ts | 5 +++-- workflows/sense-generator/roles/tester/prompt.ts | 8 +++++--- workflows/workflow-generator/build.ts | 2 +- workflows/workflow-generator/roles/tester/index.ts | 5 +++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/workflows/sense-generator/build.ts b/workflows/sense-generator/build.ts index ddc6372..4754db0 100644 --- a/workflows/sense-generator/build.ts +++ b/workflows/sense-generator/build.ts @@ -21,7 +21,7 @@ export function buildSenseGenerator({ roles: { planner: buildPlannerRole({ provider, cwd }), coder: buildCoderRole({ provider, cwd }), - tester: buildTesterRole({ provider }), + tester: buildTesterRole({ provider, nerveRoot: cwd }), committer: buildCommitterRole({ nerveRoot: cwd }), }, moderator, diff --git a/workflows/sense-generator/roles/tester/index.ts b/workflows/sense-generator/roles/tester/index.ts index 0f54edb..2519b93 100644 --- a/workflows/sense-generator/roles/tester/index.ts +++ b/workflows/sense-generator/roles/tester/index.ts @@ -10,11 +10,12 @@ export type TesterMeta = z.infer; export type BuildTesterDeps = { provider: LlmProvider; + nerveRoot: string; }; -export function buildTesterRole({ provider }: BuildTesterDeps) { +export function buildTesterRole({ provider, nerveRoot }: BuildTesterDeps) { return createHermesRole({ - prompt: async (threadId) => testerPrompt({ threadId }), + prompt: async (threadId) => testerPrompt({ threadId, nerveRoot }), extract: { provider, schema: testerMetaSchema }, }); } diff --git a/workflows/sense-generator/roles/tester/prompt.ts b/workflows/sense-generator/roles/tester/prompt.ts index b09365b..e4255de 100644 --- a/workflows/sense-generator/roles/tester/prompt.ts +++ b/workflows/sense-generator/roles/tester/prompt.ts @@ -1,8 +1,10 @@ -export function testerPrompt({ threadId }: { threadId: string }): string { +export function testerPrompt({ threadId, nerveRoot }: { threadId: string; nerveRoot: string }): string { return `You are testing a newly created Nerve sense end-to-end. +**IMPORTANT: The Nerve workspace is at \`${nerveRoot}\`. All paths below are relative to this directory. Always \`cd ${nerveRoot}\` first.** + Read the workflow thread for context: \`nerve thread ${threadId}\` -Read the nerve-dev skill for expected file structure: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\` +Read the nerve-dev skill for expected file structure: \`cat ${nerveRoot}/node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\` Verify the full lifecycle in this order: @@ -14,7 +16,7 @@ Verify the full lifecycle in this order: 2. **Build** — run inside the sense directory: \`\`\` - cd senses/ && pnpm install --no-cache && pnpm build + cd ${nerveRoot}/senses/ && pnpm install --no-cache && pnpm build \`\`\` Must produce \`index.js\` at sense root without errors. diff --git a/workflows/workflow-generator/build.ts b/workflows/workflow-generator/build.ts index ee9cf36..b96b6c1 100644 --- a/workflows/workflow-generator/build.ts +++ b/workflows/workflow-generator/build.ts @@ -22,7 +22,7 @@ export function buildWorkflowGenerator({ roles: { planner: buildPlannerRole({ provider, cwd: nerveRoot }), coder: buildCoderRole({ provider, cwd: nerveRoot }), - tester: buildTesterRole({ provider }), + tester: buildTesterRole({ provider, nerveRoot }), committer: buildCommitterRole({ nerveRoot }), }, moderator, diff --git a/workflows/workflow-generator/roles/tester/index.ts b/workflows/workflow-generator/roles/tester/index.ts index 38b5741..52117b6 100644 --- a/workflows/workflow-generator/roles/tester/index.ts +++ b/workflows/workflow-generator/roles/tester/index.ts @@ -10,11 +10,12 @@ export type TesterMeta = z.infer; export type BuildTesterDeps = { provider: LlmProvider; + nerveRoot: string; }; -export function buildTesterRole({ provider }: BuildTesterDeps) { +export function buildTesterRole({ provider, nerveRoot }: BuildTesterDeps) { return createHermesRole({ - prompt: async (threadId) => testerPrompt({ threadId }), + prompt: async (threadId) => testerPrompt({ threadId, nerveRoot }), extract: { provider, schema: testerMetaSchema }, }); }