Skip to content

The open source coding agent.

TypeScript

fix: strip thinking blocks from title (#1325)

Aiden Clinead8a4bc74475
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 86e3e15b7ad..0884c658bf3 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -640,7 +640,9 @@ export namespace Session {
.then((result) => {
if (result.text)
return Session.update(input.sessionID, (draft) => {
- draft.title = result.text
+ const cleaned = result.text.replace(/<think>[\s\S]*?<\/think>\s*/g, "")
+ const title = cleaned.length > 100 ? cleaned.substring(0, 97) + "..." : cleaned
+ draft.title = title
})
})
.catch(() => {})