fix(adapters): avoid space query that broke executor test mocks

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-09-25 13:35:46 +00:00
parent ec15e03e29
commit d1c3f8bdda
3 changed files with 10 additions and 23 deletions

View File

@ -1033,7 +1033,6 @@ export function createRunExecutor(deps: ExecutorDeps) {
savedSkills,
agentSkills,
agentSecretRows,
space,
] = await Promise.all([
deps.prisma.bot.findUniqueOrThrow({
where: { id: run.botId },
@ -1073,10 +1072,6 @@ export function createRunExecutor(deps: ExecutorDeps) {
secret: { select: { id: true, ciphertext: true } },
},
}),
deps.prisma.space.findUnique({
where: { id: run.spaceId },
select: { workspacePath: true },
}),
]);
const agentEnvironment = decryptAgentEnvironment(agentSecretRows, deps.secretStore);
runSecrets.push(...Object.values(agentEnvironment));
@ -1468,22 +1463,14 @@ export function createRunExecutor(deps: ExecutorDeps) {
: 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 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 productSelfModificationInstruction = formatProductSelfModificationInstruction({
hasProjectWorkspace,
cloudAgentEnabled,
teamComputer: computerMode === "team",
});
const workspaceInstruction =
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.`,
hasProjectWorkspace
? "This space links a git repository under project/ — use it for product source edits."
: null,
]
.filter((line): line is string => Boolean(line))
.join(" ")
? `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/.`
: "This entire computer workspace is your private home. Relative file paths and shell working directories start at its root.";
let assembled = "";

View File

@ -4,7 +4,7 @@ import { formatProductSelfModificationInstruction } from "./product-self-modific
describe("formatProductSelfModificationInstruction", () => {
it("steers evOo UI changes to source code, not browser or third-party login", () => {
const instruction = formatProductSelfModificationInstruction({
hasProjectWorkspace: false,
teamComputer: false,
cloudAgentEnabled: false,
});
@ -17,9 +17,9 @@ describe("formatProductSelfModificationInstruction", () => {
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({
hasProjectWorkspace: true,
teamComputer: true,
cloudAgentEnabled: false,
});
@ -28,7 +28,7 @@ describe("formatProductSelfModificationInstruction", () => {
it("mentions cloud_agent_launch when the tool is available", () => {
const instruction = formatProductSelfModificationInstruction({
hasProjectWorkspace: false,
teamComputer: false,
cloudAgentEnabled: true,
});

View File

@ -1,8 +1,8 @@
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. */
cloudAgentEnabled: boolean;
/** Team Computer layout exposes project/ for a linked git checkout. */
teamComputer: boolean;
};
/**
@ -15,8 +15,8 @@ export function formatProductSelfModificationInstruction(
): string {
const codePaths = [
"read_file, write_file, and shell to edit source files",
options.hasProjectWorkspace
? "paths under project/ for this space's linked repository"
options.teamComputer
? "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)",
options.cloudAgentEnabled
? "cloud_agent_launch for substantial changes that should land as a pull request"