Skip to content

fix: add AI agent health check and diagnostic tooling (#13) - #49

Open
karmaboy1309 wants to merge 1 commit into
flint-md:mainfrom
karmaboy1309:fix/issue-13-ai-agent-health-check
Open

karmaboy1309 wants to merge 1 commit into
flint-md:mainfrom
karmaboy1309:fix/issue-13-ai-agent-health-check

Conversation

@karmaboy1309

Copy link
Copy Markdown
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
Copilot AI lite review requested due to automatic review settings September 18, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 /health and enhanced /status diagnostics.
  • 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 configured aiSettings.ollamaUrl points to a non-default Ollama server, /health reports the default as disconnected even though /chat uses 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.agent raises ImportError before unittest can run; this fallback then imports the requested names from agent/__init__.py, which exports none of them. Thus npm run test:agent crashes at module import instead of executing test_required_modules and 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, latencyMs was 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 thread src/services/ollama.ts
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 thread src/components/AIChat.tsx
Comment on lines +434 to +435
Agent Health & Diagnostics
</span>
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