Skip to content

refactor: remove dead WebSocket history handlers#16207

Merged
vincent0426 merged 2 commits into
mainfrom
vincent/remove-session-history-dead-code
Mar 13, 2026
Merged

refactor: remove dead WebSocket history handlers#16207
vincent0426 merged 2 commits into
mainfrom
vincent/remove-session-history-dead-code

Conversation

@vincent0426
Copy link
Copy Markdown
Contributor

@vincent0426 vincent0426 commented Mar 13, 2026

Summary

  • Remove 4 dead functions from assistant/src/daemon/handlers/session-history.ts: handleHistoryRequest, handleConversationSearch, handleMessageContentRequest, and lightModeSurfaceData
  • These WebSocket handlers are never imported or called anywhere — the macOS app uses HTTP endpoints that call the shared business logic directly
  • Clean up 13 imports that became unused after removal (~350 lines removed)

Test plan

  • TypeScript compiles cleanly (npx tsc --noEmit)
  • ESLint and Prettier pass (verified by pre-commit hook)
  • Grep confirms removed exports are not referenced from any other file
  • Shared business logic (performConversationSearch, getMessageContent, ConversationSearchParams, MessageContentResult) is preserved and still exported

🤖 Generated with Claude Code


Open with Devin

Remove handleHistoryRequest, handleConversationSearch,
handleMessageContentRequest, and lightModeSurfaceData — these WebSocket
handlers are no longer called anywhere. The macOS app uses HTTP endpoints
that call the shared business logic (performConversationSearch,
getMessageContent) directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…e types

Remove getMessagesPaginated (only caller was the deleted handleHistoryRequest)
along with its PaginatedMessagesResult interface and now-unused drizzle-orm
imports (asc, lt, or) and crud imports (parseMessage, MessageRow).

Remove HistoryRequest, ConversationSearchRequest, and MessageContentRequest
interfaces from sessions.ts — these were parameter types for the removed
WebSocket handlers and are not referenced by any dispatcher or other code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vincent0426
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚩 HistoryResponse and related server types retained despite handler removal

The PR removes the HistoryRequest client message type and the handleHistoryRequest handler, but retains HistoryResponse, HistoryResponseToolCall, and HistoryResponseSurface in assistant/src/daemon/message-types/sessions.ts:248-314. These are still included in _SessionsServerMessages at line 412. This is presumably correct if the HTTP route layer still constructs and sends HistoryResponse messages, but it's worth confirming these response types are actually still used somewhere (likely in the HTTP history endpoint). If they're also dead, they should be removed per the AGENTS.md dead code removal rule.

(Refers to lines 248-314)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

| ConversationSearchRequest
| MessageContentRequest
| ReorderThreadsRequest;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚩 ConversationSearchResponse retained in server messages union without corresponding client request type

The ConversationSearchRequest client type was removed from _SessionsClientMessages, but ConversationSearchResponse (sessions.ts:145-149) is still in _SessionsServerMessages at line 422. This is expected if the HTTP route (GET /v1/conversations/search in session-query-routes.ts) returns search results through the HTTP response body rather than through the WebSocket message union. However, having ConversationSearchResponse in the WebSocket server message union with no corresponding WebSocket client request type is asymmetric. It's not a bug if the type is used elsewhere (e.g., for type reuse in HTTP responses), but worth noting.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@vincent0426 vincent0426 merged commit a6db789 into main Mar 13, 2026
5 checks passed
@vincent0426 vincent0426 deleted the vincent/remove-session-history-dead-code branch March 13, 2026 17:49
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.

1 participant