From e16b7be70b37db2e2146b216320db9c3c35e49fa Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:44:08 +0800 Subject: [PATCH] fix(inbox): read workspace ID from request context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the slug-first URL refactor, the frontend sends X-Workspace-Slug and the workspace middleware resolves it into a UUID stored in the request context. The inbox handlers still read X-Workspace-ID directly from the request header, which is now absent, so every inbox query ran with an empty workspace_id and returned zero rows. Switch all six inbox handlers to ctxWorkspaceID(r.Context()), matching the pattern already used by chat / issue / project / autopilot. No frontend changes required — the slug header path was already correct. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/internal/handler/inbox.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/internal/handler/inbox.go b/server/internal/handler/inbox.go index 3dc0d20ac..1888ca940 100644 --- a/server/internal/handler/inbox.go +++ b/server/internal/handler/inbox.go @@ -90,7 +90,7 @@ func (h *Handler) ListInbox(w http.ResponseWriter, r *http.Request) { if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) items, err := h.Queries.ListInboxItems(r.Context(), db.ListInboxItemsParams{ WorkspaceID: parseUUID(workspaceID), @@ -170,7 +170,7 @@ func (h *Handler) CountUnreadInbox(w http.ResponseWriter, r *http.Request) { if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) count, err := h.Queries.CountUnreadInbox(r.Context(), db.CountUnreadInboxParams{ WorkspaceID: parseUUID(workspaceID), @@ -190,7 +190,7 @@ func (h *Handler) MarkAllInboxRead(w http.ResponseWriter, r *http.Request) { if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) count, err := h.Queries.MarkAllInboxRead(r.Context(), db.MarkAllInboxReadParams{ WorkspaceID: parseUUID(workspaceID), @@ -215,7 +215,7 @@ func (h *Handler) ArchiveAllInbox(w http.ResponseWriter, r *http.Request) { if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) count, err := h.Queries.ArchiveAllInbox(r.Context(), db.ArchiveAllInboxParams{ WorkspaceID: parseUUID(workspaceID), @@ -240,7 +240,7 @@ func (h *Handler) ArchiveAllReadInbox(w http.ResponseWriter, r *http.Request) { if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) count, err := h.Queries.ArchiveAllReadInbox(r.Context(), db.ArchiveAllReadInboxParams{ WorkspaceID: parseUUID(workspaceID), @@ -265,7 +265,7 @@ func (h *Handler) ArchiveCompletedInbox(w http.ResponseWriter, r *http.Request) if !ok { return } - workspaceID := r.Header.Get("X-Workspace-ID") + workspaceID := ctxWorkspaceID(r.Context()) count, err := h.Queries.ArchiveCompletedInbox(r.Context(), db.ArchiveCompletedInboxParams{ WorkspaceID: parseUUID(workspaceID),