Skip to content

Commit 5641430

Browse files
authored
fix: title not generated if first msg is shell invocation (anomalyco#2451)
1 parent 3cdfc52 commit 5641430

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/opencode/src/session/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,10 @@ export namespace Session {
691691

692692
const lastSummary = msgs.findLast((msg) => msg.info.role === "assistant" && msg.info.summary === true)
693693
if (lastSummary) msgs = msgs.filter((msg) => msg.info.id >= lastSummary.info.id)
694-
695-
if (msgs.filter((m) => m.info.role === "user").length === 1 && !session.parentID && isDefaultTitle(session.title)) {
694+
const numRealUserMsgs = msgs.filter(
695+
(m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic),
696+
).length
697+
if (numRealUserMsgs === 1 && !session.parentID && isDefaultTitle(session.title)) {
696698
const small = (await Provider.getSmallModel(model.providerID)) ?? model
697699
generateText({
698700
maxOutputTokens: small.info.reasoning ? 1024 : 20,

0 commit comments

Comments
 (0)