Skip to content

feat(team): add real-time team chat - #106

Merged
hwangjokim merged 3 commits into
mainfrom
feat/105-real-time-team-chat
Jun 16, 2026
Merged

feat(team): add real-time team chat#106
hwangjokim merged 3 commits into
mainfrom
feat/105-real-time-team-chat

Conversation

@hwangjokim

Copy link
Copy Markdown
Member

Summary

  • Add a signed-in team-space chat panel backed by REST history and STOMP real-time delivery.
  • Add chat API/types/hooks and MSW handlers for mock-mode parity.
  • Document chat transport, API mode behavior, and architecture notes.

Validation

  • pnpm tsc --noEmit: pass
  • pnpm biome lint .: pass
  • pnpm build: pass

Closes #105

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
client Ready Ready Preview, Comment Jun 16, 2026 8:13am

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59b7e4172a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/api/chat.ts
Comment on lines +23 to +24
return apiRequest<ChatMessagePage>(
`/project-groups/${projectGroupId}/chat/messages?${params.toString()}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add chat endpoints to the OpenAPI contract

In real API mode this new request calls /project-groups/{projectGroupId}/chat/messages, but openapi/openapi.yaml is the repo's source of truth and it contains no chat paths at all (I checked the spec for chat//project-groups/{projectGroupId}/chat). That leaves the real-mode chat UI depending on undocumented endpoints/response shapes, so it can drift from or fail against the backend contract until the REST chat history/read endpoints are added to the OpenAPI spec.

Useful? React with 👍 / 👎.

Comment on lines +79 to +82
queryClient.setQueryData<ChatMessagePage>(
chatQueryKeys.messages(projectGroupId),
(current) => appendChatMessagePage(current, chatMessage),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve live messages while history is loading

When a STOMP message arrives before the initial useChatMessagesQuery request has resolved, this writes the live message into the same query key, but the in-flight REST history response can then overwrite the cache with an older page that does not include that just-delivered message. In that race the message disappears from the chat until a later refetch/remount, so the subscription should wait for history or merge the REST result with any cache entries that arrived meanwhile.

Useful? React with 👍 / 👎.

Comment on lines +60 to +64
const client = new Client({
brokerURL: getChatWebSocketUrl(),
connectHeaders: {
Authorization: `Bearer ${session.accessToken}`,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconnect chat with a refreshed access token

This captures the current access token once when creating the STOMP client, unlike apiRequest, which refreshes tokens on 401 and stores the new access token. If a user opens /team with an expired access token but a valid refresh token, the REST chat history/project-group calls can recover while the WebSocket handshake keeps using the stale token (and future STOMP auto-reconnects reuse it too), leaving chat stuck in a connection error until a full remount/reload. Fetch the latest session token before each connect/reconnect or trigger the same refresh path before activating the client.

Useful? React with 👍 / 👎.

@hwangjokim

Copy link
Copy Markdown
Member Author

LGTM Detected! Ready to merge

@hwangjokim
hwangjokim merged commit 8e3f0b4 into main Jun 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add real-time team chat

1 participant