Skip to content

Fix chat title generation, copying, and note markdown styling#579

Merged
cogwheel0 merged 3 commits into
mainfrom
debug-577-576-511
Jul 18, 2026
Merged

Fix chat title generation, copying, and note markdown styling#579
cogwheel0 merged 3 commits into
mainfrom
debug-577-576-511

Conversation

@cogwheel0

@cogwheel0 cogwheel0 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • omit internal tool-call blocks when copying chat messages while preserving response markdown and literal code examples
  • restore first-turn title and tag generation for queued and headless OpenWebUI completions, anchored to the target assistant placeholder so later queued turns do not suppress it
  • apply Conduit semantic colors and typography to Fleather headings, lists, quotes, code blocks, and inline code in light and dark modes
  • add regression coverage for all three issue paths

Verification

  • dart run build_runner build
  • flutter analyze
  • flutter test (4,008 passed, 2 existing skips)

Fixes #577
Fixes #576
Fixes #511

Note

Fix chat title generation, clipboard sanitization, and note editor markdown styling

  • Fixes queued chat title generation so _shouldGenerateQueuedTitle triggers title and tags background tasks only on the first user turn of non-temporary conversations, replacing a hardcoded false.
  • Adds sanitizeForClipboard to ConduitMarkdownPreprocessor which strips tool-call <details> blocks while preserving ordinary details and tool-call examples inside code spans/fences.
  • Refactors sanitize, removeAllDetails, and _stripLinkReferenceDefinitions to operate only outside code spans/fences via a new _removeMatchesOutsideCode helper, preventing accidental removal of literal examples in code.
  • Rebuilds the Fleather rich-text theme in note_editor_page.dart to apply consistent colors and typography for headings, lists, quotes, code, and links using the app's semantic color tokens.
  • Adds regression tests in issues_511_576_577_test.dart covering clipboard sanitization, queued title generation logic, and note editor theme colors in light and dark modes.

Macroscope summarized c810559.

Summary by CodeRabbit

  • New Features
    • Queued conversations can now generate titles and tags for eligible first assistant responses (with better handling of temporary chats).
    • Note editor styling is now more consistent and theme-aware across headings, lists, quotes, code blocks, inline code, links, and spacing.
  • Bug Fixes
    • Clipboard copying now removes internal tool-call details while preserving the rest of the markdown, including inline code and fenced code.
  • Tests
    • Added regression tests for clipboard sanitization, queued title/tag eligibility rules, and note editor theme styling.

Greptile Summary

This PR fixes chat title generation, message copying, and rich note markdown styling. The main changes are:

  • Restores first-turn title and tag tasks for queued and headless OpenWebUI completions.
  • Removes internal tool-call details when copying chat messages while preserving markdown and literal code examples.
  • Applies Conduit semantic colors and typography to Fleather headings, lists, quotes, code blocks, inline code, and links.
  • Adds tests for the affected title generation, clipboard sanitization, and note editor theme paths.

Confidence Score: 5/5

Safe to merge with low risk.

The changes are targeted to the reported regressions and keep existing guards for temporary chats and later chat turns. Tests cover the updated markdown, queued-completion, and note-theme behavior. No blocking correctness or security issues were identified in the changed paths.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex executed the Flutter and Dart availability checks from the project workspace and captured the command outputs and exit codes.
  • T-Rex reviewed the resulting logs and confirmed that both Flutter and Dart checks exited with code 1, indicating the tools are not available in the environment.
  • T-Rex prepared two log artifacts that document the availability checks for Flutter and Dart for reviewer inspection.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
