diff --git a/lib/harness-register.ts b/lib/harness-register.ts index 99c7c99f9..8744f0977 100644 --- a/lib/harness-register.ts +++ b/lib/harness-register.ts @@ -546,7 +546,7 @@ function hookPlan(opts: RegisterOptions, dest: string, prev: Ledger | null): Hoo if (!choice.on) return off(plan); const requested = !opts.inherit; const foreign = t.name === 'openclaw' ? foreignOpenclawConfig(opts.env, profile) : ''; - const [why, fix] = dest !== profileSkills(t.name, profile) ? ['this registration uses another skills folder (' + dest + ')', HARNESS_CODES.HARNESS_HOOK_UNSUPPORTED.fix] + const [why, fix] = dest !== profileSkills(t.name, profile) ? ['this registration uses another skills folder (' + dest + ')', 'register without --skills-dir to get the hook, or pass --no-start-hook to keep this registration without it'] : foreign ? ['OPENCLAW_CONFIG_PATH points OpenClaw at ' + foreign + ', outside that profile', 'unset OPENCLAW_CONFIG_PATH or set it to ' + hookConfig('openclaw', profile) + ', then register again'] : ['', '']; if (why && (plan.explicit || !prevOn)) { if (plan.explicit) throw new HarnessError('HARNESS_HOOK_UNSUPPORTED', 'the start hook goes into the ' + t.displayName + ' profile ' + profile + ', and ' + why); diff --git a/test/harness-start-hook.test.ts b/test/harness-start-hook.test.ts index 0f0c751b4..cbc85faf3 100644 --- a/test/harness-start-hook.test.ts +++ b/test/harness-start-hook.test.ts @@ -528,6 +528,10 @@ describe('start hook: HARN-18 smoke defects (GST-778)', () => { expect(fs.existsSync(path.join(r.profile, 'extensions'))).toBe(false); expect(readLedger(res.ledger)!.meta.start_hook).toBe('off'); expect(fs.readFileSync(r.config, 'utf8')).toBe(HEALTHY.openclaw); + const custom = register({ ...r.o({ skillsDir: path.join(r.d, 'custom', 'skills') }), env: { ...r.env, GSTACK_HARNESS_START_HOOK: '1' } }); + expect(custom.hook).toMatchObject({ state: 'off', required: true }); + expect(custom.hook?.fix).toContain('--no-start-hook'); + expect(register({ ...r.o({ skillsDir: path.join(r.d, 'custom', 'skills'), startHook: false }), env: { ...r.env, GSTACK_HARNESS_START_HOOK: '1' } }).hook).toEqual({ state: 'off' }); }, 120_000); test('a fresh harness with no config: turning the hook on creates no config, runs no harness command, and fails with the setup to run first', () => {