Repository navigation
fix: add AI agent health check and diagnostic tooling (#13) - #49
Open
karmaboy1309 wants to merge 1 commit into
Open
karmaboy1309 wants to merge 1 commit into
karmaboy1309 wants to merge 1 commit into
Conversation
karmaboy1309
commented
Sep 18, 2026
Contributor
- Add /health endpoint to agent.py returning comprehensive system, version, Ollama connectivity, and capability diagnostics
- Enhance /status endpoint to indicate agent health status
- Add automated test suite in agent/test_agent.py testing dependencies, endpoints, memory context generation, and note action parsing
- Add 'npm run test:agent' script to package.json
- Add checkAgentHealthDetails in src/services/ollama.ts
- Add interactive 'Check Agent Health' diagnostic panel in AIChat.tsx settings with real-time ping, latency, and status feedback
- Closes The AI agent is not checked that it's working well or not !! #13
- Add /health endpoint to agent.py returning comprehensive system, version, Ollama connectivity, and capability diagnostics - Enhance /status endpoint to indicate agent health status - Add automated test suite in agent/test_agent.py testing dependencies, endpoints, memory context generation, and note action parsing - Add 'npm run test:agent' script to package.json - Add checkAgentHealthDetails in src/services/ollama.ts - Add interactive 'Check Agent Health' diagnostic panel in AIChat.tsx settings with real-time ping, latency, and status feedback - Closes flint-md#13
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues affect configured Ollama URL handling, latency reporting, and missing-dependency test startup.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds AI agent health diagnostics, frontend reporting, and automated Python agent tests.
Changes:
- Adds
/healthand enhanced/statusdiagnostics. - Adds Ollama health reporting and an interactive diagnostics panel.
- Adds agent tests, npm scripts, package initialization, and Python cache exclusions.
File summaries
| File | Description |
|---|---|
src/services/ollama.ts |
Fetches and formats agent/Ollama health reports. |
src/components/AIChat.tsx |
Adds the health diagnostics settings panel. |
package.json |
Adds agent testing scripts. |
agent/test_agent.py |
Adds endpoint and agent logic tests. |
agent/agent.py |
Adds health diagnostics and status metadata. |
agent/__init__.py |
Initializes the agent package. |
.gitignore |
Ignores Python cache artifacts. |
Review details
Suppressed comments (3)
agent/agent.py:38
- This probe is hard-coded to
OLLAMA_URL, so when the UI's configuredaiSettings.ollamaUrlpoints to a non-default Ollama server,/healthreports the default as disconnected even though/chatuses the configured URL. Pass the configured endpoint through the health check (or explicitly probe it in the client) so diagnostics cover the backend the app actually uses.
r = requests.get(f"{OLLAMA_URL}/api/tags", timeout=1)
agent/test_agent.py:27
- If Flask, flask-cors, or requests is missing, importing
agent.agentraisesImportErrorbefore unittest can run; this fallback then imports the requested names fromagent/__init__.py, which exports none of them. Thusnpm run test:agentcrashes at module import instead of executingtest_required_modulesand reporting the missing dependency. Move the dependency check ahead of the agent import or explicitly handle an unavailable agent module.
except ImportError:
from agent import (
app,
is_note_edit_request,
extract_json_object,
src/services/ollama.ts:146
- On the fallback path,
latencyMswas captured before the direct Ollama request, so the report omits the time spent on the probe it is reporting and can show an outdated/near-zero latency after that request completes. Compute the value after the direct request, or measure that request separately.
latencyMs,
- Files reviewed: 6/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+101
to
+105
| const data = await res.json(); | ||
| const ollamaConnected = data.ollama?.connected ?? false; | ||
| const modelCount = data.ollama?.models?.length ?? 0; | ||
| return { | ||
| agentRunning: true, |
Comment on lines
+434
to
+435
| Agent Health & Diagnostics | ||
| </span> |
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.