lib/features/chat/providers/chat_providers.dart Adds queued and headless title-generation eligibility anchored to the target assistant placeholder while preserving temporary-chat and later-turn suppression.
lib/features/chat/views/chat_page.dart Switches message copying to clipboard-specific markdown sanitization so internal tool-call blocks are omitted without losing plain markdown.
lib/features/notes/views/note_editor_page.dart Extracts and expands Fleather theme construction to apply semantic Conduit colors and typography across rich note blocks and inline styles.
lib/shared/widgets/markdown/markdown_preprocessor.dart Adds clipboard sanitization and shared outside-code removal that masks variable-length code spans and fences before stripping hidden markdown blocks.
test/regressions/issues_511_576_577_test.dart Adds tests for clipboard tool-call removal, queued title generation, and note editor theme color behavior.
test/shared/widgets/markdown/markdown_preprocessor_test.dart Extends markdown preprocessor tests for preserving literal hidden-block syntax inside variable-length code delimiters and removing details containing code.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant ChatPage
participant Preprocessor
participant Queue as Queued/Headless Completion
participant OpenWebUI
participant Notes as Note Editor

User->>ChatPage: Copy assistant message
ChatPage->>Preprocessor: sanitizeForClipboard(content)
Preprocessor-->>ChatPage: Markdown without internal tool-call details
ChatPage-->>User: Clipboard text

Queue->>Queue: Locate target assistant placeholder
Queue->>Queue: Count prior user turns
alt first non-temporary turn
    Queue->>OpenWebUI: sendMessageSession(backgroundTasks: title/tags)
else later or temporary turn
    Queue->>OpenWebUI: sendMessageSession(without title/tags)
end

User->>Notes: Open rich note editor
Notes->>Notes: buildNoteEditorFleatherTheme(context)
Notes-->>User: Semantic colors for headings, lists, quotes, and code
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant ChatPage
participant Preprocessor
participant Queue as Queued/Headless Completion
participant OpenWebUI
participant Notes as Note Editor

User->>ChatPage: Copy assistant message
ChatPage->>Preprocessor: sanitizeForClipboard(content)
Preprocessor-->>ChatPage: Markdown without internal tool-call details
ChatPage-->>User: Clipboard text

Queue->>Queue: Locate target assistant placeholder
Queue->>Queue: Count prior user turns
alt first non-temporary turn
    Queue->>OpenWebUI: sendMessageSession(backgroundTasks: title/tags)
else later or temporary turn
    Queue->>OpenWebUI: sendMessageSession(without title/tags)
end

User->>Notes: Open rich note editor
Notes->>Notes: buildNoteEditorFleatherTheme(context)
Notes-->>User: Semantic colors for headings, lists, quotes, and code
Loading

Reviews (3): Last reviewed commit: "fix: harden markdown code masking" | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8b027931-57bc-4d8b-bf96-9b709624170a

📥 Commits

Reviewing files that changed from the base of the PR and between 008ed1d and c810559.

📒 Files selected for processing (3)
  • lib/shared/widgets/markdown/markdown_preprocessor.dart
  • test/regressions/issues_511_576_577_test.dart
  • test/shared/widgets/markdown/markdown_preprocessor_test.dart

📝 Walkthrough

Walkthrough

Queued completion title generation now uses message-aware eligibility checks, copied chat content removes internal tool-call blocks, and note editor Fleather styling is centralized across rich-text elements. Regression tests cover all three behaviors across chat, clipboard, and light/dark note rendering scenarios.

Changes

Queued title generation

Layer / File(s) Summary
Queued title generation eligibility
lib/features/chat/providers/chat_providers.dart, test/regressions/issues_511_576_577_test.dart
Queued and headless completions compute title-generation eligibility from the target assistant message, preceding user-message count, and temporary-chat status. Tests cover first and later turns, temporary chats, and message targeting.

Clipboard sanitization

Layer / File(s) Summary
Clipboard-specific markdown cleanup
lib/shared/widgets/markdown/markdown_preprocessor.dart, lib/features/chat/views/chat_page.dart, test/regressions/issues_511_576_577_test.dart, test/shared/widgets/markdown/markdown_preprocessor_test.dart
Code-aware sanitization removes reasoning and tool-call details outside code spans or fences, preserves literal code content, normalizes clipboard output, and is used by message copying. Tests cover sanitizer and details-removal behavior.

Note editor theming

