Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ jobs:
"_llmrig/hf_bridge.py",
"_llmrig/omlx_api.py",
"_llmrig/omlx_verify.py",
"_llmrig/rescue.py",
"_llmrig/rescue_agent.py",
"_llmrig/rescue_ab.py",
"_llmrig/rescue_trace.py",
"_llmrig/rescue_evidence.py",
"_llmrig/rescue_compaction_ab.py",
}
with zipfile.ZipFile(wheels[0]) as archive:
names = set(archive.namelist())
Expand Down Expand Up @@ -140,6 +146,8 @@ jobs:
"$RUNNER_TEMP/llmrig-wheel/bin/llmrig" --version
"$RUNNER_TEMP/llmrig-wheel/bin/llmrig" --help >/dev/null
"$RUNNER_TEMP/llmrig-wheel/bin/llmrig" runtimes --json >/dev/null
"$RUNNER_TEMP/llmrig-wheel/bin/llmrig" rescue --help >/dev/null
"$RUNNER_TEMP/llmrig-wheel/bin/llmrig" rescue-evidence --help >/dev/null

- name: Smoke-test new-user pipx wheel install outside checkout
shell: bash
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

All notable changes to LLMRig will be documented here.

## 0.11.0 - 2026-10-18

### LLMRig Rescue (experimental)
- Ship `llmrig rescue` OpenCode + Ollama preflight with explicitly opted-in
synthetic tool-call probes and read-only coding-agent tasks in disposable
workspaces. No existing user project is opened or modified.
- Add privacy-filtered OpenCode JSONL event-sequence diagnostics distinguishing
observed correct-fix text from agent completion, nonzero exits, timeouts,
explanation-rubric misses and test-boundary violations.
- Add versioned three-task, paired A/B tests for context declarations and
automatic-compaction policies with alternating order, equal per-session
timeout budgets, integrity checks and explicit noncausal limitations.
- Add `rescue-evidence` for offline comparison of explicitly selected JSON
receipts. Support legacy baseline receipts with missing policy fields
while disclosing that uncertainty. Never send reports remotely.
- Emit a conservative diagnosis for the repeated pattern of correct-fix
evidence followed by timeouts under default compaction with successful
independent compaction-disabled fixture runs. **Never** recommend
automatically or globally disabling automatic compaction.

### Field evidence and scope
- On one Apple M4 Max 48 GiB with OpenCode 1.19.3, Ollama 0.33.3 and
local `qwen3.8:27b-mlx`, the controlled 3-task 4K-*declared*-context
experiment recorded 0/3 strict passes with default compaction (3 timeouts
after correction evidence), versus 3/3 strict passes with compaction
explicitly disabled (all 6 contained correct-fix evidence).
- Separately, 3/3 repeated compaction-disabled parity tasks passed in
28.43 s, 22.36 s and 10.21 s. All observations were reported by one
machine/user; no independent attestation or statistical claim.
- Effective Ollama per-request context, direct compaction events,
broader generalization, and a safe persistent real-world mitigation
remain unverified. Disposable HOME and tool restrictions are **not**
an operating-system sandbox.
- Preserve Autopilot capabilities, Python 3.9+ support and existing
opt-in mutation boundaries. No new dependency or silent downloads.

## 0.10.0 - 2026-10-18

### Real Autopilot validation
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type: software
authors:
- family-names: Vadlamani
given-names: Sunil Kumar
version: 0.10.0
version: 0.11.0
date-released: 2026-10-18
repository-code: "https://github.com/sunilteja93/llmrig"
url: "https://github.com/sunilteja93/llmrig"
Expand Down
58 changes: 45 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Start here

