Skip to content

refactor: Adopt chat terminology for AI sessions - #714

Merged
ilyabo merged 7 commits into
mainfrom
unify-chat-session-terminology
Jun 16, 2026
Merged

ilyabo merged 7 commits into
mainfrom
unify-chat-session-terminology

Conversation

@ilyabo

@ilyabo ilyabo commented Jun 14, 2026 •

Copy link
Copy Markdown
Collaborator

addresses #198

Summary

  • Rename core session APIs and docs from analysis terminology to chat terminology
  • Update AI slice and transport logic to derive legacy analysis results from uiMessages
  • Refresh the CLI chat container and package READMEs to use the new names

Summary by CodeRabbit

Release Notes

  • New Features
    • Added chat-session schema and helpers (chat turns, session emptiness checks, chat request error messaging) to the public API and UI export surface.
  • Refactor
    • Chat history now persists and renders from uiMessages, deriving chat turns for the chat timeline and related search.
    • Legacy session data is migrated/normalized to the new chat-session shape, including updated cancellation flow.
  • Bug Fixes
    • Improved chat completion/error detection for aborted chats and legacy error metadata.
  • Documentation
    • Updated READMEs and the upgrade guide with migration and terminology guidance.
  • Tests
    • Updated and expanded tests for chat sessions and legacy compatibility.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2aafa8e-f27f-4be5-a0cb-5b3577b28cb3

📥 Commits

Reviewing files that changed from the base of the PR and between 8cd19f2 and 419615a.

📒 Files selected for processing (1)
  • packages/ai-core/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ai-core/src/index.ts

📝 Walkthrough

Walkthrough

Renames the AI session model from AnalysisSession/analysisResults to ChatSession/uiMessages across the entire codebase. Introduces ChatSessionSchema as the authoritative schema, a new chatTurns.ts utility module to derive ChatTurn objects from UI messages, and updates state management, transport error handling, and UI components accordingly. Legacy AnalysisSession* names are retained as deprecated aliases with schema migration support for persisted data.

Changes

Chat Session Model Migration