Layer / File(s) Summary
Complete Fleather theme construction
lib/features/notes/views/note_editor_page.dart, test/regressions/issues_511_576_577_test.dart
A centralized Fleather theme maps Conduit typography and colors to paragraphs, headings, lists, quotes, code, rules, and links. Widget tests validate styling across brightness values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Poem

I’m a bunny with a tidy clipboard bright,
Tool calls hop away, leaving text just right.
Titles now bloom on the first chat turn,
Fleather notes glow as colors softly burn.
Three little fixes, all nestled with care—
Hop, hop, review; the tests are there!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the three main changes: title generation, copy behavior, and note markdown styling.
Linked Issues check ✅ Passed The changes address #577, #576, and #511 with matching code and regression tests.
Out of Scope Changes check ✅ Passed The modified files stay within the linked issue scope; no unrelated feature work stands out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch debug-577-576-511

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 `@lib/shared/widgets/markdown/markdown_preprocessor.dart`:
- Around line 196-199: Update the preprocessing flow around _replaceOutsideCode
to mask inline and fenced code spans with placeholders before removing
_toolCallBlocks, then restore only placeholders that remain after removal.
Preserve the existing newline normalization and trimming behavior, and add a
regression case covering a tool-call block containing both inline and fenced
code.

In `@test/regressions/issues_511_576_577_test.dart`:
- Around line 24-27: Replace the `expect` assertion in the regression test with
the `package:checks` `check(...).equals(...)` API, and update any other
assertions in this new test file similarly while preserving the existing
expected values and test behavior.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b9f6288a-4ec9-417c-86fd-5103b6dfcb89

📥 Commits

Reviewing files that changed from the base of the PR and between 3cfbb9c and c8ace67.

📒 Files selected for processing (5)
  • lib/features/chat/providers/chat_providers.dart
  • lib/features/chat/views/chat_page.dart
  • lib/features/notes/views/note_editor_page.dart
  • lib/shared/widgets/markdown/markdown_preprocessor.dart
  • test/regressions/issues_511_576_577_test.dart

Comment thread lib/shared/widgets/markdown/markdown_preprocessor.dart Outdated
Comment thread test/regressions/issues_511_576_577_test.dart Outdated
@cogwheel0

cogwheel0 commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

Fixes Applied Successfully

Fixed 4 CodeRabbit feedback items across 3 files.

Files modified:

  • lib/shared/widgets/markdown/markdown_preprocessor.dart
  • test/regressions/issues_511_576_577_test.dart
  • test/shared/widgets/markdown/markdown_preprocessor_test.dart

Commits: 008ed1dd, c810559a

The latest autofix changes are on the debug-577-576-511 branch.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 `@lib/shared/widgets/markdown/markdown_preprocessor.dart`:
- Line 67: Update the _codeSpanOrFence regular expression to capture one or more
backticks and close with the same captured delimiter via a backreference, so
inline spans and fences of any backtick length are matched correctly.
- Around line 338-364: Generalize the existing masking logic into a
_removeMatchesOutsideCode helper that accepts the input and target pattern,
preserving code spans and fenced blocks while removing only matches outside
them. Delete _replaceOutsideCode, then update removeAllDetails,
_stripLinkReferenceDefinitions, sanitize, and sanitizeForClipboard to use the
new helper for _allDetailsBlocks, _linkReferenceDefinition, _reasoningBlocks,
and _toolCallBlocks respectively.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fb382f87-1174-4f79-925f-30a206800f27

📥 Commits

Reviewing files that changed from the base of the PR and between c8ace67 and 008ed1d.

📒 Files selected for processing (2)
  • lib/shared/widgets/markdown/markdown_preprocessor.dart
  • test/regressions/issues_511_576_577_test.dart

Comment thread lib/shared/widgets/markdown/markdown_preprocessor.dart Outdated
Comment thread lib/shared/widgets/markdown/markdown_preprocessor.dart Outdated
@cogwheel0

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cogwheel0
cogwheel0 merged commit eb99937 into main Jul 18, 2026
3 checks passed
@cogwheel0
cogwheel0 deleted the debug-577-576-511 branch July 18, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant