Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes, pass 2 (#7630)

garrytan578193ed3fa3
diff --git a/src/core/persistence/terminal-classify.ts b/src/core/persistence/terminal-classify.ts
index d629a5c398..6c8d6c7593 100644
--- a/src/core/persistence/terminal-classify.ts
+++ b/src/core/persistence/terminal-classify.ts
@@ -346,7 +346,7 @@ function faultAction(code: string, input: TerminalInput): Action {
const v = classifySyncFault({ code });
if (v.safe_actions[0] === 'retry' && input.operation !== 'submit_job') {
return inspect(input.source_id, `The ${input.operation} write ended ${code}; it was not part of a sync, so a sync does not retry it. `
- + `Writer status names the step it stopped at and what held it, read-only. Once that clears, resubmit the same ${input.operation} with a new request_id.`);
+ + `Writer status names the step it stopped at and what held it, read-only. Once that clears, resubmit the same ${input.operation} with a new request_id (for a page an import or repair wrote, rerun that command).`);
}
if (v.safe_actions[0] === 'retry') return syncRetry(input.source_id, `The sync recorded ${code} (${v.class}); a rerun holds or retries it.`);
return inspect(input.source_id, `The write ended ${code}; writer status names what holds it, read-only.`, v.human_reason);
diff --git a/src/core/sources-load.ts b/src/core/sources-load.ts
index 66a167ae00..5e4675e35c 100644
--- a/src/core/sources-load.ts
+++ b/src/core/sources-load.ts
@@ -191,8 +191,8 @@ export function relativeSourceLocalPathSkipWarning(sourceId: string, localPath:
if (isAbsolute(localPath)) return null;
return (
`[autopilot] skipping source '${sourceId}': relative local_path ` +
- `'${localPath}' cannot be resolved from a daemon. Re-register with an ` +
- `absolute --path or run 'gbrain sync --source ${sourceId}' once to self-heal.`
+ `'${localPath}' cannot be resolved from a daemon. Point it at its checkout ` +
+ `with 'gbrain sources set-path ${sourceId} <absolute-directory>' (#7630: sync refuses a relative path).`
);
}
diff --git a/test/sync-relative-anchor-refusal-7630.test.ts b/test/sync-relative-anchor-refusal-7630.test.ts
index 1d3d2953a7..3f7c7e0e38 100644
--- a/test/sync-relative-anchor-refusal-7630.test.ts
+++ b/test/sync-relative-anchor-refusal-7630.test.ts
@@ -293,6 +293,28 @@ for (const backend of testBackends()) {
});
expect(existsSync(join(folder, '.git'))).toBe(false);
}, 120_000);
+
+ test('dream and the autopilot cycle run no filesystem phase against the cwd for a relative local_path or sync.repo_path', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ await engine.setConfig('sync.repo_path', '.');
+ await withEnv({ GBRAIN_HOME: home, GBRAIN_SOURCE: undefined }, async () => {
+ const { runDream } = await import('../src/commands/dream.ts');
+ const scoped = await runDream(engine, ['--source', 'default', '--phase', 'lint', '--json']) as { brain_dir: string | null };
+ expect(scoped.brain_dir).toBeNull();
+ const unscoped = await runDream(engine, ['--phase', 'lint', '--json']) as { brain_dir: string | null };
+ expect(unscoped.brain_dir).toBeNull();
+
+ const { registerBuiltinHandlers } = await import('../src/commands/jobs.ts');
+ const handlers = new Map<string, (job: unknown) => Promise<{ report: { brain_dir: string | null } }>>();
+ await registerBuiltinHandlers({ register(name: string, fn: never) { handlers.set(name, fn); } } as never, engine);
+ const cycle = handlers.get('autopilot-cycle')!;
+ expect((await cycle({ data: { source_id: 'default', phases: ['recompute_emotional_weight'] }, signal: undefined })).report.brain_dir).toBeNull();
+ expect((await cycle({ data: { phases: ['recompute_emotional_weight'] }, signal: undefined })).report.brain_dir).toBeNull();
+ expect((await cycle({ data: { repoPath: '.', phases: ['recompute_emotional_weight'] }, signal: undefined })).report.brain_dir).toBeNull();
+ });
+ expect(existsSync(join(folder, '.git'))).toBe(false);
+ expect(await pageCount()).toBe(0);
+ }, 120_000);
});
}