Skip to content

Conversation

@nishantmonu51
Copy link
Collaborator

@nishantmonu51 nishantmonu51 commented Nov 28, 2025

Feature flag: developerChat

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!
@nishantmonu51 nishantmonu51 added the blocker A release blocker issue that should be resolved before a new release label Nov 28, 2025
@ericpgreen2 ericpgreen2 changed the title [WIP] Bring developer chat behind a feature flag developerChat Dec 2, 2025
@ericokuma
Copy link
Contributor

Is this ready to test?

@ericpgreen2
Copy link
Contributor

ericpgreen2 commented Dec 3, 2025

Code Review

Developed in collaboration with Claude Code and Eric.

Overview

This PR introduces a Developer Chat feature behind a developerChat feature flag, refactoring the existing chat infrastructure to support multiple agent types. The approach is sound and the abstraction via ChatConfig is a reasonable first pass.

Must Fix

1. ChatConfig location

The config lives in core/input/types.ts but is used by Messages.svelte, SidebarChat.svelte, and ChatInput.svelte. It's a chat-wide concern, not input-specific - move to core/types.ts or core/config.ts.

Consider Fixing

2. Type assertions

Replace angle-bracket assertions with satisfies in agent-contexts.ts for better type safety:

// Before
return <RuntimeServiceCompleteBody>{
  analystAgentContext,
};

// After
return {
  analystAgentContext,
} satisfies Partial<RuntimeServiceCompleteBody>;

The angle-bracket syntax (<Type>value) is a type assertion that tells TypeScript "trust me, this is this type" - it won't catch extra properties or typos in property names. The satisfies operator validates that the object conforms to the type while preserving the inferred type, catching errors at compile time.

Tech Debt / Future Work

3. ConversationManager agent-keying and conversation filtering

The ConversationManager singleton is now keyed by instanceId:agent to keep analyst and developer chat state isolated client-side (selected conversation, new conversation draft, etc.). However, listConversationsQuery() still queries with userAgentPattern: "rill%" for both surfaces - so the conversation list returned from the API is shared.

Once Platform provides a surface filtering scheme, the preferred approach is:

  • Pass a surface identifier when creating conversations (e.g., rill-developer/1.0, rill-analyst/1.0)
  • Filter by that surface when listing conversations
  • Simplify back to instanceId-only keying and remove agent-awareness from ConversationManager entirely

The agent field would remain on Conversation (needed for the Complete API), but wouldn't be part of the manager's identity.

4. Context directory coupling (agent-contexts.ts)

The chat feature reaches into dashboard internals (useStableExploreState, createStableTimeControlStoreFromName, isExpressionEmpty). This inverts the dependency direction - if dashboard internals change, chat breaks.

A cleaner pattern would be for each feature to export its own context for chat:

  • features/dashboards/chat-context.ts → exports getExploreContextForChat()
  • features/editor/chat-context.ts → exports getFileContextForChat()

5. ChatConfig eager store creation

The config objects are defined at module scope:

export const dashboardChatConfig = <ChatConfig>{
  additionalContextStore: getActiveExploreContext(), // Called at import time
  ...
};

This creates derived stores even when chat isn't being used. Consider lazy initialization via a factory function.

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a comment

Choose a reason for hiding this comment

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

Approving w/ comments to unblock the release, though I note that there's tech debt to clean up.

@AdityaHegde
Copy link
Collaborator

Thanks @ericpgreen2 . I have addressed your comments except ConversationManager agent-keying and conversation filtering. That is somewhat involved, lets take it as a follow up before lifting the feature flag.

@AdityaHegde AdityaHegde merged commit cd3004d into main Dec 3, 2025
12 checks passed
@AdityaHegde AdityaHegde deleted the bring-developer-chat branch December 3, 2025 09:47
AdityaHegde added a commit that referenced this pull request Dec 3, 2025
* feat: generate sample data CTA

* Add a button in add asset dropdown

* First version of developer chat

* Make AI chat work on main page

* More UI changes to pass in context of current page the user is viewing

* Cleanup

* Bug fixes

* Misc changes

* Remove generate data specific code

* PR comments

* Fix tests

---------

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker A release blocker issue that should be resolved before a new release

5 participants