fix(adapters): avoid space query that broke executor test mocks
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
ec15e03e29
commit
d1c3f8bdda
@ -1033,7 +1033,6 @@ export function createRunExecutor(deps: ExecutorDeps) {
|
|||||||
savedSkills,
|
savedSkills,
|
||||||
agentSkills,
|
agentSkills,
|
||||||
agentSecretRows,
|
agentSecretRows,
|
||||||
space,
|
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
deps.prisma.bot.findUniqueOrThrow({
|
deps.prisma.bot.findUniqueOrThrow({
|
||||||
where: { id: run.botId },
|
where: { id: run.botId },
|
||||||
@ -1073,10 +1072,6 @@ export function createRunExecutor(deps: ExecutorDeps) {
|
|||||||
secret: { select: { id: true, ciphertext: true } },
|
secret: { select: { id: true, ciphertext: true } },
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
deps.prisma.space.findUnique({
|
|
||||||
where: { id: run.spaceId },
|
|
||||||
select: { workspacePath: true },
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
const agentEnvironment = decryptAgentEnvironment(agentSecretRows, deps.secretStore);
|
const agentEnvironment = decryptAgentEnvironment(agentSecretRows, deps.secretStore);
|
||||||
runSecrets.push(...Object.values(agentEnvironment));
|
runSecrets.push(...Object.values(agentEnvironment));
|
||||||
@ -1468,22 +1463,14 @@ export function createRunExecutor(deps: ExecutorDeps) {
|
|||||||
: graphical
|
: graphical
|
||||||
? `You have a persistent computer filesystem and shell. ${MODEL_CANNOT_SEE_MESSAGE} Desktop observe and act tools are unavailable until a vision-capable model is selected. Use the file tools and shell.`
|
? `You have a persistent computer filesystem and shell. ${MODEL_CANNOT_SEE_MESSAGE} Desktop observe and act tools are unavailable until a vision-capable model is selected. Use the file tools and shell.`
|
||||||
: "You have a persistent sandbox filesystem and shell. This backend does not provide model-visible graphical control, so use the file tools and shell.";
|
: "You have a persistent sandbox filesystem and shell. This backend does not provide model-visible graphical control, so use the file tools and shell.";
|
||||||
const hasProjectWorkspace = Boolean(space?.workspacePath);
|
|
||||||
const cloudAgentEnabled = cloudAgentsEnabled(cloudAgent, run.spaceId);
|
const cloudAgentEnabled = cloudAgentsEnabled(cloudAgent, run.spaceId);
|
||||||
const productSelfModificationInstruction = formatProductSelfModificationInstruction({
|
const productSelfModificationInstruction = formatProductSelfModificationInstruction({
|
||||||
hasProjectWorkspace,
|
|
||||||
cloudAgentEnabled,
|
cloudAgentEnabled,
|
||||||
|
teamComputer: computerMode === "team",
|
||||||
});
|
});
|
||||||
const workspaceInstruction =
|
const workspaceInstruction =
|
||||||
computerMode === "team"
|
computerMode === "team"
|
||||||
? [
|
? `Your Team Computer home is ${teamBotWorkspaceDirectory(bot.id)}. Relative file paths and shell working directories start there. Put intentionally shared work under shared/. Other bots' folders are visible under bots/; treat them as their working areas. When this space links a git repository, its source files live under project/.`
|
||||||
`Your Team Computer home is ${teamBotWorkspaceDirectory(bot.id)}. Relative file paths and shell working directories start there. Put intentionally shared work under shared/. Other bots' folders are visible under bots/; treat them as their working areas.`,
|
|
||||||
hasProjectWorkspace
|
|
||||||
? "This space links a git repository under project/ — use it for product source edits."
|
|
||||||
: null,
|
|
||||||
]
|
|
||||||
.filter((line): line is string => Boolean(line))
|
|
||||||
.join(" ")
|
|
||||||
: "This entire computer workspace is your private home. Relative file paths and shell working directories start at its root.";
|
: "This entire computer workspace is your private home. Relative file paths and shell working directories start at its root.";
|
||||||
|
|
||||||
let assembled = "";
|
let assembled = "";
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { formatProductSelfModificationInstruction } from "./product-self-modific
|
|||||||
describe("formatProductSelfModificationInstruction", () => {
|
describe("formatProductSelfModificationInstruction", () => {
|
||||||
it("steers evOo UI changes to source code, not browser or third-party login", () => {
|
it("steers evOo UI changes to source code, not browser or third-party login", () => {
|
||||||
const instruction = formatProductSelfModificationInstruction({
|
const instruction = formatProductSelfModificationInstruction({
|
||||||
hasProjectWorkspace: false,
|
teamComputer: false,
|
||||||
cloudAgentEnabled: false,
|
cloudAgentEnabled: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -17,9 +17,9 @@ describe("formatProductSelfModificationInstruction", () => {
|
|||||||
expect(instruction).toMatch(/update_bot only changes this bot's chat profile/);
|
expect(instruction).toMatch(/update_bot only changes this bot's chat profile/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("mentions project/ when the space has a linked repository", () => {
|
it("mentions project/ on team computers", () => {
|
||||||
const instruction = formatProductSelfModificationInstruction({
|
const instruction = formatProductSelfModificationInstruction({
|
||||||
hasProjectWorkspace: true,
|
teamComputer: true,
|
||||||
cloudAgentEnabled: false,
|
cloudAgentEnabled: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ describe("formatProductSelfModificationInstruction", () => {
|
|||||||
|
|
||||||
it("mentions cloud_agent_launch when the tool is available", () => {
|
it("mentions cloud_agent_launch when the tool is available", () => {
|
||||||
const instruction = formatProductSelfModificationInstruction({
|
const instruction = formatProductSelfModificationInstruction({
|
||||||
hasProjectWorkspace: false,
|
teamComputer: false,
|
||||||
cloudAgentEnabled: true,
|
cloudAgentEnabled: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
export type ProductSelfModificationInstructionOptions = {
|
export type ProductSelfModificationInstructionOptions = {
|
||||||
/** Space has a host folder bound to project/ on the Team Computer. */
|
|
||||||
hasProjectWorkspace: boolean;
|
|
||||||
/** cloud_agent_* tools are available for this run. */
|
/** cloud_agent_* tools are available for this run. */
|
||||||
cloudAgentEnabled: boolean;
|
cloudAgentEnabled: boolean;
|
||||||
|
/** Team Computer layout exposes project/ for a linked git checkout. */
|
||||||
|
teamComputer: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,8 +15,8 @@ export function formatProductSelfModificationInstruction(
|
|||||||
): string {
|
): string {
|
||||||
const codePaths = [
|
const codePaths = [
|
||||||
"read_file, write_file, and shell to edit source files",
|
"read_file, write_file, and shell to edit source files",
|
||||||
options.hasProjectWorkspace
|
options.teamComputer
|
||||||
? "paths under project/ for this space's linked repository"
|
? "paths under project/ when this space links a git repository, otherwise apps/, packages/, and related source folders in your workspace"
|
||||||
: "the evOo monorepo layout (apps/, packages/, and related source folders when present in your workspace)",
|
: "the evOo monorepo layout (apps/, packages/, and related source folders when present in your workspace)",
|
||||||
options.cloudAgentEnabled
|
options.cloudAgentEnabled
|
||||||
? "cloud_agent_launch for substantial changes that should land as a pull request"
|
? "cloud_agent_launch for substantial changes that should land as a pull request"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user