Conversation
aayank13
commented
Jun 21, 2026
Collaborator
- Introduced structured error handling with ErrorInfo and ErrorCode enums in mofa-kernel.
- Updated EngineError to provide machine-readable error codes and retryable status.
- Enhanced the server API by adding a new endpoint for resource refresh.
- Simplified error responses in the server by utilizing the new ErrorInfo structure.
- Improved model provider traits to include methods for loading and unloading models.
- Added backend health and feature reporting to enhance observability.
- Updated model status logic to derive from richer state information.
- Refactored model card structure to include execution state and availability.
- Introduced structured error handling with ErrorInfo and ErrorCode enums in mofa-kernel. - Updated EngineError to provide machine-readable error codes and retryable status. - Enhanced the server API by adding a new endpoint for resource refresh. - Simplified error responses in the server by utilizing the new ErrorInfo structure. - Improved model provider traits to include methods for loading and unloading models. - Added backend health and feature reporting to enhance observability. - Updated model status logic to derive from richer state information. - Refactored model card structure to include execution state and availability.
There was a problem hiding this comment.
Pull request overview
This PR refactors the engine/kernel contracts to provide structured, machine-readable error handling and richer backend/model state, while expanding server and provider capabilities to support discovery/health reporting and manual refresh.
Changes:
- Introduces
ErrorCode/ErrorInfoand updatesEngineErrorto expose stable codes, retryability, and optional source provider. - Expands model/runtime state (health, availability, residency, execution) and updates routing + status derivation accordingly.
- Enhances the HTTP API with
/v1/discovery/refresh, richer status reporting, and standardized error responses.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| mofa-kernel/src/types.rs | Adds backend/model state types, canonical model ID helpers, fallback policy, and richer request/response fields. |
| mofa-kernel/src/traits.rs | Extends provider trait with name/kind/features plus typed discover/health/load/unload. |
| mofa-kernel/src/lib.rs | Re-exports new error types (ErrorCode, ErrorInfo). |
| mofa-kernel/src/error.rs | Implements structured error info + stable error codes and retryability. |
| mofa-engine-sdk/src/server.rs | Standardizes error responses to ErrorInfo and adds /v1/discovery/refresh. |
| mofa-engine-sdk/src/lib.rs | Reorders module declarations (no functional change). |
| mofa-engine-core/src/router.rs | Refactors routing to use provider health/circuit state and richer model state; adds explainable decisions. |
| mofa-engine-core/src/memory.rs | Minor formatting-only refactor. |
| mofa-engine-core/src/lib.rs | Reorders module declarations/exports. |
| mofa-engine-core/src/engine.rs | Adds validated engine construction, refresh flow, health tracking, lifecycle loading, fallback policy, and richer events/status. |
| mofa-engine-core/src/config.rs | Adds checked config loading + validation; defaults host to 127.0.0.1. |
| mofa-engine-core/src/circuit_breaker.rs | Minor formatting-only refactor. |
| mofa-engine-core/src/backends/openai_compat.rs | Updates OpenAI-compatible backend to new Provider contract + lifecycle no-ops + capability checks. |
| mofa-engine-core/src/backends/ollama.rs | Updates Ollama backend to new Provider contract + discovery/health + load/unload hooks and residency inspection. |
| mofa-engine-core/src/backends.rs | New module file exporting provider backend implementations. |
| mofa-engine-app/src/main.rs | Switches production startup to checked config + Engine::try_new. |
| docs/openapi.yaml | Adds OpenAPI spec documenting refresh endpoint and structured errors. |
| docs/decisions/0001-stage-0-2-baseline.md | Adds ADR capturing baseline decisions (IDs, fallback, health/residency split, bind address). |
| docs/acceptance.md | Adds acceptance checklist tracking for stage 0–2 baseline. |
| .github/workflows/ci.yml | Adds Rust CI workflow (fmt/clippy/test). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dd compatibility for legacy naming conventions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.