feat(config): improve config hot reload handling and introduce mock sse endpoint for ui testing as not all providers support prompt caching - #814
Conversation
…se endpoint for ui testing as not all providers support prompt caching
The changes in this commit improve the handling of configuration hot reloading in the `config_hot_reload.py` module. Specifically:
- The `EnvironmentSettings` import is now wrapped in a conditional block to avoid circular imports.
- The `settings` parameter in the `_model_factory.build()` call is now properly handled, falling back to creating a new `EnvironmentSettings` instance if `settings` is `None`.
These changes help ensure the configuration hot reload functionality works as expected and avoids potential issues with circular imports.
feat(experiments): add mock SSE server
This commit introduces a new standalone FastAPI application in the `experiments` directory that provides a mock Server-Sent Events (SSE) server. The purpose of this mock server is to replay events from a captured log file (`docs/sse-agent-results.txt`) to enable UI/development testing without running the full agent pipeline or external services.
The key features of the mock SSE server include:
- Parsing the reference SSE log file and caching the events in memory on startup.
- Exposing an API endpoint at `/v1/codebase-agent-rules` that streams the cached events to clients.
- Allowing an optional delay between event emissions to simulate a real-time streaming experience.
- Adding CORS middleware to enable cross-origin requests, matching the main application configuration.
This mock server provides a convenient way to test the UI and other components that consume the codebase agent rules SSE stream without the need for a fully running system.
fix(models): correct typo in app_interfaces field
This commit fixes a minor typo in the `AgentMDOutput` model, where the `app_interaces` field was misspelled as `app_interaces`. The correct field name is now `app_interfaces`.
This change ensures the model definition matches the expected field name and avoids potential issues with data serialization/deserialization.
chore(docker): add unoplat-code-confluence-query-engine service
This commit adds a new service definition for the `unoplat-code-confluence-query-engine` application in the `local-docker-compose.yml` file. The new service includes the following configuration:
- Builds the application image using the Dockerfile in the `unoplat-code-confluence-query-engine` directory.
- Sets the necessary environment variables for connecting to the PostgreSQL and Neo4j databases.
- Exposes the application on port 8001.
- Depends on the `postgresql` and `neo4j` services, ensuring they are healthy before starting the application.
This change makes it easier to run the full application stack locally using Docker Compose, including the query engine service.
refactor(codebase-agent-rules): improve SSE event naming
The changes in this commit improve the naming of the Server-Sent Events (SSE) emitted by the `/v1/codebase-agent-rules` endpoint. Specifically:
- A new `build_repo_agent_event_name()` function is introduced to construct a namespaced event name in the format `{repository_qualified_name}:{agent_name}:{event_type}`.
- This namespaced event name is used when emitting the initial "status" event and the final "aggregated_final_summary_agent" event.
Using the repository-qualified name as the first part of the event name ensures uniqueness across concurrent SSE connections for different repositories, improving the ability to track and identify events.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Connected to Huly®: UNOPL-951 |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| # Resolve repository root and reference SSE log file | ||
| REPO_ROOT: Path = Path(__file__).resolve().parents[1] | ||
| SSE_LOG_PATH: Path = REPO_ROOT / "docs" / "sse-agent-results.txt" | ||
|
|
||
|
|
There was a problem hiding this comment.
[P1] Handle missing SSE log file in mock server
The mock SSE app loads REPO_ROOT / "docs" / "sse-agent-results.txt" during startup, but no such file exists anywhere in the repository (see find . -name "sse-agent-results.txt" returning nothing). Because parse_sse_log_file immediately raises FileNotFoundError when the file is missing, the FastAPI application never finishes starting and the new task mock-sse or Docker usage will crash before serving any events. Either ship the reference file with the repo or guard the startup logic so the server can run without it.
Useful? React with 👍 / 👎.
feat(config): improve config hot reload handling and introduce mock sse endpoint for ui testing as not all providers support prompt caching
User description
The changes in this commit improve the handling of configuration hot reloading in the
config_hot_reload.pymodule. Specifically:EnvironmentSettingsimport is now wrapped in a conditional block to avoid circular imports.settingsparameter in the_model_factory.build()call is now properly handled, falling back to creating a newEnvironmentSettingsinstance ifsettingsisNone.These changes help ensure the configuration hot reload functionality works as expected and avoids potential issues with circular imports.
feat(experiments): add mock SSE server
This commit introduces a new standalone FastAPI application in the
experimentsdirectory that provides a mock Server-Sent Events (SSE) server. The purpose of this mock server is to replay events from a captured log file (docs/sse-agent-results.txt) to enable UI/development testing without running the full agent pipeline or external services.The key features of the mock SSE server include:
/v1/codebase-agent-rulesthat streams the cached events to clients.This mock server provides a convenient way to test the UI and other components that consume the codebase agent rules SSE stream without the need for a fully running system.
fix(models): correct typo in app_interfaces field
This commit fixes a minor typo in the
AgentMDOutputmodel, where theapp_interacesfield was misspelled asapp_interaces. The correct field name is nowapp_interfaces.This change ensures the model definition matches the expected field name and avoids potential issues with data serialization/deserialization.
chore(docker): add unoplat-code-confluence-query-engine service
This commit adds a new service definition for the
unoplat-code-confluence-query-engineapplication in thelocal-docker-compose.ymlfile. The new service includes the following configuration:unoplat-code-confluence-query-enginedirectory.postgresqlandneo4jservices, ensuring they are healthy before starting the application.This change makes it easier to run the full application stack locally using Docker Compose, including the query engine service.
refactor(codebase-agent-rules): improve SSE event naming
The changes in this commit improve the naming of the Server-Sent Events (SSE) emitted by the
/v1/codebase-agent-rulesendpoint. Specifically:build_repo_agent_event_name()function is introduced to construct a namespaced event name in the format{repository_qualified_name}:{agent_name}:{event_type}.Using the repository-qualified name as the first part of the event name ensures uniqueness across concurrent SSE connections for different repositories, improving the ability to track and identify events.
PR Type
Enhancement, Tests, Bug fix
Description
Add mock SSE server for UI testing without full pipeline
Improve SSE event naming with repository-qualified namespacing
Fix typo in
app_interfacesfield nameAdd query engine service to Docker Compose configurations
Diagram Walkthrough
File Walkthrough
2 files
Add standalone mock SSE server for testingAdd HTTP request configuration for mock testing1 files
Implement namespaced SSE event naming system2 files
Fix typo in app_interfaces field nameImprove import handling for circular dependency avoidance3 files
Add query engine service configurationAdd query engine service for productionAdd mock SSE server task command1 files