Skip to content

Commit 6481c9a

Browse files
fix(opencode): keep build reminder plan info
1 parent d772cc3 commit 6481c9a

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

packages/opencode/src/session/reminders.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ function planState(session: Session.Info, fsys: FSUtil.Interface) {
107107
planReminder: exists
108108
? `A plan file already exists at ${filepath}. You can read it and make incremental edits using the edit tool.`
109109
: `No plan file exists yet. You should create your plan at ${filepath} using the write tool.`,
110-
buildSwitch: exists ? `A plan file exists at ${filepath}. You should execute on the plan defined within it` : "",
110+
buildSwitch: exists
111+
? `A plan file exists at ${filepath}. You should execute on the plan defined within it`
112+
: `No plan file exists yet. There is no saved plan to execute from.`,
111113
}
112114
})
113115
}

packages/opencode/test/session/reminders.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,27 @@ describe("SessionReminders", () => {
8686
}),
8787
{ git: true },
8888
)
89+
90+
it.instance("includes no-plan guidance in custom build switch reminders", () =>
91+
Effect.gen(function* () {
92+
const test = yield* TestInstance
93+
const session = sessionInfo(test.directory)
94+
95+
const result = yield* SessionReminders.apply({
96+
messages: [userMessage(session.id), assistantMessage(session.id, "plan")],
97+
agent: buildAgent({ buildSwitchReminder: "Custom build reminder\n${planInfo}" }),
98+
session,
99+
}).pipe(Effect.provide(RuntimeFlags.layer({ experimentalPlanMode: true })))
100+
101+
expect(textPart(result)).toBe(
102+
[
103+
"Custom build reminder",
104+
"No plan file exists yet. There is no saved plan to execute from.",
105+
].join("\n"),
106+
)
107+
}),
108+
{ git: true },
109+
)
89110
})
90111

91112
function sessionInfo(directory: string): Session.Info {

0 commit comments

Comments
 (0)