Skip to content

Full-Stack: Implement 'Deep-Dive Analysis' Button #246

Closed

Description

@integry

This task re-implements the manual analysis button, but as a "Deep-Dive" feature that uses the advanced configurable model (e.g., Opus).

Frontend:

  1. UI: In 'gitfix-ui/src/components/TaskDetails.tsx', add a "Run Deep-Dive Analysis" button.
  2. State: Add state for 'deepDiveAnalysis' and 'deepDiveLoading'.
  3. API: In 'gitfix-ui/src/api/gitfixApi.js', add a 'generateDeepDiveAnalysis(taskId)' function that 'POST's to a new endpoint.
  4. Display: Show the result in a modal or a separate collapsible section.

Backend:

  1. API: In 'packages/dashboard/server.js', add a new 'POST /api/task/:taskId/deep-dive-analysis' endpoint.
  2. Logic: This endpoint will synchronously (from the user's perspective) perform the exact same logic as the 'analysis_worker.js':
    a. Fetch logs and prompt.
    b. Load the advanced analysis model from config.
    c. Call the lightweight LLM service.
    d. Return the report directly as JSON (do not save it, or perhaps save it to a different column 'deep_dive_report').

Activity

  1. integry commented on Nov 14, 2025

    @integry
    OwnerAuthor

    Suggested Implementation

    1. 'packages/dashboard/server.js'

    // ... after /api/task/:taskId/analysis endpoint
    import { getExecutionAnalysis } from '../../src/services/analysisService.js'; // Assuming it's moved
    import { loadSettings } from '../../src/config/configRepoManager.js';
    
    app.post('/api/task/:taskId/deep-dive-analysis', ensureAuthenticated, async (req, res) => {
      if (!isDbEnabled || !db) {
        return res.status(503).json({ error: 'Database persistence is not enabled.' });
      }
    
      try {
        const { taskId } = req.params;
    
        // 1. Find the latest execution
        const latestExecution = await db('llm_executions')
          .where({ task_id: taskId })
          .orderBy('start_time', 'desc')
          .first('execution_id', 'session_id');
    
        if (!latestExecution) {
          return res.status(404).json({ error: 'No execution data found.' });
        }
    
        // 2. Load the advanced model from config
        const settings = await loadSettings();
        const advancedModel = settings.analysis_model_advanced || 'claude-opus-4-20250514';
    
        // 3. Run the analysis
        // NOTE: This assumes 'getExecutionAnalysis' is available to the dashboard server.
        // This may require moving 'analysisService.js' to a shared location,
        // or adding the Anthropic SDK and DB logic directly here.
        const analysisReport = await getExecutionAnalysis({
          executionId: latestExecution.execution_id,
          sessionId: latestExecution.session_id,
          correlationId: req.user.username, // Use user's ID for this manual request
          model: advancedModel,
        });
    
        // 4. Return the report
        res.json({ analysis: analysisReport });
      
      } catch (error) {
        console.error('Error in /api/task/:taskId/deep-dive-analysis:', error);
        res.status(500).json({ error: 'Internal server error' });
      }
    });

    2. 'gitfix-ui/src/api/gitfixApi.js'

    // ... after getTaskAnalysis
    export const generateDeepDiveAnalysis = async (taskId) => {
      const response = await fetch(`${API_BASE_URL}/api/task/${taskId}/deep-dive-analysis`, {
        method: 'POST',
        credentials: 'include'
      });
      await handleApiResponse(response);
      return response.json();
    };

    3. 'gitfix-ui/src/components/TaskDetails.tsx'

    (This will require adding a new button, a 'handleDeepDive' click handler, and a new modal/state to display the 'deepDiveAnalysis' result.)

    // In TaskDetails.tsx
    // ... add new state
    const [deepDiveAnalysis, setDeepDiveAnalysis] = useState<any>(null);
    const [deepDiveLoading, setDeepDiveLoading] = useState<boolean>(false);
    
    // ... add handler
    const handleDeepDive = async () => {
      if (!taskId) return;
      setDeepDiveLoading(true);
      setDeepDiveAnalysis(null);
      try {
        const data = await generateDeepDiveAnalysis(taskId);
        setDeepDiveAnalysis(data.analysis);
      } catch (err) {
        setDeepDiveAnalysis({ error: err.message || 'Failed to run deep-dive analysis.' });
      } finally {
        setDeepDiveLoading(false);
      }
    };
    
    // ... in JSX, add the button
    <button
      onClick={handleDeepDive}
      disabled={deepDiveLoading}
      className="px-3 py-1.5 bg-purple-600 text-white text-sm rounded-md hover:bg-purple-700 transition-colors disabled:bg-gray-300"
    >
      {deepDiveLoading ? 'Analyzing...' : 'Run Deep-Dive Analysis'}
    </button>
    
    // ... in JSX, add a modal or section to display `deepDiveAnalysis`
    {deepDiveAnalysis && (
      <div className="mt-6">
        <h4 className="text-lg font-semibold text-gray-900 mb-4">Deep-Dive Analysis (Advanced Model)</h4>
        <div className="space-y-4 p-4 bg-purple-50 rounded-lg border border-purple-200">
          {/* Render deepDiveAnalysis.report as Markdown */}
        </div>
      </div>
    )}
  2. propr-dev commented on Nov 14, 2025

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude-sonnet-4-5-20250929 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Model: claude-sonnet-4-5-20250929
    • Branch: ai-fix/246-full-stack-implement-deep-20251114-1524-claude-sonnet-4-5-20250929-hd8
    • Base Branch: main
    • Worktree: issue-246-20251114-1524-claude-sonnet-4-5-20250929-hd8
  3. added a commit that references this issue on Nov 14, 2025
  4. added a commit that references this issue on Nov 16, 2025
  5. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions