Repository navigation
feat: add Gemini display labels (#362) - #362
Conversation
Problem: Gemini imports preserve sparse or id-like titles, so search and summary surfaces can show provider identifiers even when the first prompt or attachment names would be more recognizable.\n\nWhat changed: add a Gemini assembly spec that derives deterministic provider display labels for weak imported titles, record raw title and display-label provenance, and make domain display titles prefer provider labels after user overrides while preserving the raw title. Cover assembly, parser, emitter, CLI, MCP, and display-title contracts.\n\nCloses #221
📝 WalkthroughWalkthroughImplemented deterministic display label enrichment for Gemini conversations. Parser now tracks title provenance via Changes
Sequence DiagramsequenceDiagram
participant Parser as Parser<br/>(drive.py)
participant Assembly as GeminiAssemblySpec<br/>(assembly_gemini.py)
participant Runtime as ConversationRuntime<br/>(conversation_runtime.py)
participant Surface as CLI/MCP<br/>(output layer)
Parser->>Parser: Resolve title from payload<br/>Track title_source
Parser->>Parser: Create ParsedConversation<br/>with provider_meta.title_source
Assembly->>Assembly: Check if title is weak<br/>(id-like, fallback, empty)
alt Weak Title Detected
Assembly->>Assembly: Extract first user message<br/>or attachment name
Assembly->>Assembly: Derive display_label<br/>+ display_label_source
Assembly->>Assembly: Update provider_meta
end
Assembly->>Runtime: Pass enriched conversation
Runtime->>Runtime: resolve display_title()
alt provider_meta.display_label present
Runtime->>Runtime: Prefer display_label
else
Runtime->>Runtime: Fall back to original title
end
Surface->>Runtime: Request display_title
Runtime-->>Surface: Return resolved title
Surface->>Surface: Render in search/summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db7428111c
ℹ️ 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".
| return False | ||
| digit_count = sum(char.isdigit() for char in token) | ||
| separator_count = sum(char in "-_.:" for char in token) | ||
| return digit_count >= 4 or separator_count >= 2 |
There was a problem hiding this comment.
Tighten id-like title heuristic for separator-only slugs
The weak-title classifier currently treats any 12+ character token with at least two separators as identifier-like, even when it has no numeric/UUID signal (for example, project-plan-update). In those cases, meaningful imported Gemini titles get flagged as weak, causing display_label to replace the original title in list/search/MCP display surfaces. This is a user-visible accuracy regression for valid slug-style titles and should require stronger ID evidence before overriding.
Useful? React with 👍 / 👎.
## Summary Add deterministic display labels for Gemini conversations whose imported titles are empty, id-like, or fallback-only. The raw provider title remains stored as the conversation title, while `provider_meta.display_label` gives search and summary surfaces a more recognizable presentation label. ## Problem Closes #221 Gemini payloads often have weak top-level titles or only fallback identifiers. Since CLI, API, and MCP surfaces present `display_title`, those conversations could appear as opaque ids even when the first user prompt or attached Drive document name provided better human context. ## Solution - Add a Gemini assembly spec that derives display labels from the first substantive user prompt and attachment names only when the imported title is weak. - Preserve raw title fidelity by keeping `ParsedConversation.title` unchanged and storing `title_source`, `display_label`, and `display_label_source` in provider metadata. - Update conversation and summary display-title precedence to prefer user metadata, then provider display labels, then raw title, then id fallback. - Cover parser provenance, assembly heuristics, emitter enrichment, CLI JSON output, MCP list output, and domain display-title behavior. - Document the Gemini metadata and display precedence. ## Verification - `ruff format polylogue/lib/conversation_runtime.py polylogue/lib/conversation_summary_runtime.py polylogue/sources/assembly.py polylogue/sources/assembly_gemini.py polylogue/sources/parsers/drive.py tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py tests/unit/rendering/test_rendering.py tests/unit/core/test_conversation_semantics.py tests/unit/cli/test_query_fmt.py tests/unit/mcp/test_tool_contracts.py` - `ruff check polylogue/lib/conversation_runtime.py polylogue/lib/conversation_summary_runtime.py polylogue/sources/assembly.py polylogue/sources/assembly_gemini.py polylogue/sources/parsers/drive.py tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py tests/unit/rendering/test_rendering.py tests/unit/core/test_conversation_semantics.py tests/unit/cli/test_query_fmt.py tests/unit/mcp/test_tool_contracts.py` - `pytest -q tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py::test_conversation_emitter_enriches_gemini_display_labels_contract tests/unit/rendering/test_rendering.py::TestConversationSummaryDisplayDate tests/unit/core/test_conversation_semantics.py::TestConversationMetadataAndAggregation::test_title_summary_tags_and_display_contract tests/unit/cli/test_query_fmt.py::TestListFormatting tests/unit/mcp/test_tool_contracts.py::TestQueryTools::test_list_conversations_uses_provider_display_label` - `mypy polylogue/` - `devtools render-all --check` - `devtools verify` - `git push -u origin feature/feat/gemini-display-labels` (pre-push `devtools verify --quick` passed) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Gemini provider support with intelligent display label derivation from user prompts and attachment names. * Introduced provider-specific metadata fields (`display_label`, `title_source`, and `display_label_source`) for improved conversation identification. * **Documentation** * Updated data model documentation to describe new metadata fields and their sources. * **Tests** * Added comprehensive test coverage for Gemini provider functionality and metadata handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Add deterministic display labels for Gemini conversations whose imported titles are empty, id-like, or fallback-only. The raw provider title remains stored as the conversation title, while
provider_meta.display_labelgives search and summary surfaces a more recognizable presentation label.Problem
Closes #221
Gemini payloads often have weak top-level titles or only fallback identifiers. Since CLI, API, and MCP surfaces present
display_title, those conversations could appear as opaque ids even when the first user prompt or attached Drive document name provided better human context.Solution
ParsedConversation.titleunchanged and storingtitle_source,display_label, anddisplay_label_sourcein provider metadata.Verification
ruff format polylogue/lib/conversation_runtime.py polylogue/lib/conversation_summary_runtime.py polylogue/sources/assembly.py polylogue/sources/assembly_gemini.py polylogue/sources/parsers/drive.py tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py tests/unit/rendering/test_rendering.py tests/unit/core/test_conversation_semantics.py tests/unit/cli/test_query_fmt.py tests/unit/mcp/test_tool_contracts.pyruff check polylogue/lib/conversation_runtime.py polylogue/lib/conversation_summary_runtime.py polylogue/sources/assembly.py polylogue/sources/assembly_gemini.py polylogue/sources/parsers/drive.py tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py tests/unit/rendering/test_rendering.py tests/unit/core/test_conversation_semantics.py tests/unit/cli/test_query_fmt.py tests/unit/mcp/test_tool_contracts.pypytest -q tests/unit/sources/test_assembly.py tests/unit/sources/test_parsers_drive.py tests/unit/sources/test_source_laws.py::test_conversation_emitter_enriches_gemini_display_labels_contract tests/unit/rendering/test_rendering.py::TestConversationSummaryDisplayDate tests/unit/core/test_conversation_semantics.py::TestConversationMetadataAndAggregation::test_title_summary_tags_and_display_contract tests/unit/cli/test_query_fmt.py::TestListFormatting tests/unit/mcp/test_tool_contracts.py::TestQueryTools::test_list_conversations_uses_provider_display_labelmypy polylogue/devtools render-all --checkdevtools verifygit push -u origin feature/feat/gemini-display-labels(pre-pushdevtools verify --quickpassed)Summary by CodeRabbit
New Features
display_label,title_source, anddisplay_label_source) for improved conversation identification.Documentation
Tests