Fix/version 0.9 - #210
Merged
Merged
Conversation
**Core Changes:** - Refactored ParameterMapperService to use LLM-based subdivision detection instead of hardcoded rules (locations/phases/teams) - Updated HierarchicalItemGenerator to work generically with any subdivision type detected by the LLM - Fixed PlanningContextDetector to skip creation if context already exists - Fixed return statement in initialize_planning_with_new_context - Added ParentRequirementsAnalyzer call to process_answers flow - Fixed partial variable passing (_list_created_confirmation.html.erb) **Result:** The system now works equally for ANY planning domain: - Reading lists subdivided by books - Course curricula subdivided by modules - Product roadmaps subdivided by quarters - Event planning subdivided by locations - Recipe planning subdivided by courses - Any other domain the user imagines LLM intelligently detects the best subdivision strategy for each specific request, rather than using hardcoded domain-specific logic. **Documentation:** - Added ARCHITECTURE_GENERIC_DESIGN.md explaining domain-agnostic principles - Updated CLAUDE.md, CHAT_CONTEXT.md, CHAT_FLOW.md, ITEM_GENERATION.md, CHAT_REQUEST_TYPES.md to emphasize generic nature - Documented where domain-specific code is forbidden - Added testing guidance for multiple domains Fixes: Pre-creation planning now generates location-based (or any type) sublists with appropriate items for each subdivision. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…eration progress - Remove invalid data[:planning_context] reference in _planning_state_indicator.html.erb - Fix show_item_generation_progress to wrap locals in data hash as expected by template - Maintain correct fast model usage (gpt-4.1-nano) for first step optimization These fixes resolve the 'undefined local variable' errors that were preventing the planning state UI from rendering during complex list creation. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…mplexityService result CRITICAL BUG FIX: The system was analyzing request complexity TWICE: 1. First in ChatCompletionService (returned is_complex: true) 2. Again in PlanningContextHandler via PlanningContextDetector The second analysis could return different results (especially with fast models), causing complex requests to be treated as simple, bypassing clarifying questions. SOLUTION: Use the complexity flag from the first analysis instead of re-analyzing. - Pass combined_data to initialize_planning_with_new_context - Create PlanningContext directly with confirmed complexity flag - Only use PlanningContextHandler for item generation and answer processing RESULT: Complex requests now ALWAYS show clarifying questions before list creation. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…st creation Tracing the flow to identify why subdivisions/sublists are not being created: - Log when hierarchical item generation starts - Log parameters being used - Log subdivision type detection - Log subdivision data lookup - Log each subdivision creation This will help diagnose if: 1. HierarchicalItemGenerator is being called 2. Subdivision data is present 3. Items are being generated for each subdivision Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…data MAJOR FIX: The system was waiting for perfect 'subdivision_type' classification before creating sublists. This was fragile and domain-specific. NEW APPROACH (Generic & Domain-Agnostic): - Don't classify subdivisions - just look for any array data in parameters - Priority order: locations → phases → topics → modules → books → teams → activities - Create a sublist for each item in the first non-empty array found - Works automatically for ANY domain without hardcoded types Benefits: ✅ Works for locations, phases, topics, modules, books, teams, activities, etc. ✅ No LLM classification needed ✅ Truly generic - no domain-specific code ✅ Robust - doesn't fail if parameter extraction is imperfect ✅ Simple - just uses whatever data exists Example flows: - Roadshow with 6 locations → 6 sublists (one per location) - Project with 3 phases → 3 sublists (one per phase) - Course with 4 modules → 4 sublists (one per module) - Reading list with 5 books → 5 sublists (one per book) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
… issue - Added debug logging to show questions array state - Added visual indicator showing if questions loaded or if array is empty - Added min-height to form container to ensure it displays - Shows ✓ X questions or 🔴 No questions loaded for diagnosis - This will help identify if the form is not displaying due to empty questions This commit helps diagnose why the pre-creation form isn't showing.
When parameters come from JSON deserialization, they have string keys, not symbols. The generate_subdivisions method was using symbol keys (e.g., :locations) which returned nil even though the data existed at string keys (e.g., 'locations'). This prevented subdivisions from being created when answering planning questions. Changes: - Access parameters with both symbol and string keys as fallback - Fixes: @parameters[:locations] || @parameters['locations'] - Apply same fix to :category, :budget, :timeline access - Ensures generic/domain-agnostic sublist creation works correctly This allows sublists to be created for any data type (locations, phases, topics, etc.).
…nService call ItemGenerationService.initialize does not accept :subdivision_type keyword. The service already has sublist_title to indicate the subdivision context. Changes: - Removed subdivision_type: parameter from ItemGenerationService.new call - Fixed return value to use result.data instead of result.data[:items] This fixes the 'unknown keyword: :subdivision_type' error when generating sublist items.
…nerationService ItemGenerationService.format_planning_context calls .each on the planning_context parameter, expecting it to be a hash that can be iterated over. Passing the PlanningContext object caused 'undefined method each for PlanningContext' error. Changes: - Pass @parameters (the hash) instead of @planning_context (the model object) - This allows ItemGenerationService to iterate over key-value pairs correctly - Fixes empty sublists by allowing item generation to succeed This is a generic fix that works with any parameters hash structure.
When a planning context is complete (has hierarchical_items and generated_items), instead of asking clarifying questions again, offer the user to: 1. Use the existing plan and create the list 2. Clear the context and start fresh This respects chat continuity - users can build on previous work or reset as needed. Flow: - Check if context is complete when user sends a message - If complete, show options (use or clear) - Set state to 'context_reuse' to trigger choice handler - When user responds, parse their choice and act accordingly: - 'use'/'keep': create list from existing context - 'clear'/'fresh'/'start': reset context and show form This is generic - works for any list type or domain.
Improvements to context management: 1. Add /clear command: Users can type '/clear' to reset planning context - Clears hierarchical_items, generated_items, parameters - Shows confirmation message - Ready for fresh planning 2. Show context buttons after list creation: After 'List Created Successfully!' - Display /keep and /clear buttons - Allow users to manage context at natural stopping points - Set state to context_reuse to handle user choice These features give users more control over context lifecycle: - Explicit /clear command for any time - Implicit buttons after natural completion points (/keep or /clear) This is generic - works for any list type or domain.
When users type '/', the command popup now includes /clear in the suggestions.
Changes:
- Added { command: "/clear", description: "Clear planning context" } to base_suggestions
- Appears in the / command popup alongside /search, /browse, /help
- Generic - users can now discover and use the /clear command naturally
Now when users type '/' they'll see /clear as an available command.
…d fix crash CRITICAL FIX: - Fixed live crash when showing "keep/clear context" buttons after list creation - Invalid state enum value `context_reuse` replaced with `post_creation_mode` boolean - System no longer crashes when handling context reuse choice ARCHITECTURE IMPROVEMENTS: - Unified single clean flow: removed overlapping dual parallel flows - Deleted ~1000 lines of legacy metadata-based planning code - New ChatContext AR model: persistent conversation state with crash recovery - Separated ChatUIContext: plain Ruby per-request UI configuration MODEL CHANGES: - NEW: ChatContext AR model with state machine (initial → pre_creation → resource_creation → completed) - NEW: ChatUIContext class for per-request UI config (renamed from plain Ruby ChatContext) - REMOVED: PlanningContext model (replaced by ChatContext) - Added crash recovery fields: post_creation_mode, last_activity_at, recovery_checkpoint SERVICE CHANGES: - Renamed: PlanningContextHandler → ChatContextHandler - Renamed: PlanningContextToListService → ChatContextToListService - Deleted: ListComplexityDetectorService (superseded by CombinedIntentComplexityService) - Deleted: 11 legacy planning methods from ChatCompletionService (~1000 lines) IMPACT: - Simple requests now skip pre-creation planning form and create directly - Complex requests properly show clarifying questions via new ChatContext flow - No more confusion from parallel overlapping code paths - All syntax verified, architecture clean and maintainable MIGRATION: - New migration: create_chat_contexts table with all planning state columns - Removed old planning_contexts migration (development cleanup) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…ntext naming - Add explicit type declaration for Chat status enum (required for Rails 7+) - Rename ChatUIContext to ChatUiContext for Rails naming conventions - Update all references in chat.rb, pre_creation_planning_job.rb, and chat_completion_service.rb - Update annotated schema information This resolves migration error: "Undeclared attribute type for enum 'status' in Chat" Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
All Chat model method calls to build_context have been updated to build_ui_context to reflect the refactored ChatContext architecture where: - build_ui_context: returns ChatUIContext (per-request UI config) - chat_context: returns ChatContext AR model (persistent conversation state) Fixes NoMethodError in: - dashboard_controller.rb - chats_controller.rb - process_chat_message_job.rb - list_refinement_job.rb - application_controller.rb Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The /clear command was defined in ChatUIContext suggestions but was missing from the JavaScript command palette that shows when user types /. Added /clear button to the hardcoded command palette in unified_chat_controller.js between /browse and /help commands. Fixes issue where /clear command was not visible in the UI despite being available in the suggestion list. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Changed @chat.planning_context to @chat.chat_context in the ChatsController handle_clear_command method to match the refactored architecture. Fixes NoMethodError when /clear command is executed. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…AR model refactor Updated documentation to align with the unified chat flow refactoring: - Replaced all PlanningContext references with ChatContext AR model - Updated state machine to reflect new states: initial → pre_creation → resource_creation → completed - Added post_creation_mode field documentation for context reuse - Updated database schema to include crash recovery fields (last_activity_at, recovery_checkpoint) - Removed references to deleted services (PlanningContextDetector, ParentRequirementsAnalyzer, etc.) - Updated Key Services section to show CombinedIntentComplexityService, ListRefinementService, ChatContextToListService - Removed pending states from chat.metadata, now stored in ChatContext AR model - Updated Phase descriptions to reflect actual flow - Removed references to deleted methods (extract_planning_parameters_from_answers, enrich_list_structure_with_planning, etc.) - Updated Common Patterns to use chat_context instead of planning_context - Fixed services reference to use ChatContextHandler instead of old handlers - Updated debugging section to query ChatContext AR model instead of metadata Documentation now accurately reflects the refactored architecture where: - ChatContext (AR Model) tracks persistent planning state - ChatUIContext (Plain Ruby) provides per-request UI configuration - CombinedIntentComplexityService is the single routing point - No more dual flows - metadata-based flow completely removed Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated call flow to reference ChatContextToListService instead of deleted enrich_list_structure_with_planning - Clarified that planning_context parameter comes from chat_context.parameters - Updated integration points to show where ItemGenerationService is called in the refactored flow - Added note that items are stored in chat_context.generated_items for each subdivision - Added more subdivision type examples (modules, sprints, chapters, books) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated ItemGenerationService example to clarify planning_context comes from chat_context.parameters - Updated view template renders to use chat_context instead of planning_context - Replaced outdated migration commands with actual database setup instructions - Updated test commands to reflect new ChatContext AR model files - Removed references to non-existent rake migration tasks All documentation now reflects the ChatContext AR model architecture. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…ntentComplexityService Problem: Requests like "I'm looking for 5 books to become a better manager" were being incorrectly classified as general_question instead of create_list, causing the LLM to generate a JSON response that was displayed as raw code instead of creating actual lists. Solution: - Added explicit examples of create_list intent patterns: "I need X books", "I'm looking for", "give me a list of", etc. - Improved complexity detection rules to recognize that explicit quantities (e.g., "5 books", "3 recipes") indicate sufficient scope - Added concrete examples showing requests that should NOT be marked complex: "5 books to become manager", "3 recipes for weeknight dinners", etc. Now "I'm looking for 5 books to become a better manager" will correctly be detected as: - intent: create_list (not general_question) - is_complex: false (because quantity and purpose are explicit) - This triggers the simple list flow which asks for category and creates lists Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…rocessing Added detailed logging to trace where JSON structure is being generated: - Log extracted answers to catch malformed LLM responses - Add safety check: if answers contain "createlist" or "nestedlists", use raw content instead - Log failures in item generation and list creation for debugging - Better error messages instead of returning raw JSON This helps identify at which stage the JSON structure is being created instead of being processed into actual list database records. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…d as messages Added failsafes in auto_create_list_from_planning: - Verify hierarchical_items exist before attempting to create list - Check list_result.success? before proceeding - Return proper error messages instead of raw JSON - Add logging for all failure cases - Catch exceptions and return user-friendly error instead of structure This prevents the situation where JSON structure gets displayed to user instead of a success/error message. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated /clear command description: "planning context" → "chat context" (reflects new ChatContext AR model) - Updated ITEM_GENERATION.md: RubyLLM version 1.11+ → 1.14+ (current requirement) Minor terminology and version fixes from the ChatContext refactoring work. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The code was trying to create ChatContext with intent_confidence field, but the database column didn't exist, causing: ActiveModel::UnknownAttributeError - unknown attribute 'intent_confidence' for ChatContext Added migration to create the column and updated model annotations. This field tracks the confidence score (0.0-1.0) for intent detection, useful for debugging and monitoring intent classification accuracy. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit fixes critical issues in the list creation flow: 1. **Fixed class reference error**: Updated ChatCompletionService to use ChatContextToListService instead of non-existent PlanningContextToListService 2. **Fixed ChatContext usage**: Replaced parent_requirements attribute access with hierarchical_items (which ChatContext actually has) 3. **Fixed empty list issue**: Simple list creation now generates items using ItemGenerationService instead of creating empty lists - Previously: "5 books to become a better manager" → list with 0 items - Now: Intelligently generates book recommendations based on request 4. **Updated factories and specs**: Migrated planning_context factory to chat_context with backward compatibility alias 5. **Fixed confirmation message**: Switched from broken template to simple text message to provide user feedback These changes ensure simple list requests are properly fulfilled with generated items rather than creating empty lists. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Wrap theme console helpers in guard clause to prevent re-declaration when Turbo navigates. Fixes "Identifier 'htmlElement' has already been declared" error on sign_in and other pages. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add missing gems: ruby_llm-schema, jwt, csv, rack-mini-profiler, stackprof, prosopite, memory_profiler, simplecov, pundit-matchers - Update JS package versions: Tailwind 4.2.4, Turbo 8.0.23, marked 17.0.6, sortablejs 1.15.7 - Remove outdated ProseMirror section (not installed) - Add notes on solid_queue async branch and performance profiling setup - Correct dependency statistics (55+ gems, 11 JS packages) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Migrate all card-based views from hardcoded Tailwind colors to design tokens for theme consistency: - Dashboard recommendations & nudges: new .recommendation-card CSS classes with design token colors, progress bars, badges, and empty states - Kanban boards (list + dashboard): .kanban-column and .kanban-card classes with status indicators, priority/status badges, and action buttons - Dashboard board view: title typography (.t-display-s), view toggle buttons, status indicator badges (.status-indicator with draft/active/completed/archived) - Dashboard items kanban: full redesign with .kanban-card and .kanban-column reusable styling - Connector accounts: .connector-card classes, status badges, action buttons - Connector services: available services grid using same .connector-card pattern All views now use CSS variables (--color-*, --radius-*, --duration-*) for automatic theme switching and easier future theme additions. No inline color styles remaining. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Migrate agent detail page from hardcoded Tailwind colors to design tokens: - Page layout: .agent-section for all white cards - Agent header: .t-display-s title, .btn classes for actions - Stats grid: .agent-stats with .agent-stat and colored .agent-stat-value - Invoke form: .agent-invoke-form with design token colors and focus states - Parameters: .agent-param-list and .agent-param for code blocks - Instructions: .agent-instructions for monospace code display - Trigger config: .agent-trigger-config/.agent-trigger-row/.agent-trigger-badge with variant classes (manual/event/schedule) - Pre-run questions: .agent-question-list and .agent-question cards - Auto-loaded context: .agent-context-list with icon styling - Similar agents: .agent-similar-item with reusable card pattern - Recent runs: .agent-run-item with pill badges for status colors All components use CSS variables for theme consistency. Replaced all inline color classes (bg-blue-100, text-gray-600, etc.) with design tokens. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- edit.html.erb: Use .t-display-s for page title - new.html.erb: Use .t-display-s for page title - my_agents.html.erb: Use .t-display-s title, .t-ink-muted subtitle, .btn classes, design token colors for empty state card Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Empty string in ternary operator within HTML attribute was causing ERB compiler parsing failures. Changed fallback to ' hidden' (space + class) to resolve syntax error. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Multi-line form_with with hash parameter and block syntax was causing ERB compiler parsing errors. Single-line format resolves the issue. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
form_with with block captures its own output, so <% ... %> is correct instead of <%= ... %>. Resolves ERB compiler parsing errors with the block syntax. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- new.html.erb: Use .card class, .t-display-m title, .text-ink-muted subtitle - edit.html.erb: Same styling updates as new view Form already uses design system (.alert, .form-label, .form-input, .btn, etc.) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 324 lines of notification component CSS classes (.notification-bell-button, .notification-badge, .notification-dropdown, .notification-preview, .notification-item, etc.) using design tokens for full theme support - Refactor notification bell dropdown and preview items to use semantic CSS classes - Update full notification view to use new component classes for consistent styling - Fix agent form tab management: replace hidden class with active class for better CSS control - Clean up indentation in agent execution service
- Update header to use .card, .t-display-s, and .text-ink classes - Replace button styling with .btn-primary - Update filter section to use .card and design system form classes - Replace list container with .card class - Update empty state to use design tokens (.text-ink-faint, .text-ink-muted) - Add standalone .form-label, .form-input, .form-select classes for flexible form styling - Replace hardcoded gray/blue colors throughout with semantic utility classes
Replace inline button styling with .btn .btn-primary classes to ensure proper text contrast on hover. The design system button has improved contrast by changing text color to surface color on hover, making text readable on the accent background.
…ment' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ment' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ment' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.