Skip to content

Extract SSE transport and API error formatting from chat store#485

Merged
Zochory merged 4 commits intodevfrom
codex/refactor-sse-transport-and-error-handling
Dec 23, 2025
Merged

Extract SSE transport and API error formatting from chat store#485
Zochory merged 4 commits intodevfrom
codex/refactor-sse-transport-and-error-handling

Conversation

@Zochory
Copy link
Member

@Zochory Zochory commented Dec 23, 2025

Motivation

  • Keep the chat store focused on state updates and remove transport/event wiring from it.
  • Centralize SSE callback handling to make streaming behavior reusable and easier to maintain.
  • Standardize API error parsing so UI layers consume a consistent error shape.
  • Improve testability and reusability by moving responsibilities into dedicated helpers.

Description

  • Added src/frontend/src/api/error.ts which implements formatApiError and a FormattedApiError shape for consistent UI consumption.
  • Added src/frontend/src/stores/chat-transport.ts which implements startChatTransport and encapsulates SSE callback wiring and connect logic.
  • Updated src/frontend/src/stores/chatStore.ts to delegate SSE setup to startChatTransport and to use formatApiError instead of inline ApiRequestError parsing.
  • Exported the new formatter from the API index by updating src/frontend/src/api/index.ts to expose formatApiError.

Testing

  • No automated tests were executed as part of this change.
  • No frontend unit tests (make test-frontend / Vitest) were run.
  • No type checks (make type-check) or linters (make lint) were executed.
  • Manual smoke runs were not recorded in this rollout transcript.

Codex Task

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/refactor-sse-transport-and-error-handling

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Zochory, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the frontend chat functionality by separating concerns related to SSE communication and API error handling. The primary goal is to improve the maintainability, testability, and reusability of these components by moving them into dedicated modules, thereby allowing the core chat store to focus solely on state management and updates. This change standardizes error presentation and streamlines the SSE connection process.

Highlights

  • SSE Transport Extraction: The Server-Sent Events (SSE) transport logic, including callback handling and connection management, has been extracted from chatStore.ts into a new dedicated module chat-transport.ts. This centralizes SSE behavior, making it more reusable and easier to maintain.
  • Standardized API Error Formatting: A new utility formatApiError and FormattedApiError interface have been introduced in api/error.ts to standardize how API errors are parsed and presented to the UI. This ensures a consistent error shape across the frontend.
  • Chat Store Refactoring: The chatStore.ts has been refactored to delegate SSE setup to the new startChatTransport function and to utilize the new formatApiError for API error handling, reducing its responsibilities and improving focus on state updates.
  • API Index Export: The new formatApiError function and FormattedApiError type are now exported from api/index.ts, making them readily available for use across the frontend application.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively refactors the chat store by extracting SSE transport logic and API error formatting into dedicated modules. This significantly improves the separation of concerns, making the code more modular, reusable, and easier to maintain. The introduction of formatApiError standardizes error handling, and startChatTransport cleanly encapsulates SSE connection management. My feedback includes a few suggestions to enhance the robustness of the new error formatting and to address a fragile polling mechanism.