Layer / File(s) Summary
ChatSessionSchema contract and AiSliceConfig wiring
packages/ai-config/src/schema/ChatSessionSchema.ts, packages/ai-config/src/AiSliceConfig.ts, packages/ai-config/src/index.ts
ChatSessionBaseSchema and ChatSessionSchema become the primary session types with deprecated analysis aliases; AiSliceConfig.sessions uses the new type and drops analysisResults initialization; ai-config re-exports redirect to ChatSessionSchema.
v0.26.0 migration to strip analysisResults and derive uiMessages
packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts, packages/ai-core/__tests__/migration.test.ts
Migration detector triggers when analysisResults exists; migrator strips legacy analysisResults from returned sessions, conditionally synthesizes uiMessages from legacy result data only when absent, applies legacy metadata to matching user messages, ensures isRunning: false, and includes comprehensive test coverage for migration edge cases.
Chat turn derivation, context selection, and session normalization
packages/ai-core/src/chatTurns.ts, packages/ai-core/src/contextSelection.ts, packages/ai-core/src/utils.ts, packages/ai-core/src/constants.ts, packages/ai-core/__tests__/chatTurns.test.ts, packages/ai-core/__tests__/contextSelection.test.ts
New chatTurns.ts module derives ChatTurn objects from uiMessages with error/completion metadata; isChatSessionEmpty replaces isAnalysisSessionEmpty for chat-semantics checks; helpers to read/write error messages on UI message metadata; new normalizeAiSession and normalizeAiConfig normalize restored session state; constants for cancellation reasons.
AiSlice state management refactor to ChatSession
packages/ai-core/src/AiSlice.ts, packages/ai-core/src/types.ts, packages/ai-core/__tests__/AiSlice.modelSelection.test.ts
AiSlice switches session typing to ChatSessionSchema; normalizes config/sessions on rehydration via normalizeAiConfig; removes analysisResults initialization and pending-ID tracking; rewrites deleteAnalysisResult to remove UI message blocks; makes getAnalysisResults/addAnalysisResult legacy-compat shims over turn derivation; updates session lifecycle methods and transport-facing types.
chatTransport error handling and message mutation
packages/ai-core/src/chatTransport.ts
Switches to ChatSessionSchema lookups; replaces analysisResults error/cancellation writes with setChatRequestErrorMessage calls on the last user message; stamps tool timings onto message metadata; clones agentProgress from AI state; increments messagesRevision on session changes.
ChatMessagesContainer and AnalysisResult component refactoring
packages/ai-core/src/components/ChatMessagesContainer.tsx, packages/ai-core/src/components/AnalysisResult.tsx
AnalysisResultsContainer renamed to ChatMessagesContainer; reads uiMessages from session, memoizes getChatTurnsFromUiMessages, and renders AnalysisResult with chatTurn prop. AnalysisResult now accepts optional chatTurn and optional analysisResult; derives turnId, prompt, isCompleted, errorMessage from chatTurn with fallback to analysis-result values.
Session list, header, and title generation UI updates
packages/ai-core/src/components/Chat.tsx, packages/ai-core/src/components/ChatHeader.tsx, packages/ai-core/src/components/ChatHistoryItem.tsx, packages/ai-core/src/components/ChatHistoryView.tsx, packages/ai-core/src/hooks/useGenerateSessionTitle.ts
Chat.Messages wired to ChatMessagesContainer. ChatHeader, ChatHistoryItem, ChatHistoryView adopt ChatSessionSchema types for internal session state and callbacks. useGenerateSessionTitle updates message-part derivation to read from uiMessages.
Public API exports, artifact consumers, and test fixtures
packages/ai-core/src/index.ts, packages/ai/src/index.ts, packages/artifacts/src/ai/artifactAiSessionHelpers.ts, packages/artifacts/src/ai/artifactAiSlice.ts, packages/artifacts/__tests__/artifactAiSessions.test.ts, packages/ai-core/__tests__/ChatHistoryView.test.tsx, apps/sqlrooms-cli-ui/src/components/AssistantChatContainer.tsx
ai-core and ai packages export ChatMessagesContainer, isChatSessionEmpty, ChatSessionSchema, ChatTurn-related helpers, and deprecated AnalysisResultsContainer alias. artifacts updates session consumers to ChatSessionSchema. AssistantChatContainer app component switches to isChatSessionEmpty. All test fixtures drop analysisResults initialization and adopt ChatSessionSchema shape.
README and upgrade guide documentation
docs/upgrade-guide.md, packages/ai-config/README.md, packages/ai-core/README.md, packages/ai/README.md, packages/artifacts/README.md
Upgrade guide adds 0.29.0 section documenting chat-term replacements, compatibility behavior, migration examples, and turn-derivation usage. Package READMEs add notes clarifying that legacy analysisResults sessions load via migration but new ChatSessionSchema omits that field in favor of uiMessages. Artifact docs update schema terminology.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#707: Introduces draftContextItemIds and per-session draft context APIs on the slice/session model, which this PR's context-selection signature updates directly depend on.
  • sqlrooms/sqlrooms#699: Updates AssistantChatContainer.tsx session-empty check; this PR refactors that same component's logic alongside the terminology migration.
  • sqlrooms/sqlrooms#698: Modifies AssistantChatContainer.tsx to add chat-history UI flow; this PR updates session-empty checks in the same file.

Suggested reviewers

  • dmitriy-kostianetskiy

Poem

🐇 Hop, hop, the session names changed today,
analysisResults has bounced away!
uiMessages now holds the chat,
ChatSessionSchema—how fancy that!
Deprecated aliases wave goodbye,
while ChatTurn helpers reach the sky. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: Adopt chat terminology for AI sessions' accurately reflects the main objective of this changeset, which systematically renames analysis-based terminology to chat-based terminology throughout the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch unify-chat-session-terminology

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ilyabo ilyabo changed the title Adopt chat terminology for AI sessions refactor: Adopt chat terminology for AI sessions Jun 14, 2026
@ilyabo
ilyabo requested a review from lixun910 June 14, 2026 18:01
@ilyabo
ilyabo marked this pull request as ready for review June 14, 2026 18:22

@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: 20fac629bd

ℹ️ 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 on lines +75 to +76
const {analysisResults: _legacyAnalysisResults, ...session} =
sessionWithLegacy;

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 legacy result errors before dropping them

For rooms saved before this refactor where a failed or cancelled request is represented only in analysisResults.errorMessage, this drops the legacy result before that error is copied into uiMessages. After parsing, getAnalysisResultsFromUiMessages only reads message.metadata.sqlrooms.errorMessage, so those historical failures reload as prompt-only/incomplete turns with no error. Please transfer legacy errorMessage and completion state onto the synthesized or matching user message before removing analysisResults.