**Install LLMRig v0.10.0** using isolated [`pipx`](https://pipx.pypa.io/).
**Install LLMRig v0.11.0** using isolated [`pipx`](https://pipx.pypa.io/).
See the [installation guide](https://github.com/sunilteja93/llmrig/blob/main/docs/INSTALL.md) for platform-specific setup.

~~~bash
Expand Down Expand Up @@ -85,21 +85,53 @@ user-generated JSON reports locally. After your own successful
open the viewer in a local browser and click **View report** to produce
a shareable, inspectable card.

## Experimental: Rescue protocol diagnostics
## New in v0.11.0: Rescue for local coding agents (experimental)

LLMRig is building a reproducible **diagnose → reproduce → verify**
workflow for local AI agents. The first Rescue implementation is on a
development branch; **it is not included in the PyPI v0.10.0 release**.
**LLMRig Rescue** diagnoses Ollama + OpenCode failures, including cases where
an agent *proposes the expected fix but continues running until timeout*.
It uses isolated, **read-only coding fixtures**, privacy-filtered event traces,
and explicit opt-in experiments. No existing user project is opened.

It checks whether an OpenCode executable is present, confirms a specified
Ollama model is installed, and, **only with explicit `--probe`**, measures
a synthetic tool-call canary at one or two context sizes. It does not run
OpenCode, edit your configuration, download model weights or claim to
have repaired an agent. Reports omit raw model output and user files.
On one Apple M4 Max (48 GiB), using **OpenCode 1.19.3, Ollama 0.33.3 and
`qwen3.8:27b-mlx`**, a controlled comparison at **4K OpenCode-declared
context** recorded **3/3 timeouts** with default automatic compaction versus
**3/3 completed tasks** with compaction explicitly disabled. All six runs
produced the expected correction evidence. This is a small, locally
self-reported result, **not proof of a compaction bug or a broadly safe fix**.
Ollama's effective per-request context and OpenCode compaction events were
not independently verified.

~~~bash
# Read-only preflight (does not execute OpenCode)
llmrig rescue --agent opencode --model qwen3.8:27b-mlx

# Explicitly run one disposable read-only coding task
llmrig rescue --agent opencode --model qwen3.8:27b-mlx \
--context 4096 --agent-test --agent-timeout 90

# Exploratory paired test: 3 tasks, both compaction settings (6 sessions)
llmrig rescue --agent opencode --model qwen3.8:27b-mlx \
--context 4096 --compaction-ab --compaction-repeats 1 \
--agent-timeout 90 --ab-budget 600 \
--output rescue-compaction-paired.json
~~~

The A/B report separately tracks correct-fix evidence, successful exits,
timeouts and explanation-only rubric misses. It classifies a **suspected
compaction-associated post-answer continuation** only when all three
default-compaction trials time out after generating the correction and all
three compaction-disabled trials pass. This is a **diagnostic signature,
not an established root cause**.

Compaction is often important for long sessions. **LLMRig never changes your
OpenCode settings automatically or recommends disabling compaction globally.**
The temporary read-only permissions are not an OS sandbox; OpenCode remains a
third-party executable running with your user privileges.

See [the detailed Rescue guide](https://github.com/sunilteja93/llmrig/blob/main/docs/RESCUE.md)
for model prerequisites, offline receipt comparison, controlled task-suite
details and known limits.

Read the [Rescue design and experimental CLI guide](https://github.com/sunilteja93/llmrig/blob/main/docs/RESCUE.md).
A real end-to-end coding-task repair must be independently demonstrated
before we make that claim.

## Why LLMRig

Expand Down
5 changes: 5 additions & 0 deletions _llmrig/rescue.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ def format_terminal(report: Dict[str, Any]) -> str:
lines.append(
"Observed A/B: " + experiment["observed_comparison"]["direction"]
)
diagnosis = experiment.get("diagnosis")
if diagnosis:
lines.append("Diagnostic signature: " + diagnosis["code"])
lines.append("Diagnostic confidence: " + diagnosis["confidence"])
lines.append("Apply to real OpenCode config: no (not independently validated)")
lines.append("Evidence: exploratory, not causal or statistically validated")
lines.append("No automatic or global compaction changes were made.")
if report.get("agent_ab_evaluation"):
Expand Down
38 changes: 38 additions & 0 deletions _llmrig/rescue_compaction_ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def compare_compaction(model: str, context: int, repeats: int = 1,
"trials": [],
"groups": None,
"observed_comparison": None,
"diagnosis": {
"code": "insufficient_comparable_evidence",
"confidence": "unverified",
"candidate_mitigation": "disable_auto_compaction_in_disposable_test_only",
"real_configuration_recommended": False,
},
"recommendation": "no_automatic_or_global_compaction_change",
"limitations": [
"Task suite is tiny and synthetic, not representative of coding agents.",
Expand Down Expand Up @@ -162,4 +168,36 @@ def compare_compaction(model: str, context: int, repeats: int = 1,
),
"evidence_strength": "exploratory_small_sample_not_causally_verified",
}
if full:
# This is a reproducible *signature* of a suspected compaction
# interaction, not proof that a compaction event actually occurred.
# An explanation-only rubric miss does not invalidate correct-fix
# evidence, but it cannot count as a strict completed task pass.
repeatable_signature = (
len(baseline) == len(candidate) and len(baseline) >= 3
and base["timeouts_with_fix"] == len(baseline)
and base["process_exits"] == 0
and modified["strict_passes"] == len(candidate)
and modified["timeouts"] == 0
and all(t.get("failure_category") != "test_boundary_violation"
and (t.get("checks") or {}).get("fixture_unchanged") is True
and (t.get("checks") or {}).get("no_disallowed_tool_observed") is True
for t in trials)
)
result["diagnosis"] = {
"code": (
"suspected_compaction_associated_post_answer_continuation"
if repeatable_signature else "mixed_or_insufficient_compaction_evidence"
),
"confidence": "exploratory_controlled_observation_not_root_cause",
"candidate_mitigation": "disable_auto_compaction_in_disposable_test_only",
"real_configuration_recommended": False,
"supporting_default_timeouts_after_fix": base["timeouts_with_fix"],
"supporting_candidate_strict_passes": modified["strict_passes"],
"known_unknowns": [
"No direct OpenCode compaction event is verified.",
"Effective per-request Ollama context is unverified.",
"A single small task suite cannot prove general reliability.",
],
}
return result
77 changes: 77 additions & 0 deletions docs/RELEASE_NOTES_v0.11.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# LLMRig v0.11.0 | Rescue: Diagnose Local Coding-Agent Failures

LLMRig v0.11.0 adds the **experimental Rescue workflow** for local Ollama
models used through OpenCode. It distinguishes a model producing an expected
correction from the agent **actually completing** its turn.

## What's new

- `llmrig rescue`: read-only preflight for a named Ollama model and OpenCode.
No model inference or OpenCode execution without the explicit test flags.
- `--agent-test`: opt-in, disposable read-only debugging fixture with
exact file-integrity and tool-permission checks.
- `--probe`: optional synthetic protocol canary, explicitly not a full
coding-agent benchmark.
- `--ab-test`: fixed three-task comparison of *declared* OpenCode contexts.
- `--compaction-ab`: alternating baseline/disabled automatic compaction
experiment across three fixed tasks, same declared context and timeouts.
- `--agent-no-auto-compact` and `--agent-steps`: isolated, opt-in
hypotheses for a single disposable test, never persistent user changes.
- `llmrig rescue-evidence`: offline, privacy-filtered receipt comparison
with explicit unknowns, including support for older baseline receipts.
- Privacy-preserving event sequencing that differentiates correction
evidence, agent exits, timeouts and explanation-rubric misses.

## Measured experimental case

**Environment:** One user-reported Apple M4 Max (48 GiB), OpenCode
1.19.3, Ollama 0.33.3 and `qwen3.8:27b-mlx`.

At an **OpenCode-declared 4096-token context**, a matched,
alternating-order three-task comparison recorded:

| Compaction policy | Strict completed tasks | Timeouts | Correct-fix evidence |
| --- | ---: | ---: | ---: |
| OpenCode default | 0/3 | 3 | 3/3 |
| Explicitly disabled in disposable fixture | 3/3 | 0 | 3/3 |

Earlier independent repetitions also had 3/3 successful runs with
compaction explicitly disabled (28.43 s, 22.36 s and 10.21 s).
All results were self-reported by one local machine, with small synthetic
tasks. The matched experiment is **exploratory**, not statistical proof
of a broad improvement or an independently diagnosed root cause.
No direct OpenCode compaction events or effective Ollama per-request
context were measured.

Rescue labels the narrow failure pattern **suspected
compaction-associated post-answer continuation**, but its default
recommendation remains **no automatic or global compaction change**.
Disabling compaction in long coding sessions may cause context exhaustion.

## Install and try

```bash
pipx upgrade llmrig
llmrig --version
llmrig rescue --agent opencode --model YOUR_OLLAMA_MODEL

# Only if you trust your installed OpenCode and want the explicit real-agent test
llmrig rescue --agent opencode --model YOUR_OLLAMA_MODEL \
--context 4096 --agent-test --agent-timeout 90
```

Details: [Rescue guide](https://github.com/sunilteja93/llmrig/blob/main/docs/RESCUE.md).

## Security and limits

- OpenCode is third-party code running with your OS user privileges.
Temporary HOME, restricted tools and isolated workspaces are **not**
an OS-level sandbox or network firewall.
- No user project is opened, no permanent configuration is updated, no
raw agent messages are included in Rescue reports, and reports stay local.
- Do not interpret text-matched expected fixes as verified code execution,
or infer general agent reliability from the tiny included tasks.
- Version v0.11.0 keeps the same Python 3.9+ baseline and dependency contract.

Full changelog:
[compare v0.10.0...v0.11.0](https://github.com/sunilteja93/llmrig/compare/v0.10.0...v0.11.0).
2 changes: 1 addition & 1 deletion llmrig.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

PROJECT_NAME = "LLMRig"
PROJECT_SLUG = "llmrig"
VERSION = "0.10.0"
VERSION = "0.11.0"
CURATED_SNAPSHOT_DATE = "2026-08-19"
DEFAULT_OLLAMA_HOST = os.environ.get("OLLAMA_HOST", "http://127.0.0.1:11434").rstrip("/")
HF_MODELS_API = "https://huggingface.co/api/models"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_autopilot_foundation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_private_package_and_existing_import_identity_are_unchanged(self):

self.assertEqual(Path(llmrig.__file__).name, "llmrig.py")
self.assertTrue(_llmrig.__spec__.submodule_search_locations)
self.assertEqual(llmrig.VERSION, "0.10.0")
self.assertEqual(llmrig.VERSION, "0.11.0")
for symbol in (
"Confidence",
"RecommendationEvidence",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_llmrig.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def race_workload(self):
def test_project_branding(self):
self.assertEqual(llmrig.PROJECT_NAME, "LLMRig")
self.assertEqual(llmrig.PROJECT_SLUG, "llmrig")
self.assertEqual(llmrig.VERSION, "0.10.0")
self.assertEqual(llmrig.VERSION, "0.11.0")

def test_catalog_is_valid(self):
self.assertEqual(llmrig.validate_curated_catalog(), [])
Expand Down
19 changes: 19 additions & 0 deletions tests/test_release_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ def test_release_metadata_matches_source_version(self):
self.assertIsNotNone(citation_match)
self.assertEqual(citation_match.group(1), llmrig.VERSION)
self.assertIn(f"## {llmrig.VERSION} - ", changelog)
if llmrig.VERSION == "0.11.0":
self.assertIn("date-released: 2026-10-18", citation)
readme = (root / "README.md").read_text(encoding="utf-8")
self.assertIn("Install LLMRig v0.11.0", readme)
self.assertIn("## New in v0.11.0: Rescue", readme)
self.assertIn("--compaction-ab", readme)
self.assertTrue((root / "docs/RELEASE_NOTES_v0.11.0.md").exists())
rescue_notes = (root / "docs/RELEASE_NOTES_v0.11.0.md").read_text(
encoding="utf-8"
)
self.assertIn("0/3", rescue_notes)
self.assertIn("3/3", rescue_notes)
self.assertIn("not statistical proof", rescue_notes)
self.assertIn(
"no automatic or global compaction change", rescue_notes
)
self.assertIn("GitHub Release", (root / "RELEASING.md").read_text(
encoding="utf-8"
))
if llmrig.VERSION == "0.10.0":
self.assertIn("date-released: 2026-10-18", citation)
readme = (root / "README.md").read_text(encoding="utf-8")
Expand Down
Loading
Loading