Skip to content

Feature/usage fix#10

Merged
qchapp merged 4 commits into
developfrom
feature/usage-fix
Nov 19, 2025
Merged

Feature/usage fix#10
qchapp merged 4 commits into
developfrom
feature/usage-fix

Conversation

@qchapp
Copy link
Copy Markdown
Member

@qchapp qchapp commented Nov 12, 2025

This pull request simplifies the agent pipeline and UI state management by removing legacy code paths, dead functions, and complex intent detection logic. The agent now relies on conversation history for understanding follow-up requests, and all tool exclusion logic is centralized and passed through the agent state. Several outdated tests and unused state variables have also been removed. These changes improve maintainability, reduce code complexity, and enhance the agent's ability to handle alternative tool requests naturally.

Agent and UI simplification:

  • Removed complex refine intent detection system and dead code paths, including legacy UI logic and the recommend_and_link() method in api/pipeline.py, consolidating all tool selection through the agent. [1] [2] [3]
  • Simplified UI handler by reducing the number of parameters in handle_message() and eliminating tracking for last_task_state, last_suggestions_state, and excluded_names.
  • Removed USE_AGENT conditional, ensuring the agent-based pipeline is always used.

State and exclusion management improvements:

  • Centralized tool exclusion logic by adding excluded_tools to AgentState, merging explicit exclusions with agent state, and ensuring exclusions are correctly passed and logged. [1] [2] [3]
  • All recommended tools are now automatically added to the exclusion list (banlist) and properly passed to the agent, ensuring follow-up requests for alternatives return different tools. [1] [2]

Legacy code and test cleanup:

  • Removed dead functions (is_refine_intent(), strip_refine_keywords(), _REFINE_KEYWORDS) from utils/tags.py, _load_catalog() function, and outdated tests such as tests/full_test.py.
  • Removed legacy imports, unused classes, and methods from api/pipeline.py, further streamlining the codebase. [1] [2] [3]

Bug fixes and UX improvements:

  • Agent now properly maintains conversation history, enabling natural understanding of follow-up requests like "show me alternatives". [1] [2] [3]
  • Disabled the clear button during processing to prevent race conditions, and fixed history table logging so only primary requests with files are logged, avoiding duplicates.

References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies the agent pipeline and UI state management by removing legacy code paths, refine intent detection, and complex state tracking. The agent now relies on conversation history for natural follow-up handling, and tool exclusion logic is centralized through AgentState.

Key changes:

  • Removed complex refine intent detection system and associated legacy functions (is_refine_intent(), strip_refine_keywords(), _REFINE_KEYWORDS)
  • Simplified UI state by removing 3 state variables (last_task_state, last_suggestions_state, excluded_names) and reducing handler parameters from 8 to 6
  • Centralized tool exclusion through AgentState.excluded_tools field, ensuring follow-up requests properly exclude already-recommended tools

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/full_test.py Removed entire legacy test file that only tested the deprecated recommend_and_link() method
src/ai_agent/utils/utils.py Fixed URL extraction to safely handle both list and string URL formats
src/ai_agent/utils/tags.py Removed dead refine intent detection functions (is_refine_intent(), strip_refine_keywords()) and constants
src/ai_agent/ui/app.py Major simplification: removed refine logic, legacy state tracking, and USE_AGENT conditional; added conversation history support and proper clear button handling
src/ai_agent/retriever/software_doc.py Removed dead code from field validator
src/ai_agent/generator/generator.py Removed unused re import
src/ai_agent/catalog/sync.py Comment documenting removed unused function
src/ai_agent/api/pipeline.py Removed legacy recommend_and_link() method (~180 lines) and associated imports/logic that are now handled by the agent
src/ai_agent/agent/utils.py Added excluded_tools field to AgentState for centralized exclusion management
src/ai_agent/agent/agent.py Updated agent to merge explicit exclusions with state exclusions and properly log them; added conversation history parameter to run_agent()
CHANGELOG.md Documented all changes following Keep a Changelog format

Comment thread CHANGELOG.md
Comment thread CHANGELOG.md
Comment thread src/ai_agent/agent/utils.py
Comment thread src/ai_agent/ui/app.py
@qchapp qchapp merged commit f5971b3 into develop Nov 19, 2025
8 checks passed
@qchapp qchapp deleted the feature/usage-fix branch November 19, 2025 19:04
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.

2 participants