Useful? React with 👍 / 👎.

Comment thread packages/ai-core/src/AiSlice.ts Outdated
Comment on lines +1361 to +1364
return getAnalysisResultsFromUiMessages(
currentSession.uiMessages as UIMessage[],
{isRunning: currentSession.isRunning},
);

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 Cache derived analysis results for selectors

When existing consumers keep the previous pattern useStoreWithAi((s) => s.ai.getAnalysisResults()), this now returns a freshly mapped array on every store snapshot even when uiMessages has not changed. Zustand/useSyncExternalStore treats that as a changed snapshot and can trigger the cached-snapshot warning or render loop; the old implementation returned the stable stored analysisResults array. Please cache the derived results per session/messages reference or avoid exposing this getter for selector use.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts (1)

84-152: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve legacy errorMessage when synthesizing uiMessages.

This migration drops analysisResults, but it never maps result.errorMessage onto the synthesized messages. Downstream, getChatRequestErrorMessage() in packages/ai-core/src/chatTurns.ts only reads message.metadata.sqlrooms.errorMessage, so failed legacy sessions rehydrate as turns with no error once analysisResults is stripped.

Suggested fix
   if (needsMessageSynthesis) {
     for (const result of analysisResults) {
       if (!isObject(result)) continue;
       const id = (result.id as string) || '';
       const prompt = (result.prompt as string) || '';
+      const errorMessage =
+        isObject(result.errorMessage) &&
+        typeof result.errorMessage.error === 'string'
+          ? {error: result.errorMessage.error}
+          : undefined;
       const streamMessage = (result.streamMessage as UnknownRecord) || {};
       const parts = (streamMessage.parts as UnknownRecord[]) || [];

       // Create user message for the prompt
       if (prompt) {
         synthesizedMessages.push({
           id,
           role: 'user',
+          ...(errorMessage
+            ? {metadata: {sqlrooms: {errorMessage}}}
+            : {}),
           parts: [{type: 'text', text: prompt}],
         });
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts` around lines 84
- 152, The code synthesizing messages from analysisResults does not preserve the
errorMessage field from the result object. This causes downstream code in
getChatRequestErrorMessage() to lose error information when reading
message.metadata.sqlrooms.errorMessage. Extract the errorMessage from each
result in the loop (similar to how prompt and streamMessage are extracted), and
when creating synthesized messages, add a metadata object with the structure
metadata.sqlrooms.errorMessage to preserve the error information for downstream
processing.
packages/ai-core/src/AiSlice.ts (1)

281-297: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Apply the same session normalization in setConfig().

This new cleanup only runs during slice construction. ai.setConfig() still stores incoming sessions verbatim, so any caller restoring/importing config through the public setter can reintroduce isRunning: true sessions and incomplete uiMessages that this block explicitly fixes on startup. Please extract this into a shared normalizer and use it from both ingress paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-core/src/AiSlice.ts` around lines 281 - 297, The session cleanup
logic (running cleanupPendingUiMessages, fixIncompleteToolCalls, and resetting
isRunning to false) is only applied during slice construction but not when
setConfig() is called. This means callers can bypass normalization by restoring
config through the public setter, reintroducing problematic state like
isRunning: true or incomplete tool calls. Extract the session normalization
logic from the slice constructor (the mapping over params.config.sessions that
calls cleanupPendingUiMessages and fixIncompleteToolCalls) into a shared helper
function or method, then apply this normalizer to the sessions parameter in both
the constructor code shown and the setConfig() method to ensure consistent
normalization regardless of how config is ingested.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/upgrade-guide.md`:
- Around line 304-308: The code example showing Chat.Messages is incomplete and
misleading because it omits the required Chat.Root wrapper that provides the
chat/session context. Update the example snippet to wrap Chat.Messages with its
parent Chat.Root component, ensuring the example is self-contained and
immediately copy-pasteable for users following the upgrade guide.

In `@packages/ai-core/__tests__/migration.test.ts`:
- Around line 31-33: The test assertions at
packages/ai-core/__tests__/migration.test.ts lines 31-33 and lines 51-53 use
toBeUndefined() to verify that analysisResults has been removed, but this
approach does not fully validate the migration contract since toBeUndefined()
passes even if the property exists with an explicit undefined value. Replace
both instances of toBeUndefined() assertions with
not.toHaveProperty('analysisResults') or an equivalent check using the in
operator to properly verify that the key is actually removed from the result
object.

In `@packages/ai-core/src/AiSlice.ts`:
- Around line 1368-1377: The addAnalysisResult method in AiSlice.ts is currently
a silent no-op that accepts a UIMessage parameter but performs no operations,
causing existing code that calls this method to fail silently without updating
uiMessages. Either implement the method to properly translate the legacy call by
adding the provided UIMessage to the uiMessages state (similar to how the new
chat transport updates uiMessages), or remove the method entirely and prepare
for a breaking release if this is a public API. Do not leave it as a silent
no-op that discards input without error.

---

Outside diff comments:
In `@packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts`:
- Around line 84-152: The code synthesizing messages from analysisResults does
not preserve the errorMessage field from the result object. This causes
downstream code in getChatRequestErrorMessage() to lose error information when
reading message.metadata.sqlrooms.errorMessage. Extract the errorMessage from
each result in the loop (similar to how prompt and streamMessage are extracted),
and when creating synthesized messages, add a metadata object with the structure
metadata.sqlrooms.errorMessage to preserve the error information for downstream
processing.

In `@packages/ai-core/src/AiSlice.ts`:
- Around line 281-297: The session cleanup logic (running
cleanupPendingUiMessages, fixIncompleteToolCalls, and resetting isRunning to
false) is only applied during slice construction but not when setConfig() is
called. This means callers can bypass normalization by restoring config through
the public setter, reintroducing problematic state like isRunning: true or
incomplete tool calls. Extract the session normalization logic from the slice
constructor (the mapping over params.config.sessions that calls
cleanupPendingUiMessages and fixIncompleteToolCalls) into a shared helper
function or method, then apply this normalizer to the sessions parameter in both
the constructor code shown and the setConfig() method to ensure consistent
normalization regardless of how config is ingested.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff8e221a-1a04-467f-af05-ff07ec7dde57

📥 Commits

Reviewing files that changed from the base of the PR and between 7bcea73 and 20fac62.

📒 Files selected for processing (34)
  • apps/sqlrooms-cli-ui/src/components/AssistantChatContainer.tsx
  • docs/upgrade-guide.md
  • packages/ai-config/README.md
  • packages/ai-config/src/AiSliceConfig.ts
  • packages/ai-config/src/index.ts
  • packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts
  • packages/ai-config/src/schema/ChatSessionSchema.ts
  • packages/ai-core/README.md
  • packages/ai-core/__tests__/AiSlice.modelSelection.test.ts
  • packages/ai-core/__tests__/ChatHistoryView.test.tsx
  • packages/ai-core/__tests__/chatTurns.test.ts
  • packages/ai-core/__tests__/contextSelection.test.ts
  • packages/ai-core/__tests__/migration.test.ts
  • packages/ai-core/src/AiSlice.ts
  • packages/ai-core/src/chatTransport.ts
  • packages/ai-core/src/chatTurns.ts
  • packages/ai-core/src/components/AnalysisResult.tsx
  • packages/ai-core/src/components/Chat.tsx
  • packages/ai-core/src/components/ChatHeader.tsx
  • packages/ai-core/src/components/ChatHistoryItem.tsx
  • packages/ai-core/src/components/ChatHistoryView.tsx
  • packages/ai-core/src/components/ChatMessagesContainer.tsx
  • packages/ai-core/src/constants.ts
  • packages/ai-core/src/contextSelection.ts
  • packages/ai-core/src/hooks/useGenerateSessionTitle.ts
  • packages/ai-core/src/index.ts
  • packages/ai-core/src/types.ts
  • packages/ai-core/src/utils.ts
  • packages/ai/README.md
  • packages/ai/src/index.ts
  • packages/artifacts/README.md
  • packages/artifacts/__tests__/artifactAiSessions.test.ts
  • packages/artifacts/src/ai/artifactAiSessionHelpers.ts
  • packages/artifacts/src/ai/artifactAiSlice.ts
💤 Files with no reviewable changes (2)
  • packages/ai-core/src/constants.ts
  • packages/ai-core/tests/AiSlice.modelSelection.test.ts

Comment thread docs/upgrade-guide.md
Comment thread packages/ai-core/__tests__/migration.test.ts Outdated
Comment thread packages/ai-core/src/AiSlice.ts Outdated

@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: e7cda404d3

ℹ️ 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".

const hasLegacyToolData = 'toolAdditionalData' in d;

return !hasUiMessages || hasLegacyToolData;
return !hasUiMessages || hasLegacyAnalysisResults || hasLegacyToolData;

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 draft prompts while stripping legacy results

When upgrading an already-migrated saved session that still has legacy analysisResults (the previous schema stored both uiMessages and analysisResults), this new guard runs migrateFromV0_26_0 just to drop the legacy field. That migration still unconditionally returns prompt: '', so any unsent per-session draft prompt is erased on reload/upgrade even though the session already has uiMessages. Preserve the existing session.prompt when uiMessages is present, and only default it for genuinely pre-chat sessions.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts (1)

146-205: 💤 Low value

Redundant condition check.

The if (needsMessageSynthesis) at line 146 is always true at this point because the !needsMessageSynthesis branch on line 131 ends with continue. This doesn't affect correctness but adds unnecessary nesting.

♻️ Suggested simplification
-    if (needsMessageSynthesis) {
       // Create user message for the prompt
       if (prompt) {
         synthesizedMessages.push(
           ...
         );
       }
       ...
-    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts` around lines 146
- 205, Remove the redundant `if (needsMessageSynthesis)` condition check that
wraps the message synthesis logic, since the opposite branch ends with
`continue` and control will never reach this point when needsMessageSynthesis is
false. Unindent all the code that creates the user message (using
synthesizedMessages.push with withLegacyResultMetadata), builds the
assistantParts array by iterating over parts, and pushes the assistant message
to synthesizedMessages by one level of indentation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ai-core/src/utils.ts`:
- Around line 255-271: The normalizeAiSession function contains redundant
processing: cleanupPendingUiMessages already calls fixIncompleteToolCalls
internally, but then the result is passed through fixIncompleteToolCalls again
in lines 259-263. Remove the second unnecessary call to fixIncompleteToolCalls
and instead use the uiMessages directly from the cleaned result of
cleanupPendingUiMessages, simplifying the logic to avoid double-processing the
same messages.

---

Nitpick comments:
In `@packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts`:
- Around line 146-205: Remove the redundant `if (needsMessageSynthesis)`
condition check that wraps the message synthesis logic, since the opposite
branch ends with `continue` and control will never reach this point when
needsMessageSynthesis is false. Unindent all the code that creates the user
message (using synthesizedMessages.push with withLegacyResultMetadata), builds
the assistantParts array by iterating over parts, and pushes the assistant
message to synthesizedMessages by one level of indentation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32fc4b75-785e-4c1c-bfa4-dc47f68cdfef

📥 Commits

Reviewing files that changed from the base of the PR and between 20fac62 and 5e77b55.

📒 Files selected for processing (8)
  • docs/upgrade-guide.md
  • packages/ai-config/src/migration/AnalysisSession-v0.26.0.ts
  • packages/ai-core/__tests__/AiSlice.modelSelection.test.ts
  • packages/ai-core/__tests__/chatTurns.test.ts
  • packages/ai-core/__tests__/migration.test.ts
  • packages/ai-core/src/AiSlice.ts
  • packages/ai-core/src/chatTurns.ts
  • packages/ai-core/src/utils.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/upgrade-guide.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/ai-core/src/chatTurns.ts
  • packages/ai-core/tests/migration.test.ts

Comment thread packages/ai-core/src/utils.ts

@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: 8cd19f2907

ℹ️ 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 on lines 79 to 82
export type {
AiRunContext,
AiRunContextItem,
AnalysisSessionSchema,
} from '@sqlrooms/ai-config';

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 Restore the legacy ai-core session type export

Existing apps that import type AnalysisSessionSchema from @sqlrooms/ai-core lose that public type in this barrel even though the migration docs say the analysis-named APIs remain compatibility aliases. Please keep re-exporting the deprecated type alongside the new chat names so downstream TypeScript consumers do not break during the migration window.

Useful? React with 👍 / 👎.

@ilyabo
ilyabo merged commit 407117f into main Jun 16, 2026
4 checks passed
@ilyabo
ilyabo deleted the unify-chat-session-terminology branch June 16, 2026 15:10
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