Skip to content

Conversation

@nullchimp
Copy link
Owner

This pull request introduces several changes across different files to enhance functionality and improve code organization. Key updates include adding a new GitHub Actions workflow for AI-based issue refinement, improving JSON serialization in debugging, and updating the ChatApp UI logic to better manage tool categories and their states.

Workflow Automation:

  • .github/workflows/issue-ai-refinement.yml: Added a new GitHub Actions workflow to refine issue descriptions using AI. The workflow is triggered by comments containing #airefine from the issue creator, and updates the issue with enhanced details, acceptance criteria, and implementation considerations.

Debugging Utilities:

  • src/core/debug_capture.py: Introduced truncate_json_strings to truncate long strings in JSON data and serialize_with_colors to serialize objects with color metadata for debugging. Added recursive handling for lists and dictionaries, improved error handling, and integrated color metadata at the root level.

UI Enhancements:

  • src/ui/chat.ts:
    • Added toolCategoryStates to track the collapse state of tool categories.
    • Improved dynamic rendering of tools, including collapse/expand functionality and counters for enabled tools. Added logging for debugging. [1] [2] [3] [4]
    • Replaced renderTools with updateToolsUI to preserve UI state and ensure accurate updates to tool configurations. [1] [2]

Documentation:

Persists the collapsed/expanded state of tool categories using a dedicated state variable.

This change ensures that the tool categories maintain their state across re-renders, providing a better user experience. Also enhances the UI of the tools section.
Adds a 'source' attribute to tool information objects in both the API session routes and core MCP session tests. This provides a way to track the origin of tools.
Improves debug data serialization by truncating long strings early in the serialization process to prevent excessive memory usage and improve performance.
This change also ensures that truncation is handled consistently between the backend and frontend, improving the display of debug data in the UI, especially for large responses. Specifically, it adds a recursive string truncation function to avoid JSON serialization errors for very large payloads.
Refactors the debug data serialization and colorization logic
to correctly handle nested color metadata.

This ensures that color information is accurately propagated and
displayed for complex data structures in the debug output. The key
path is used to correctly scope the colors in nested structures.
Clarifies the location for tests in the repository's
Copilot instructions.

Refactors the test case for debug capture to check for
color metadata at the data root level with path-based keys
instead of at the payload level.
Implements a GitHub Actions workflow that automatically refines issue descriptions using the GitHub Models API.

The workflow is triggered by a comment containing '#airefine' from the issue creator.

It enhances issue descriptions by adding technical details, context, acceptance criteria, and implementation considerations. It also adds a note to remind contributors to document their work in Confluence.

Includes error handling and reactions to indicate progress.
Copilot AI review requested due to automatic review settings June 25, 2025 21:32
@nullchimp nullchimp merged commit d79e0fc into main Jun 25, 2025
4 checks passed
Copy link

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 bundles multiple enhancements across automation, debugging utilities, UI behavior, and documentation enforcement.

  • Adds a GitHub Actions workflow to automatically refine issue descriptions using AI.
  • Extends debugging utilities with JSON string truncation and color-metadata serialization.
  • Refactors the ChatApp to track collapse/expand state for tool categories and preserve UI state.
  • Updates documentation to enforce that tests reside in the tests folder.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/issue-ai-refinement.yml New workflow triggered on #airefine comments to refine issue bodies via AI
src/core/debug_capture.py Adds truncate_json_strings and serialize_with_colors for color-aware JSON output
src/ui/chat.ts Replaces renderTools with updateToolsUI, tracks toolCategoryStates, adds logging
src/ui/styles.css Refines debug-panel and tool-category styling with transitions and hover effects
tests/test_debug_capture.py Adjusts assertions to verify color metadata keys at the correct JSON root level
tests/test_core_mcp_session.py Adds missing source parameter to tool instantiation in tests
tests/test_api_session_routes.py Includes source field in mocked tool info for session routes tests
.github/copilot-instructions.md Updates instructions to require all tests be placed in the tests folder
Comments suppressed due to low confidence (2)

src/ui/chat.ts:1404

  • This template literal contains unescaped double quotes inside backticks, which will cause a syntax error. Escape the inner quotes or use single quotes for the span tags.
                return `"<span class="debug-color-white">${this.escapeHtml(mainText)}</span><span class="debug-truncated">...[truncated]</span>"`;

src/ui/chat.ts:1419

  • Similar to the previous case, this backtick string uses unescaped double quotes inside. Escape these quotes or switch to single quotes to avoid breaking the code.
                    return `${indent}  "<span class="debug-color-white">${this.escapeHtml(mainText)}</span><span class="debug-truncated">...[truncated]</span>"`;

}

private renderTools(): void {
console.log('renderTools() called');
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Multiple console.log statements have been added for debugging. Consider removing or replacing them with a configurable logging utility before merging to avoid unnecessary noise in production.

Copilot uses AI. Check for mistakes.
return False

try:
def truncate_json_strings(obj: Any, max_string_length: int = 100) -> Any:
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Project guidelines discourage adding docstrings unless absolutely necessary. The function name and type hints are self-explanatory, so remove the docstring to comply with guideline 1000000.

Copilot generated this review using guidance from repository custom instructions.

return obj

def serialize_with_colors(obj: Any, max_len: int, key_path: str = "") -> tuple[Any, dict]:
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

A docstring was added here but per guideline 1000000, avoid docstrings unless critically needed. The signature and naming already convey purpose.

Copilot generated this review using guidance from repository custom instructions.
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