Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ui): read a stored chat topic defensively
Bernhard Jackiewicz3d214f539a5e
diff --git a/graph-ui/src/browser-ai/chat-context.test.ts b/graph-ui/src/browser-ai/chat-context.test.tsindex b47437e28..d20b72bb5 100644--- a/graph-ui/src/browser-ai/chat-context.test.ts+++ b/graph-ui/src/browser-ai/chat-context.test.ts@@ -50,5 +50,6 @@ describe('what a question is about', () => {expect(followedTopic([turn(attached)], 'p:explore')).toBeUndefined();expect(followedTopic([turn(attached), turn(selected)], 'p:galaxy')).toBeUndefined();expect(followedTopic([], 'p:galaxy')).toBeUndefined();+ expect(followedTopic([turn({ key: '{damaged', label: 'x', kind: 'attachment' })], 'p:galaxy')).toBeUndefined();});});diff --git a/graph-ui/src/browser-ai/chat-context.ts b/graph-ui/src/browser-ai/chat-context.tsindex 44b88b521..ee5e3c634 100644--- a/graph-ui/src/browser-ai/chat-context.ts+++ b/graph-ui/src/browser-ai/chat-context.ts@@ -27,7 +27,9 @@ export function followedTopic(turns: readonly BrowserChatTurn[], scope: string):for (let index = turns.length - 1; index >= 0; index--) {const topic = turns[index].topic;if (!topic || turns[index].answeredFrom === 'local') continue;- const [turnScope] = JSON.parse(topic.key) as [string];+ // Stored history is data: a damaged key ends the follow-up instead of the send.+ let turnScope: unknown;+ try { [turnScope] = JSON.parse(topic.key) as unknown[]; } catch { return undefined; }return turnScope === scope && (topic.kind === 'attachment' || topic.kind === 'context') ? topic : undefined;}return undefined;