Repository navigation
feat: add LLM-safe OBD diagnostics layer - #16
Conversation
🤖 Augment PR SummarySummary: This PR introduces a new Changes:
Technical Notes: The exposed surface stays read-only by default; destructive actions (e.g., CLEAR_DTC) return structured approval/blocked responses and are logged via audit events. 🤖 Was this summary useful? React with 👍 or 👎 |
| if input_error is not None: | ||
| return input_error | ||
|
|
||
| include_support = bool(payload.get("include_support", True)) |
There was a problem hiding this comment.
obd_ai/tools.py:146 — list_supported_commands defaults include_support to True, which means calling it before connect_vehicle will fail with disconnected_adapter even though the approved catalog could be listed offline. Consider whether the default behavior should avoid requiring a live connection unless support info is explicitly requested.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| self._session = self._session_manager.open_session(**payload) | ||
|
|
||
| metadata = self._session.connection_metadata() | ||
| if not metadata["is_connected"]: |
There was a problem hiding this comment.
obd_ai/tools.py:95 — on a disconnected adapter, connect_vehicle returns an error but leaves self._session open; that can retain/lock the underlying serial resources even though the call failed. Consider closing the session before returning the disconnected_adapter error payload.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| if self.path == "/call": | ||
| tool_name = payload.get("tool") | ||
| input_payload = payload.get("input", {}) |
There was a problem hiding this comment.
obd_ai/server.py:177 — POST /call doesn’t validate that input is a JSON object; if a client sends a non-object (e.g., string/array), the tool surface’s dict(input or {}) will raise and you’ll respond with server_error instead of a clear 400 invalid_request. Consider rejecting non-object input at the HTTP boundary (and/or in OBDAIFunctionServer.call_tool).
Severity: medium
Other Locations
obd_ai/server.py:122
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| return 0 | ||
|
|
||
| if args.command == "call": | ||
| payload = json.loads(args.input_json) |
There was a problem hiding this comment.
obd_ai/server.py:299 — the call CLI subcommand will raise an uncaught JSONDecodeError if --input-json isn’t valid JSON, which produces a stack trace instead of a clean CLI error. Consider handling JSON parsing failures and exiting with a friendly message.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Summary
obd_ailayer for safe LLM-driven vehicle diagnosticsWhat landed
basic_health_scanobd_aiValidation
python3 -m pytest -q tests/test_obd_ai_*.pypython3 -m pytest -qpython3 -m buildpython3 -m tox -e py313 -- tests/test_obd_ai_*.pyNotes
--portis not providedCloses #1
Closes #2
Closes #3
Closes #4
Closes #5
Closes #6
Closes #7
Closes #8
Closes #9