Skip to content

Convert Claude Code or Codex into the most intelligent Deep Research Agent. Collect, search, and synthesize web research into a persistent, searchable wiki that builds on itself. Hosted API + MCP: hyperresearch.ai

fix: verify keys tier artifacts on the classified tier, not the manifest profile (#95)

Maxim Gagievbb7c407d29de
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3572c7..39fef4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,10 @@ Recovery used to ask Unpaywall, then Europe PMC. But `contact_email` is empty by
The "Academic APIs before web search" section of the injected agent instructions tells agents to run `hpr scholar search` and not to hand-assemble API URLs, and explains what each source is for.
+### Contributed fixes
+
+- **`run finish` no longer blocks every light-classified run started on the installed gear (@maximilliangrand in #95).** `verify_run()` took its required-artifact step set from the manifest's `profile_steps`, so a run initialized with `--profile full` whose step-1 decomposition classified it `light` was asked for `critic-findings-*.json` and `patch-log.json` — artifacts the light tier correctly never writes, because steps 12 and 14 are skipped by the tier gate. The run did all its light-tier work and then sat at `blocked (verify)` with no legitimate way to pass. The gate now resolves the tier declared in `prompt-decomposition.json` when it disagrees with the manifest profile, which is what the router already documents ("the manifest's profile field is informational — the decomposition's tier rules"). A missing, unreadable or unknown tier still falls back to `profile_steps`.
+
## [0.10.1] - 2026-09-11
A maintenance release. Everything here is a contributed fix, and two of them unblock users who could not ship a run at all.
diff --git a/src/hyperresearch/core/runs.py b/src/hyperresearch/core/runs.py
index 683148c..eccc1f6 100644
--- a/src/hyperresearch/core/runs.py
+++ b/src/hyperresearch/core/runs.py
@@ -344,6 +344,46 @@ def run_report_data(vault, vault_tag: str) -> dict:
}
+def _declared_tier(run_dir: Path) -> str | None:
+ """The `pipeline_tier` step 1 wrote into prompt-decomposition.json.
+
+ Tolerant on purpose: a missing or unreadable decomposition just means
+ "no declared tier", and verify_run reports the unreadable case through
+ its own `decomposition-readable` check.
+ """
+ decomp_path = run_dir / "prompt-decomposition.json"
+ if not decomp_path.exists():
+ return None
+ try:
+ decomp = json.loads(decomp_path.read_text(encoding="utf-8-sig"))
+ except (OSError, json.JSONDecodeError):
+ return None
+ tier = decomp.get("pipeline_tier") if isinstance(decomp, dict) else None
+ return tier if isinstance(tier, str) and tier.strip() else None
+
+
+def _required_step_ids(manifest: dict, run_dir: Path, config_path: Path | None) -> set[str]:
+ """Step ids whose artifacts the ship gate demands.
+
+ The router initializes a run with the installed gear and lets step 1
+ reclassify it: "the manifest's profile field is informational — the
+ decomposition's tier rules". So when the decomposition declares a tier
+ that disagrees with the manifest profile, that tier's step set wins;
+ otherwise (no tier, same tier, or a tier that resolves to nothing) the
+ manifest's own `profile_steps` stand.
+ """
+ from hyperresearch.core.profiles import ProfileError, resolve_profile
+
+ steps = {str(s) for s in manifest.get("profile_steps", [])}
+ tier = _declared_tier(run_dir)
+ if tier is None or tier == manifest.get("profile"):
+ return steps
+ try:
+ return {str(s) for s in resolve_profile(tier, config_path).steps}
+ except ProfileError:
+ return steps
+
+
def verify_run(vault, vault_tag: str) -> dict:
"""Structural verification battery for a completed run.
@@ -485,8 +525,9 @@ def verify_run(vault, vault_tag: str) -> dict:
except Exception as exc:
check("content-lints", False, f"content lint rules failed to run: {exc}")
- # Tier-mandated artifacts
- steps = set(manifest.get("profile_steps", []))
+ # Tier-mandated artifacts, keyed on the tier the run actually ran (see
+ # _required_step_ids) rather than the profile it was initialized with.
+ steps = _required_step_ids(manifest, run_dir, vault.config_path)
if {"12", "14"} <= steps:
for name in (
"critic-findings-dialectic.json", "critic-findings-depth.json",
diff --git a/tests/test_core/test_verification.py b/tests/test_core/test_verification.py
index 0d6f36d..322a59e 100644
--- a/tests/test_core/test_verification.py
+++ b/tests/test_core/test_verification.py
@@ -356,6 +356,61 @@ class TestCJKLengthCheck:
assert "300-900" in by_name["length-in-range"]["detail"]
+class TestClassifiedTierArtifacts:
+ """The router lets step 1 reclassify a run's tier after `run init`:
+ "the manifest's profile field is informational — the decomposition's
+ tier rules". The ship gate has to read the same rule, or a
+ light-classified run started on the installed gear is asked for critic
+ findings that light tier never produces."""
+
+ def _light_classified_gear_run(self, tmp_vault, tag: str, tier: str | None):
+ init_run(tmp_vault, tag, profile="full")
+ run_dir = tmp_vault.run_dir(tag)
+ decomp = {
+ "response_format": "short",
+ "required_section_headings": ["## Findings"],
+ }
+ if tier is not None:
+ decomp["pipeline_tier"] = tier
+ (run_dir / "prompt-decomposition.json").write_text(
+ json.dumps(decomp), encoding="utf-8"
+ )
+ (run_dir / "polish-log.json").write_text('{"applied": []}', encoding="utf-8")
+ report = tmp_vault.root / "research" / "notes" / f"final_report_{tag}.md"
+ report.write_text(
+ "## Findings\n\n"
+ + ("Substantive sentence with real evidence attached [[src-note]]. " * 80),
+ encoding="utf-8",
+ )
+ return run_dir
+
+ def test_light_classified_gear_run_passes_without_critic_artifacts(self, tmp_vault):
+ self._light_classified_gear_run(tmp_vault, "tier-01", "light")
+
+ result = verify_run(tmp_vault, "tier-01")
+ names = {c["name"] for c in result["checks"]}
+ assert not [n for n in names if n.startswith("artifact:critic-findings")]
+ assert "artifact:patch-log.json" not in names
+ assert "artifact:polish-log.json" in names
+ assert result["passed"] is True
+
+ def test_gear_run_without_declared_tier_still_needs_critic_artifacts(self, tmp_vault):
+ self._light_classified_gear_run(tmp_vault, "tier-02", None)
+
+ result = verify_run(tmp_vault, "tier-02")
+ by_name = {c["name"]: c for c in result["checks"]}
+ assert by_name["artifact:critic-findings-dialectic.json"]["ok"] is False
+ assert result["passed"] is False
+
+ def test_unknown_declared_tier_falls_back_to_manifest_profile(self, tmp_vault):
+ self._light_classified_gear_run(tmp_vault, "tier-03", "bogus")
+
+ result = verify_run(tmp_vault, "tier-03")
+ by_name = {c["name"]: c for c in result["checks"]}
+ assert by_name["artifact:critic-findings-dialectic.json"]["ok"] is False
+ assert result["passed"] is False
+
+
class TestTelemetryAndVerify:
def test_run_report_rollup(self, tmp_vault):
init_run(tmp_vault, "tel-01", profile="light")