diff options
| author | Aiden Cline <[email protected]> | 2025-11-28 09:55:22 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-28 11:55:22 -0600 |
| commit | 17e8322c2971e8f2fb7f0e16c2e9e57a1103c515 (patch) | |
| tree | 8d83354eada7b6e2a8de5c8e8657863074b4716c | |
| parent | 96eda740cd1b47b90eb75e7b2f708523e6530e1a (diff) | |
| download | opencode-17e8322c2971e8f2fb7f0e16c2e9e57a1103c515.tar.gz opencode-17e8322c2971e8f2fb7f0e16c2e9e57a1103c515.zip | |
fix: title gen when first msg(s) are shell invocations (#4874)
Co-authored-by: GitHub Action <[email protected]>
| -rw-r--r-- | packages/opencode/src/session/prompt.ts | 3 | ||||
| -rw-r--r-- | packages/opencode/src/session/prompt/title.txt | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 9152fc99b..6b2f74c45 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -283,7 +283,7 @@ export namespace SessionPrompt { session: await Session.get(sessionID), modelID: lastUser.model.modelID, providerID: lastUser.model.providerID, - message: msgs.find((m) => m.info.role === "user")!, + message: msgs.find((m) => m.info.role === "user" && !m.parts.every((p) => "synthetic" in p && p.synthetic))!, history: msgs, }) @@ -1466,6 +1466,7 @@ export namespace SessionPrompt { content: "Generate a title for this conversation:\n", }, ...MessageV2.toModelMessage([ + ...input.history, { info: { id: Identifier.ascending("message"), diff --git a/packages/opencode/src/session/prompt/title.txt b/packages/opencode/src/session/prompt/title.txt index e297dc460..3bc04f290 100644 --- a/packages/opencode/src/session/prompt/title.txt +++ b/packages/opencode/src/session/prompt/title.txt @@ -22,8 +22,9 @@ Your output must be: - The title should NEVER include "summarizing" or "generating" when generating a title - DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT - Always output something meaningful, even if the input is minimal. -- If the user message is short or conversational (e.g. “hello”, “lol”, “whats up”, “hey”): - → create a title that reflects the user’s tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.) +- Ignore tool execution messages ("Called the Read tool...", "The following tool was executed..."). Instead, focus on what the user wants to do with the context. +- If the user message is short or conversational (e.g. "hello", "lol", "whats up", "hey"): + → create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.) </rules> <examples> |
