Log workspace warnings to stdout
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
|||||||
import type { agents } from "@paperclipai/db";
|
import type { agents } from "@paperclipai/db";
|
||||||
import { resolveDefaultAgentWorkspaceDir } from "../home-paths.js";
|
import { resolveDefaultAgentWorkspaceDir } from "../home-paths.js";
|
||||||
import {
|
import {
|
||||||
|
formatRuntimeWorkspaceWarningLog,
|
||||||
prioritizeProjectWorkspaceCandidatesForRun,
|
prioritizeProjectWorkspaceCandidatesForRun,
|
||||||
parseSessionCompactionPolicy,
|
parseSessionCompactionPolicy,
|
||||||
resolveRuntimeSessionParamsForWorkspace,
|
resolveRuntimeSessionParamsForWorkspace,
|
||||||
@@ -181,6 +182,15 @@ describe("shouldResetTaskSessionForWake", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("formatRuntimeWorkspaceWarningLog", () => {
|
||||||
|
it("emits informational workspace warnings on stdout", () => {
|
||||||
|
expect(formatRuntimeWorkspaceWarningLog("Using fallback workspace")).toEqual({
|
||||||
|
stream: "stdout",
|
||||||
|
chunk: "[paperclip] Using fallback workspace\n",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("prioritizeProjectWorkspaceCandidatesForRun", () => {
|
describe("prioritizeProjectWorkspaceCandidatesForRun", () => {
|
||||||
it("moves the explicitly selected workspace to the front", () => {
|
it("moves the explicitly selected workspace to the front", () => {
|
||||||
const rows = [
|
const rows = [
|
||||||
|
|||||||
@@ -497,6 +497,13 @@ export function shouldResetTaskSessionForWake(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatRuntimeWorkspaceWarningLog(warning: string) {
|
||||||
|
return {
|
||||||
|
stream: "stdout" as const,
|
||||||
|
chunk: `[paperclip] ${warning}\n`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function describeSessionResetReason(
|
function describeSessionResetReason(
|
||||||
contextSnapshot: Record<string, unknown> | null | undefined,
|
contextSnapshot: Record<string, unknown> | null | undefined,
|
||||||
) {
|
) {
|
||||||
@@ -2055,7 +2062,8 @@ export function heartbeatService(db: Db) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
for (const warning of runtimeWorkspaceWarnings) {
|
for (const warning of runtimeWorkspaceWarnings) {
|
||||||
await onLog("stderr", `[paperclip] ${warning}\n`);
|
const logEntry = formatRuntimeWorkspaceWarningLog(warning);
|
||||||
|
await onLog(logEntry.stream, logEntry.chunk);
|
||||||
}
|
}
|
||||||
const adapterEnv = Object.fromEntries(
|
const adapterEnv = Object.fromEntries(
|
||||||
Object.entries(parseObject(resolvedConfig.env)).filter(
|
Object.entries(parseObject(resolvedConfig.env)).filter(
|
||||||
|
|||||||
Reference in New Issue
Block a user