-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: associate threads with projects #8745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
55261af
76f1c12
da64a30
2b93a8e
787d3dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import { | |
| upsertSessionMetadataOverlayRecord, | ||
| type SessionMetadataOverlayRecord, | ||
| } from "@/features/chat/lib/sessionMetadataOverlay"; | ||
| import { updateSessionProject } from "@/shared/api/acpApi"; | ||
|
|
||
| export interface ChatSession { | ||
| id: string; | ||
|
|
@@ -114,8 +115,8 @@ function buildOverlayRecord( | |
| ): SessionMetadataOverlayRecord { | ||
| return { | ||
| sessionId: overlayKeyForSession(session), | ||
| projectId: session.projectId ?? null, | ||
| userSetTitle: session.userSetName ? session.title : null, | ||
| projectId: session.projectId ?? null, | ||
| providerId: session.providerId ?? null, | ||
| personaId: session.personaId ?? null, | ||
| modelId: session.modelId ?? null, | ||
|
|
@@ -139,7 +140,7 @@ function overlayToFallbackSession( | |
| id: overlay.sessionId, | ||
| acpSessionId: overlay.sessionId, | ||
| title: overlay.userSetTitle ?? overlay.lastKnownTitle ?? "Untitled", | ||
| projectId: overlay.projectId, | ||
| projectId: overlay.projectId ?? undefined, | ||
| agentId: overlay.agentId ?? undefined, | ||
| providerId: overlay.providerId ?? undefined, | ||
| personaId: overlay.personaId ?? undefined, | ||
|
|
@@ -166,7 +167,7 @@ function mergeAcpSessionWithOverlay( | |
| session.title ?? | ||
| overlay?.lastKnownTitle ?? | ||
| "Untitled", | ||
| projectId: overlay?.projectId, | ||
| projectId: session.projectId ?? undefined, | ||
| agentId: overlay?.agentId ?? undefined, | ||
| providerId: overlay?.providerId ?? undefined, | ||
| personaId: overlay?.personaId ?? undefined, | ||
|
|
@@ -239,6 +240,7 @@ export const useChatSessionStore = create<ChatSessionStore>((set, get) => ({ | |
| const { sessionId } = await acpCreateSession(providerId, opts.workingDir, { | ||
| personaId: opts.personaId, | ||
| modelId: opts.modelId, | ||
| projectId: opts.projectId, | ||
| }); | ||
| const chatSession: ChatSession = { | ||
| id: sessionId, | ||
|
|
@@ -318,7 +320,15 @@ export const useChatSessionStore = create<ChatSessionStore>((set, get) => ({ | |
| buildOverlayRecord(updatedSession, existing), | ||
| ); | ||
| } | ||
| // TODO: wire session updates to ACP when supported | ||
|
|
||
| // Persist projectId change to ACP backend | ||
| const acpSessionId = updatedSession?.acpSessionId; | ||
| if ("projectId" in patch && acpSessionId) { | ||
| updateSessionProject(acpSessionId, patch.projectId ?? null).catch( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| (err: unknown) => | ||
| console.error("Failed to update session project in backend:", err), | ||
| ); | ||
|
Comment on lines
+326
to
+330
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
| }, | ||
|
|
||
| addSession: (session) => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
listSessionsreturns a session without_meta.projectId(which is common for older threads),mergeAcpSessionWithOverlaynow forcesprojectIdtosession.projectId ?? undefinedinstead of reusing the cached overlay value. In that case the project association disappears in UI, andsyncOverlaySnapshotsimmediately persistsnull, permanently erasing the previously storedprojectIdfrom local overlay data. This regresses migration behavior for existing sessions that only have project linkage in overlay storage.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected