dockmedic 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dockmedic-0.1.2/.github/dependabot.yml +12 -0
- dockmedic-0.1.2/.github/workflows/ci.yml +27 -0
- dockmedic-0.1.2/.github/workflows/publish.yml +31 -0
- dockmedic-0.1.2/.gitignore +11 -0
- dockmedic-0.1.2/.hypothesis/.gitignore +9 -0
- dockmedic-0.1.2/.hypothesis/constants/10e8db011d01feab +4 -0
- dockmedic-0.1.2/.hypothesis/constants/1228314d9b99363b +4 -0
- dockmedic-0.1.2/.hypothesis/constants/187e3d3ce80a3243 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/1bd8d0c24785f688 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/2d7c797cef3f69f5 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/44cca46a1fafbb4e +4 -0
- dockmedic-0.1.2/.hypothesis/constants/58485f07cbf5f9c4 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/5c1dae84d64ff838 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/5d7591eb3d664894 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/5feab4ce590f711e +4 -0
- dockmedic-0.1.2/.hypothesis/constants/674921f914dcace1 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/76b3916a857977d6 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/8096baca1abedb07 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/837cf05690d1098f +4 -0
- dockmedic-0.1.2/.hypothesis/constants/913df3a94020fbec +4 -0
- dockmedic-0.1.2/.hypothesis/constants/9644df65faf066d8 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/9a84be52161eade3 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/9bbaa18d32392b71 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/aad036819368ec57 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/ae3492284ca6ae83 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/ae8b9c40b0589ff1 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/d144ad5be69b54ce +4 -0
- dockmedic-0.1.2/.hypothesis/constants/d1db002cae6094b0 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/d2bee5a36bf2b38d +4 -0
- dockmedic-0.1.2/.hypothesis/constants/de8930db34d1625a +4 -0
- dockmedic-0.1.2/.hypothesis/constants/e6a33608782c1035 +4 -0
- dockmedic-0.1.2/.hypothesis/constants/f6cb04c33188d5ae +4 -0
- dockmedic-0.1.2/.hypothesis/constants/f97872613bce6846 +4 -0
- dockmedic-0.1.2/LICENSE +21 -0
- dockmedic-0.1.2/PKG-INFO +193 -0
- dockmedic-0.1.2/README.md +174 -0
- dockmedic-0.1.2/SECURITY.md +36 -0
- dockmedic-0.1.2/demo/docker-compose.demo.yml +27 -0
- dockmedic-0.1.2/demo/sample_container.log +5 -0
- dockmedic-0.1.2/dockmedic_v0_1_0_engineering_plan.md +324 -0
- dockmedic-0.1.2/eval_results/result.yaml +203 -0
- dockmedic-0.1.2/eval_results/results.json +242 -0
- dockmedic-0.1.2/eval_results/results.md +34 -0
- dockmedic-0.1.2/evals/config.yaml +9 -0
- dockmedic-0.1.2/evals/fixtures/functional.yaml +120 -0
- dockmedic-0.1.2/evals/fixtures/red_team.yaml +60 -0
- dockmedic-0.1.2/evals/labels.yaml +16 -0
- dockmedic-0.1.2/evals/scenarios.yaml +28 -0
- dockmedic-0.1.2/evals/taxonomy.yaml +12 -0
- dockmedic-0.1.2/project_overview.md +26 -0
- dockmedic-0.1.2/pyproject.toml +56 -0
- dockmedic-0.1.2/src/dockmedic/__init__.py +3 -0
- dockmedic-0.1.2/src/dockmedic/cli.py +504 -0
- dockmedic-0.1.2/src/dockmedic/config.py +80 -0
- dockmedic-0.1.2/src/dockmedic/evals/__init__.py +1 -0
- dockmedic-0.1.2/src/dockmedic/evals/baseline.py +36 -0
- dockmedic-0.1.2/src/dockmedic/evals/runner.py +321 -0
- dockmedic-0.1.2/src/dockmedic/graph/__init__.py +1 -0
- dockmedic-0.1.2/src/dockmedic/graph/nodes.py +325 -0
- dockmedic-0.1.2/src/dockmedic/graph/state.py +32 -0
- dockmedic-0.1.2/src/dockmedic/graph/verify.py +29 -0
- dockmedic-0.1.2/src/dockmedic/graph/workflow.py +55 -0
- dockmedic-0.1.2/src/dockmedic/llm.py +188 -0
- dockmedic-0.1.2/src/dockmedic/models.py +61 -0
- dockmedic-0.1.2/src/dockmedic/security/__init__.py +1 -0
- dockmedic-0.1.2/src/dockmedic/security/approval.py +86 -0
- dockmedic-0.1.2/src/dockmedic/security/policy.py +102 -0
- dockmedic-0.1.2/src/dockmedic/security/sanitize.py +41 -0
- dockmedic-0.1.2/src/dockmedic/security/scrubber.py +61 -0
- dockmedic-0.1.2/src/dockmedic/store/__init__.py +1 -0
- dockmedic-0.1.2/src/dockmedic/store/budget.py +119 -0
- dockmedic-0.1.2/src/dockmedic/store/incidents.py +129 -0
- dockmedic-0.1.2/src/dockmedic/store/ledger.py +149 -0
- dockmedic-0.1.2/src/dockmedic/store/schema.py +117 -0
- dockmedic-0.1.2/src/dockmedic/store/timeutil.py +36 -0
- dockmedic-0.1.2/src/dockmedic/tools/__init__.py +1 -0
- dockmedic-0.1.2/src/dockmedic/tools/docker_tools.py +215 -0
- dockmedic-0.1.2/src/dockmedic/watch.py +170 -0
- dockmedic-0.1.2/tests/data/scrubber_corpus.yaml +43 -0
- dockmedic-0.1.2/tests/evals/test_runner.py +40 -0
- dockmedic-0.1.2/tests/policy/test_approval.py +37 -0
- dockmedic-0.1.2/tests/policy/test_malicious_plans.py +75 -0
- dockmedic-0.1.2/tests/security/test_scrubber_corpus.py +24 -0
- dockmedic-0.1.2/tests/store/test_budget.py +31 -0
- dockmedic-0.1.2/tests/store/test_crash_points.py +111 -0
- dockmedic-0.1.2/tests/test_config.py +19 -0
- dockmedic-0.1.2/tests/test_diagnose.py +36 -0
- dockmedic-0.1.2/tests/test_graph_smoke.py +48 -0
- dockmedic-0.1.2/tests/test_llm_provider.py +54 -0
- dockmedic-0.1.2/tests/test_sanitize.py +15 -0
- dockmedic-0.1.2/tests/test_scrubber.py +23 -0
- dockmedic-0.1.2/tests/watch/test_watch.py +60 -0
- dockmedic-0.1.2/uv.lock +1450 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
verify:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
16
|
+
- name: Install uv (pinned)
|
|
17
|
+
run: python -m pip install --disable-pip-version-check "uv==0.11.7"
|
|
18
|
+
- name: Sync locked dependencies
|
|
19
|
+
run: uv sync --locked
|
|
20
|
+
- name: Lint
|
|
21
|
+
run: uv run ruff check .
|
|
22
|
+
- name: Type check
|
|
23
|
+
run: uv run mypy src
|
|
24
|
+
- name: Tests (includes scrubber corpus, malicious plans, invariants, kill points)
|
|
25
|
+
run: uv run pytest
|
|
26
|
+
- name: Replay eval (no live keys, no Docker)
|
|
27
|
+
run: uv run dockmedic eval --mode replay --runs 3
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build-and-publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write # required for PyPI Trusted Publishing
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
18
|
+
- name: Install uv (pinned)
|
|
19
|
+
run: python -m pip install --disable-pip-version-check "uv==0.11.7"
|
|
20
|
+
- name: Sync locked dependencies
|
|
21
|
+
run: uv sync --locked
|
|
22
|
+
- name: Re-run release gate
|
|
23
|
+
run: |
|
|
24
|
+
uv run ruff check .
|
|
25
|
+
uv run mypy src
|
|
26
|
+
uv run pytest
|
|
27
|
+
uv run dockmedic eval --mode replay --runs 3
|
|
28
|
+
- name: Build distributions
|
|
29
|
+
run: uv build
|
|
30
|
+
- name: Publish with Trusted Publishing
|
|
31
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This .gitignore file was automatically created by Hypothesis. Hypothesis gitignores
|
|
2
|
+
# .hypothesis by default, because we generally recommend that .hypothesis not be checked
|
|
3
|
+
# into version control.
|
|
4
|
+
#
|
|
5
|
+
# If you *would* like to check .hypothesis into version control, you should delete this
|
|
6
|
+
# file. Hypothesis will not re-create this .gitignore unless .hypothesis is deleted (and
|
|
7
|
+
# if it does, that's a bug - please report it!)
|
|
8
|
+
|
|
9
|
+
*
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/evals/runner.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[0.025, 0.975, 5.0, 400, 500, 1000, 2000, 1000000, 'GOOGLE_API_KEY', 'baseline_accuracy', 'baseline_correct', 'baseline_safe', 'cases', 'category', 'ci95', 'config.yaml', 'container_id', 'dockmedic-eval-', 'env_keys', 'estimate', 'eval-1', 'eval-container', 'eval/service', 'evals', 'exit_code', 'finished_at', 'fixtures', 'functional', 'functional.yaml', 'generated_at', 'graph_accuracy', 'graph_correct', 'graph_safe', 'health', 'incident_id', 'input', 'labels.yaml', 'live', 'logs', 'memory_percent', 'mode', 'model', 'oom_killed', 'output', 'policy_bypass', 'policy_decision', 'price_table', 'red_team', 'red_team.yaml', 'replay', 'report', 'restart_count', 'runs must be >= 1', 'runs_per_scenario', 'safe_actions', 'scenarios', 'scenarios.yaml', 'seconds', 'service_key', 'started_at', 'status', 'total_usd', 'uncertainty', 'utf-8']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/graph/nodes.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[1000, '--- logs ---', '...[truncated]...\n', '</container_data>', 'action', 'after_executed', 'allowed', 'already-executed', 'approval', 'before_intent', 'committed', 'container_id', 'elapsed_seconds', 'errors', 'evidence', 'executed', 'execution', 'graph_version', 'incident_id', 'json', 'kill_hook', 'kind', 'last_cost_usd', 'ledger_id', 'not_applicable', 'outcome', 'payload', 'performed', 'plan', 'policy_decision', 'post_snapshot', 'raw_logs', 'reason', 'report', 'report-only', 'risk', 'snapshot', 'stats', 'target_container_id', 'tokens_used', 'tool_calls', 'triage', 'verified']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/cli.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[5.0, 98.0, 137, '--config', '--force', '--mode', '--out', '--provider', '--runs', '--target', '--usd-cap', '--version', '--yes', '2026-11-28T10:10:00Z', '2026-11-28T10:12:00Z', 'Approve this action?', 'Incident report:', 'Incidents', 'PORT', 'REDIS_URL', '__main__', 'baseline', 'bold', 'checkpoints.sqlite', 'configurable', 'container_id', 'created_at', 'demo.db', 'demo/web', 'diagnose.db', 'docker', 'dockmedic', 'dockmedic-demo-', 'dockmedic-diagnose-', 'eval', 'eval_results', 'evals', 'exited', 'fixture-oom', 'gemini', 'graph', 'incident_id', 'kind', 'log-fixture', 'memory_percent', 'memoryerror', 'oom', 'provider', 'reconciliation', 'red', 'replace', 'replay', 'report', 'result.yaml', 'results.json', 'results.md', 'right', 'scenario', 'service_key', 'status', 'stub', 'summary', 'thread_id', 'triaged', 'unknown', 'utf-8', 'web-1']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/tools/docker_tools.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[100.0, 200, '/', '=', 'Actor', 'Attributes', 'Config', 'Env', 'ExitCode', 'FinishedAt', 'Health', 'ID', 'Id', 'Labels', 'Name', 'OOMKilled', 'RestartCount', 'StartedAt', 'State', 'Status', 'container', 'exited', 'finished_at', 'forbid', 'id', 'limit', 'memory_limit_bytes', 'memory_percent', 'memory_stats', 'memory_usage_bytes', 'replace', 'restart', 'running', 'started_at', 'status', 'stop', 'type', 'unknown', 'usage', 'utf-8']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/llm.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[0.075, 0.3, 0.35, 0.75, 0.8, 0.85, 0.9, 1000000, '-', 'GOOGLE_API_KEY', 'IncidentReport', '_', 'action', 'addressalreadyinuse', 'category', 'configurationerror', 'connection refused', 'connectionrefused', 'database', 'databasetimeout', 'dependencyfailure', 'eaddrinuse', 'gemini', 'gemini-2.5-flash', 'invalid yaml', 'invalidyaml', 'keyerror', 'max_output_tokens', 'memoryerror', 'missingenv', 'missingenvironment', 'name', 'oom killer', 'oomkilled', 'oomkilled=true', 'oomkiller', 'prompt_token_count', 'readonlyfilesystem', 'restartcount', 'restartcount=(\\d+)', 'stub', 'usage_metadata']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/store/ledger.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
['action_name', 'committed_at', 'container_id', 'finished_at', 'id', 'incident_id', 'phase', 'pre_state', 'restart_count', 'restarting', 'running', 'started_at', 'status', 'unknown', '{}']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/models.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[1.0, 400, 'config_error', 'crash_loop', 'db_unreachable', 'dependency_failure', 'forbid', 'fs_readonly', 'missing_env', 'oom', 'other', 'params', 'port_conflict', 'report_only', 'restart_container', 'stop_container']
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# file: /home/runner/work/dockmedic/dockmedic/src/dockmedic/watch.py
|
|
2
|
+
# hypothesis_version: 6.170.23
|
|
3
|
+
|
|
4
|
+
[100, ',', ':', 'changed_at', 'container-gone', 'cooldown', 'die', 'exit_code', 'exited', 'health', 'health_status', 'intentional-stop', 'kill', 'not-a-failure', 'oom', 'oom_killed', 'reconciliation', 'restarting', 'service_key', 'status', 'stop', 'triage', 'unhealthy', 'utf-8']
|
dockmedic-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DockMedic contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dockmedic-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dockmedic
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Safe, bounded, resumable diagnosis of local Docker container failures
|
|
5
|
+
Author: DockMedic contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: <3.13,>=3.11
|
|
9
|
+
Requires-Dist: docker>=7.1
|
|
10
|
+
Requires-Dist: langgraph-checkpoint-sqlite>=2.0
|
|
11
|
+
Requires-Dist: langgraph>=0.2
|
|
12
|
+
Requires-Dist: pydantic>=2.8
|
|
13
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
14
|
+
Requires-Dist: rich>=13.7
|
|
15
|
+
Requires-Dist: typer>=0.12
|
|
16
|
+
Provides-Extra: gemini
|
|
17
|
+
Requires-Dist: langchain-google-genai>=2.0; extra == 'gemini'
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# DockMedic
|
|
21
|
+
|
|
22
|
+
**Bounded, reviewable, resumable, measured.** DockMedic is a local CLI that
|
|
23
|
+
diagnoses Docker container failures with a single-agent triage inside a
|
|
24
|
+
deterministic pipeline. The LLM proposes a root cause and one of three small
|
|
25
|
+
actions; code decides what is actually allowed to happen, asks for approval,
|
|
26
|
+
and records the outcome in an execution ledger.
|
|
27
|
+
|
|
28
|
+
This is a portfolio project for local Docker development hosts, not a paid
|
|
29
|
+
product and not a production safety guarantee. See `project_overview.md` for a
|
|
30
|
+
plain-language overview and `dockmedic_v0_1_0_engineering_plan.md` (Rev 2) for
|
|
31
|
+
the engineering plan.
|
|
32
|
+
|
|
33
|
+
## Why it exists
|
|
34
|
+
|
|
35
|
+
Log diagnosis alone is a commodity. The interesting engineering problem is:
|
|
36
|
+
what happens when the model is wrong, compromised, or interrupted half-way
|
|
37
|
+
through an action? DockMedic answers that with four pieces of code that do not
|
|
38
|
+
trust the model:
|
|
39
|
+
|
|
40
|
+
1. A strict action schema: the LLM cannot name a container, a command, or an
|
|
41
|
+
extra field.
|
|
42
|
+
2. A deterministic policy: allowlist, opt-in stop, code-attached target, and
|
|
43
|
+
tool-call/token/time breakers.
|
|
44
|
+
3. An approval screen that prints the validated action object, plus a hash/TTL
|
|
45
|
+
binding so approval cannot be replayed against a different state.
|
|
46
|
+
4. A SQLite ledger: an fsynced intent is written before Docker is touched, and
|
|
47
|
+
resume reconciles from that record.
|
|
48
|
+
|
|
49
|
+
## Quickstart
|
|
50
|
+
|
|
51
|
+
Python 3.11 or 3.12 and [uv](https://docs.astral.sh/uv/) are required.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
uv sync --locked
|
|
55
|
+
uv run dockmedic init
|
|
56
|
+
uv run dockmedic demo --yes # offline OOM fixture; uses the stub, no Docker/API key
|
|
57
|
+
uv run dockmedic diagnose demo/sample_container.log --yes # your own saved log
|
|
58
|
+
uv run dockmedic watch # needs Docker, Gemini access and GOOGLE_API_KEY
|
|
59
|
+
uv run dockmedic incidents
|
|
60
|
+
uv run dockmedic status <incident-id-prefix>
|
|
61
|
+
uv run dockmedic resume <incident-id-prefix>
|
|
62
|
+
uv run dockmedic eval --mode replay --runs 3
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`dockmedic demo` and `watch` will prompt before any restart. `stop_container`
|
|
66
|
+
is disabled unless `allow_stop: true` is set in `dockmedic.yaml`.
|
|
67
|
+
|
|
68
|
+
### LLM provider
|
|
69
|
+
|
|
70
|
+
`watch` and `resume` use the configured provider from `dockmedic.yaml`; the
|
|
71
|
+
default is `gemini` with `model: gemini-2.5-flash`. Install the provider extra
|
|
72
|
+
and export a key before running them:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install "dockmedic[gemini]"
|
|
76
|
+
export GOOGLE_API_KEY="..."
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Set `provider: stub` in the config to run entirely offline without a key. The
|
|
80
|
+
`demo` and `diagnose` commands default to `--provider stub` so they stay
|
|
81
|
+
reproducible; pass `--provider gemini` to exercise the real client against the
|
|
82
|
+
same fixture. `dockmedic eval --mode replay` always uses the stub; `--mode live`
|
|
83
|
+
uses Gemini with a hard `--usd-cap`. Gemini is the only real provider, behind
|
|
84
|
+
`LLMClient`.
|
|
85
|
+
|
|
86
|
+
`dockmedic diagnose <log-file>` runs the whole pipeline against a saved log with
|
|
87
|
+
no Docker daemon. It infers a small synthetic inspect snapshot from the text
|
|
88
|
+
(`exit_code`, `restart_count`, OOM flag), so it is a replay/demo aid, not a
|
|
89
|
+
substitute for live Docker state. The sample in `demo/sample_container.log`
|
|
90
|
+
includes a URL credential that the scrubber redacts before the LLM sees it.
|
|
91
|
+
|
|
92
|
+
## Pipeline
|
|
93
|
+
|
|
94
|
+
```mermaid
|
|
95
|
+
flowchart LR
|
|
96
|
+
E[Docker events] --> W[Watch: bounded reconciliation,\nintentional-stop filter,\ndedupe + cooldown]
|
|
97
|
+
W --> I[Ingest: scrub, sanitise,\ntruncate, delimit]
|
|
98
|
+
I --> T[Triage: LLM, read-only]
|
|
99
|
+
T --> P[Plan: strict IncidentReport]
|
|
100
|
+
P --> Q[Policy: allowlist,\ncode target, breakers]
|
|
101
|
+
Q --> A{Approve\ninterrupt}
|
|
102
|
+
A -->|yes| X[Execute: ledger intent,\nstate guard, Docker call]
|
|
103
|
+
A -->|no| R[Report only]
|
|
104
|
+
X --> V[Verify + ledger outcome]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Execution is **at-least-once delivery of idempotent, state-guarded actions** —
|
|
108
|
+
not exactly-once. If the process dies after Docker ran but before the ledger was
|
|
109
|
+
updated, resume sees the container state and skips the duplicate call.
|
|
110
|
+
|
|
111
|
+
## What the tests prove
|
|
112
|
+
|
|
113
|
+
| Claim | Evidence |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| Best-effort secret redaction | Labelled corpus gate in `tests/security/`; every labelled secret is removed. No "zero leakage" claim. |
|
|
116
|
+
| Control/bidi/ANSI text is neutralised | `tests/test_sanitize.py`. |
|
|
117
|
+
| Policy rejects malicious plans | Mock-LLM malicious-plan corpus (smuggled target, shell string, extra keys, out-of-enum action) plus Hypothesis invariants: for any action object the target equals the incident container and nothing outside the allowlist reaches Docker. |
|
|
118
|
+
| Approvals are bound and expire | `tests/policy/test_approval.py` (action, container, `started_at`, policy version, TTL). |
|
|
119
|
+
| Crash-safe execution | Four kill-point scenarios: before intent, after intent/before Docker, after Docker/before executed write, after executed. |
|
|
120
|
+
| Red-team behaviour | Five red-team scenarios recorded as counts and labelled a smoke test, not a measured attack rate. |
|
|
121
|
+
| Graph beats baseline | Replay benchmark with scenario-level uncertainty (see below). |
|
|
122
|
+
|
|
123
|
+
The deterministic mock-LLM tests are the primary security evidence. Live-model
|
|
124
|
+
runs would be supporting evidence, not a substitute.
|
|
125
|
+
|
|
126
|
+
## Evaluation
|
|
127
|
+
|
|
128
|
+
`evals/` contains a taxonomy, author-written labels, 10 functional scenarios,
|
|
129
|
+
5 red-team scenarios, recorded `logs`/`inspect`/`stats` fixtures, a pinned model
|
|
130
|
+
ID and price table. `dockmedic eval --mode replay` runs the graph and a naive
|
|
131
|
+
baseline (one structured call on raw logs, no tools, no policy) over the same
|
|
132
|
+
corpus, 3 runs per scenario by default.
|
|
133
|
+
|
|
134
|
+
Result generated 2026-11-28 with `uv run dockmedic eval --mode replay --runs 3`
|
|
135
|
+
(stub LLM, offline; the model ID is a pinned config label, **no live model was
|
|
136
|
+
called**). Full artefacts: `eval_results/results.json`, `results.md`,
|
|
137
|
+
`result.yaml`.
|
|
138
|
+
|
|
139
|
+
| Arm | Accuracy | 95% CI |
|
|
140
|
+
| --- | ---: | ---: |
|
|
141
|
+
| Graph | 100.0% | [100.0%, 100.0%] |
|
|
142
|
+
| Baseline | 86.7% | [66.7%, 100.0%] |
|
|
143
|
+
| Delta (graph − baseline) | +13.3% | [+0.0%, +33.3%] |
|
|
144
|
+
|
|
145
|
+
Counts rather than percentages: graph 30/30 correct, baseline 26/30 correct.
|
|
146
|
+
The graph wins on `oom-basic` (3/3 vs 0/3) and `crash-loop` (3/3 vs 0/3)
|
|
147
|
+
because it can read structured signals the baseline never receives.
|
|
148
|
+
|
|
149
|
+
Red-team smoke test: 5 scenarios x 3 runs, **0 policy bypasses** in the replay
|
|
150
|
+
harness. This is a count on a malicious-plan corpus, not a claim about all
|
|
151
|
+
possible prompts.
|
|
152
|
+
|
|
153
|
+
Uncertainty uses a percentile bootstrap over **scenarios**, with the 3 correlated
|
|
154
|
+
runs collapsed into one scenario accuracy first. Wilson intervals on individual
|
|
155
|
+
runs would overstate the sample size because runs within a scenario are not
|
|
156
|
+
independent. With 15 scenarios the intervals are wide; treat the delta as
|
|
157
|
+
directional, not precise.
|
|
158
|
+
|
|
159
|
+
Cost and latency are recorded for both arms in the artefacts. Replay spend is
|
|
160
|
+
$0.0000 because the stub makes no network calls. `--mode live` uses Gemini with
|
|
161
|
+
a hard `--usd-cap`, includes an estimated token cost from the pinned price
|
|
162
|
+
table, and **never runs in CI**. Temperature is 0 but providers are not
|
|
163
|
+
deterministic and retire models, so results are dated, not eternal.
|
|
164
|
+
|
|
165
|
+
## Limitations
|
|
166
|
+
|
|
167
|
+
- Docker-only, intended for developer hosts; no cluster or remote daemon support.
|
|
168
|
+
- Small corpus (15 scenarios), labelled by one author: no independent annotator.
|
|
169
|
+
- The stub LLM is rule-based; replay validates the harness and code paths, not
|
|
170
|
+
real model quality. Live numbers require a separate dated run with an API key.
|
|
171
|
+
`watch`/`resume` default to Gemini, so they do spend tokens and need network
|
|
172
|
+
access unless the config is switched to `provider: stub`.
|
|
173
|
+
- Best-effort scrubber: known patterns only, no guarantee against novel secrets.
|
|
174
|
+
- `stop_container` is opt-in, and semantic harm from an allowed action on the
|
|
175
|
+
intended container is out of scope.
|
|
176
|
+
- Live watch/DoD cannot be exercised in environments without Docker; the
|
|
177
|
+
offline demo, `diagnose` and replay suite cover the same code paths with a
|
|
178
|
+
fake client and a log-derived snapshot.
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
uv run ruff check .
|
|
184
|
+
uv run mypy src
|
|
185
|
+
uv run pytest # 43 tests
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
CI syncs `uv.lock` with `uv sync --locked`, runs lint, strict mypy, all tests,
|
|
189
|
+
and the replay eval. Actions are pinned by commit SHA, permissions are
|
|
190
|
+
least-privilege, and Dependabot is enabled. Publishing uses PyPI Trusted
|
|
191
|
+
Publishing from a protected environment; no API token is stored. No `litellm`
|
|
192
|
+
dependency: its PyPI package shipped credential-stealing releases after a CI
|
|
193
|
+
compromise in March 2026.
|