Comment on lines 72 to 87
setTimeout(() => {
const { conversationId: activeConversationId } = get();
if (activeConversationId) {
void conversationsApi
.getMessages(activeConversationId)
.then((updatedMessages) => {
set({ messages: updatedMessages });
})
.catch((err) => {
console.debug(
"Failed to refresh messages for quality scores:",
err,
);
});
}
}, 2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using a fixed setTimeout to poll for updates is fragile and can lead to race conditions. The 2-second delay might not be sufficient if the background evaluation takes longer, and it's an unnecessary delay if it's faster. A more robust solution would be for the backend to send a specific event (e.g., quality_scores_ready) via SSE when the evaluation is complete. This would allow the frontend to refetch messages immediately and reliably. While this may require backend changes and be out of scope for this PR, it's worth noting for future improvement.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
@github-project-automation github-project-automation bot moved this from Backlog to In review in AgenticFleet Dec 23, 2025
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
@Zochory Zochory merged commit 230d8ce into dev Dec 23, 2025
8 of 9 checks passed
@Zochory Zochory deleted the codex/refactor-sse-transport-and-error-handling branch December 23, 2025 21:51
@github-project-automation github-project-automation bot moved this from In review to Done in AgenticFleet Dec 23, 2025
Zochory added a commit that referenced this pull request Dec 29, 2025
* conductor(setup): Add conductor set up files

* conductor(setup): Add plan.md

* fix(tests): Update mapping handler tests for modular architecture

* conductor(plan): Mark task 'Remove utils/agent_framework_shims.py' as complete

* chore: Remove empty deprecated utils/agent_framework directory

* conductor(plan): Mark task 'Clean up deprecated utils/agent_framework' as complete

* chore: verify pre-commit + LFS hooks [skip ci]

* Refactor performance improvement documents:
- Delete PERFORMANCE_IMPROVEMENTS.md and PERFORMANCE_IMPROVEMENTS_SUMMARY.md as they are no longer needed.
- Remove PERFORMANCE_QUICK_START.md since the analysis and fixes have been completed.
- Consolidate performance improvement details into a single summary document for clarity and ease of access.

* chore: update .gitignore to include .factory and .fleet directories

* chore: remove deprecated agent_framework_shims and legacy executors

* feat: add ChatState type and SendMessageOptions interface for chat functionality

style: update Virtuoso component styles for better layout handling

test: refactor App tests to remove unnecessary loadConversations mock

test: enhance ChatMessages tests for better message rendering validation

test: improve ChainOfThoughtTrace tests for accurate field name assertions

test: create component registry tests for component resolution and registration

test: update dashboard-page tests to validate sidebar rendering

test: modify chat-page tests to mock conversation data correctly

test: adjust setup for react-virtuoso to render items synchronously in tests

fix: update createMockConversation to use conversation_id instead of id

fix: enhance render utility to include MemoryRouter for routing context

chore: clean up tsconfig.app.json by removing baseUrl

* feat(docs): Add comprehensive DSPy integration review and update documentation

- Introduced a new document for Workflow DSPy Integration Review detailing the analysis of multi-agent benefits and verification of DSPy usage across workflow phases.
- Updated performance documentation to reflect changes in analysis and optimization recommendations.
- Refactored current plans documentation to align with repository structure and improve navigation.
- Corrected paths in configuration documentation to ensure accuracy and consistency.
- Enhanced user guides and troubleshooting sections to clarify usage of commands and configuration files.
- Improved frontend documentation to emphasize the use of Make for starting services and updated streaming protocols.
- Revised self-improvement and history analysis documentation for clarity and consistency in command usage.

* feat: Refactor agent imports, enhance chat event handling, and add conversation deletion functionality

* feat(tests): Enhance middleware concurrency tests, update conversation model attributes, and add quality score tests for SSE responses

* feat: Update Azure AI model deployment name, enhance conversation storage with JSON file support, and add Langfuse integration utilities

* feat: Enhance background quality evaluation logging, improve task loading with serialization utilities, and add Langfuse evaluation helpers

* Enhance DSPy Reasoner with Signature Access and Dual-Tracing

- Introduced a utility function `_get_predictor_signature` to safely extract signatures from various predictor types, including `ChainOfThought`.
- Modified `get_named_predictors` to ensure signature accessibility for GEPA optimization without altering module structure.
- Implemented dual-tracing in `PredictionMethods` for better telemetry, using `create_dspy_span` alongside existing spans.
- Updated attribute access in prediction methods to handle potential changes in prediction object structures, ensuring backward compatibility.
- Enhanced parsing methods to accept both strings and lists for capabilities and tools, improving flexibility in input handling.
- Adjusted tool context retrieval to utilize a public API for listing available tools, ensuring consistency in tool management.

* feat: Enable completion storage, add checkpoint directory, and integrate Langfuse tracing in workflow execution

* Update workflow configuration and enhance data handling

- Changed the DSPy model from gpt-5.2 to gpt-5-mini for improved performance.
- Enabled dynamic prompt generation in DSPy with detailed configuration.
- Updated agent configurations to use gpt-5-mini and adjusted tool requirements.
- Refactored supervisor examples to improve formatting and consistency in tool requirements.
- Renamed conversation ID attribute for clarity in the Conversation model.
- Improved execution history loading by utilizing dedicated serialization functions for JSON and JSONL formats.

* feat: Update Langfuse configuration for improved tracing and observability; refactor TavilySearchTool to handle missing API key gracefully

* feat: Enhance observability and Langfuse integration

- Initialize Langfuse and DSPy instrumentation early in lifespan.py for native tracing.
- Update middleware.py to allow execution data to be None.
- Add observability routes in observability.py for fetching and listing traces.
- Integrate Langfuse tracing in chat.py, workflows.py, and agents.py routes.
- Introduce history management improvements in history.py and optimization.py.
- Add delete conversation endpoint in conversations.py.
- Refactor DSPy service dependency injection in dspy.py.
- Improve error handling and logging across various routes.

* feat: Refactor logging of stream events for improved readability and maintainability

* feat: Implement SSE API for handling streaming workflows and responses

* Refactor SSE API requests to shared HTTP client and centralize stream prefix (#484)

* Refactor SSE API calls

* Update src/frontend/src/api/client.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/frontend/src/api/client.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

---------

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* feat: Introduce error formatting utility and enhance chat transport handling

* feat: Enhance response formatting and error handling in chat helpers and optimization service

* fix: Correct file path references for workflow configuration in documentation

* feat: Refactor logging specifications for stream events and enhance log formatting

* Refactor stream event logging map (#487)

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Extract SSE transport and API error formatting from chat store (#485)

* Refactor chat SSE transport helpers

* Update src/frontend/src/api/error.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/frontend/src/stores/chat-transport.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

---------

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Add _has_messages helper and simplify _thread_has_any_messages (#486)

* Refactor thread message checks

* Update src/agentic_fleet/services/chat_helpers.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

---------

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* chore: Remove changelog tracker scripts and related documentation

* Remove obsolete tests and snapshots for component registry, optimization dashboard, chat page, and dashboard page

* Refactor code structure for improved readability and maintainability

* feat: Enhance DSPy modules and add MCP configuration

Backend improvements:
- Improve typed signature handling in DSPy reasoner with _build_typed_predictor()
- Add _extract_from_decision() helper for consistent decision extraction
- Move log_specs inside _log_stream_event() for better encapsulation
- Add new stream event types: ORCHESTRATOR_MESSAGE, AGENT_START, AGENT_COMPLETE,
  CANCELLED, DONE, CONNECTED, HEARTBEAT
- Fix lint error in chat_helpers.py (simplify conditional return)

Tooling:
- Add .mcp.json for Model Context Protocol server configuration
- Update .gitignore with .skills/ and test-results/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: Add frontend documentation

Add comprehensive frontend documentation:
- AGENTS.md: Frontend-specific agent guidelines
- MIGRATION_SUMMARY.md: Guide for migrating to feature-based architecture
- REGISTRIES.md: Component registry documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: Add app shell with React Router 7

Add new application entry point with React Router 7:
- App.tsx: Main application shell with routing
- main.tsx: Application entry point
- providers.tsx: React providers (Query, Router, Theme)
- index.css: Global styles entry
- styles/*: Modular CSS (variables, theme, animations, sidebar, utilities)

This creates the foundation for the feature-based architecture with
client-side routing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: Implement feature-based architecture

Migrate from component-based to feature-based organization:

Chat Feature (src/frontend/src/features/chat/):
- ChatPage.tsx: Main chat interface
- components/*: 16 chat-specific components (messages, input, reasoning, etc.)
- hooks/*: usePromptInput hook
- stores/*: Zustand stores for chat state and transport

Dashboard Feature (src/frontend/src/features/dashboard/):
- DashboardPage.tsx: Optimization dashboard
- components/*: Dashboard UI components
- hooks/*: useOptimizationDashboard hook

Layout Feature (src/frontend/src/features/layout/):
- components/*: Shared layout components (header, sidebars, panel)
- hooks/*: Layout-related hooks

Workflow Feature (src/frontend/src/features/workflow/):
- components/*: Workflow visualization components
- lib/*: Workflow utilities

This follows modern React patterns with features organized by domain
rather than component type, improving maintainability and discoverability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: Add E2E testing with Playwright

Add comprehensive end-to-end testing infrastructure:

E2E Tests (src/frontend/e2e/):
- chat.spec.ts: Chat flow tests
- dashboard.spec.ts: Dashboard flow tests

Configuration:
- playwright.config.ts: Playwright configuration for E2E tests

Feature Tests (src/frontend/src/tests/features/):
- chat/*: Chat component tests (messages, markdown, prompt-input, reasoning)
- dashboard/*: Dashboard component tests
- workflow/*: Workflow component tests (chain-of-thought, component-registry)

Enables automated testing of critical user flows and component behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Potential fix for code scanning alert no. 171: Log Injection

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Potential fix for pull request finding 'Variable defined multiple times'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Fix code review issues from PR #494: security vulnerabilities and unused variables (#495)

* Initial plan

* Fix code review issues from PR #494

- Remove duplicate lines in .gitignore
- Fix log injection vulnerability in observability.py by sanitizing workflow_id
- Remove unused conversation_id variable assignments
- Remove all unused _LANGFUSE_AVAILABLE global variables
- Replace global _fallback_warning_emitted with function attribute
- Add logging to empty except clause in compiler.py

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Improve log injection sanitization with comprehensive regex approach

- Add sanitize_for_logging helper that removes all control characters
- Use consistent sanitization for both workflow_id and exception messages
- Prevents injection through newlines, tabs, null bytes, and other control chars

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Refine log injection sanitization

- Add None-safe handling in sanitize_for_logging
- Simplify regex pattern (CR/LF already covered by \x00-\x1f range)
- Add comprehensive comments explaining the sanitization

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Fix CI workflow issues: lint, format, and type check

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* fix: test failures, remove react-markdown dependency

- Add missing improvementApi.trigger() with deprecation warning
- Fix App.test.tsx import path from @/root/App to @/app/App
- Fix SSE test expectation for reconnection status ("connecting")
- Fix MessageContent to apply whitespace-pre-wrap for streaming markdown
- Add StreamingMarkdown mocks to bypass requestAnimationFrame in jsdom tests
- Remove react-markdown dependency, use streamdown Components type
- Fix right-panel width (12rem -> 14rem) and OptimizationDashboard styling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* style: apply prettier formatting to UI components

- Format imports with multi-line style for consistency
- Add trailing commas where needed
- Minor style adjustments per prettier rules

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Potential fix for pull request finding 'Empty except'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Potential fix for code scanning alert no. 172: Log Injection

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* refactor: use standard Tailwind max-w class

Replace max-w-[264px] with max-w-66 (equivalent value)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Potential fix for pull request finding 'Empty except'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* fix: make workflow lib import explicit for CI compatibility

Change export * from "./lib" to "./lib/index" to avoid potential
module resolution issues in CI environments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: Remove react-markdown dependency and replace with streamdown; update related components

* fix: add type cast to resolve possibly-missing-attribute warning

- Cast formatter to str after callable check in _format_log_line
- Update ci-doctor.lock.yml with safe output directory creation

* style: format and clean up ci-doctor.lock.yml for consistency

* fix(ci-doctor): simplify engine config and fix permissions

* style: clean up ci-doctor.lock.yml for consistency and readability

* fix(ci-doctor): remove manual permission fix and simplify engine

* fix(ci-doctor): use chown to fix workspace permissions for agent

* feat(ci-doctor): try openai engine to bypass copilot path issues

* fix(ci-doctor): revert to copilot engine and improve permission fix

* feat(ci-doctor): try codex engine

* fix(ci-doctor): enhance failure reporting details in workflow documentation

* Refactor Q workflow documentation: streamline steps, enhance clarity, and update tool references

* Update src/agentic_fleet/workflows/initialization.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/utils/serialization.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/services/optimization_service.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/api/middleware.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/utils/storage/conversation.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/services/optimization_service.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Update src/agentic_fleet/api/middleware.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Address code review feedback from PR #494 (#497)

* Initial plan

* fix: backward compatibility, performance, and config improvements

- Add Pydantic alias for backward compatibility (id → conversation_id)
- Cache Langfuse auth_check() to reduce latency on client creation
- Remove unused react plugin from ESLint config
- Change enable_completion_storage default to False for privacy/storage

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* refactor: improve code quality and maintainability

- Refactor _format_log_line to use only callable interface (eliminates dual interface pattern)
- Fix singleton race condition in DSPyManager initialization
- Extract max_iterations logic to _resolve_optimization_budget helper function in GEPA optimizer

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* refactor: improve robustness and code clarity

- Replace fragile Langfuse SDK dict()/vars() with explicit field extraction
- Add context manager for warning filter to ensure cleanup
- Document load_jsonl efficiency with deque sliding window
- Simplify ResponseState by removing redundant response_delta_text field

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* fix: revert breaking changes from code review

- Restore react plugin in ESLint config (needed for react/* rules)
- Restore response_delta_text field (used by websocket implementation)
- Add comment explaining why both fields are needed

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Apply code quality improvements from PR review thread (#498)

* Initial plan

* Remove unused React plugin from eslint config

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Cache auth_check() result to avoid repeated authentication calls

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Simplify formatter parameter to callable-only interface

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Fix singleton pattern race condition with simplified locking

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Extract nested conditional logic into helper function

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Improve Langfuse object serialization with explicit safe attribute handling

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

* Add thread-safety to Langfuse auth check cache

Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>

---------

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Zochory <60674042+Zochory@users.noreply.github.com>
Co-authored-by: Zachary BENSALEM <zachary@qredence.ai>

* delete: remove deprecated create_db_tables script due to module removal

* fix(observability): update TraceDetails model configuration to use ConfigDict for field population

* refactor(observability): improve trace response structure for maintainability

refactor(optimizer): remove redundant contextlib import

refactor(chat_helpers): update function parameters for clarity

fix(conversation): correct conversation ID assignment in create_conversation

fix(storage): simplify conversation key retrieval in upsert method

refactor(execution): clean up whitespace in create_openai_client_with_store

* refactor(markdown): enhance component props typing for better type safety

* refactor(chat): implement memoized components for user and assistant messages

* refactor(api): move query keys to a separate file and update imports

* docs: update current plans with additional details and progress on documentation refactor

- Updated the date for the Docs Refactor Pass to reflect the start and update dates.
- Added a new goal to consolidate tracing documentation into a single source of truth.
- Documented progress on developer and user docs, including normalization of config paths and consolidation of tracing guides.
- Changed the status of the Frontend Restructure Design to "Mostly Completed" and updated remaining work items.
- Highlighted performance optimizations and code splitting implementations in the frontend restructure.

* fix(frontend): ensure workflow/lib is tracked

Resolves build failure where src/features/workflow/lib/index.ts was missing
because it was inadvertantly ignored by the global lib/ .gitignore rule.

- Updated .gitignore to explicitly un-ignore src/frontend/src/features/workflow/lib/
- Added src/frontend/src/features/workflow/lib/ content

* Potential fix for pull request finding 'Unused local variable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>

* Add analysis scripts for Python code quality and refactor observability routes

- Introduced `analyze_imports.py` to analyze import statements and detect potential utility function reimplementations.
- Added `complexity_analyzer.py` to evaluate cyclomatic complexity, nesting depth, and function length.
- Implemented `concurrency_analyzer.py` to identify concurrency issues in async code, including shared state mutations.
- Created `detect_duplicates.py` to find duplicate code blocks across Python files using AST analysis.
- Updated `.gitignore` to exclude new analysis scripts.
- Refactored observability routes in `observability.py` for improved serialization handling.
- Enhanced `optimizer.py` to log warnings for unsupported parameters in GEPA.
- Adjusted `manager.py` to ensure proper initialization flag setting.
- Improved logging in `langfuse_eval.py` for trace not found scenarios.
- Added reconnection logic in `sse.ts` for handling connection timeouts.

* feat(logging): add debug log for missing analysis data in handle_analysis_message
refactor(chat): remove unused _format_orchestrator_message function
fix(conversation): simplify conversation upsert method by directly accessing conversation_id
refactor(execution): remove global variable _langfuse_auth_checked for cleaner code

* feat(gitignore): add .conductor/ to ignore list

---------

Signed-off-by: Zachary BENSALEM <zachary@qredence.ai>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Zochory Zochory mentioned this pull request Dec 29, 2025
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Comments