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
14 changes: 13 additions & 1 deletion .github/workflows/package-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "scripts/chat_bundle.py"
- "tests/test_core_distribution.py"
- "tests/test_core_workspace_distribution.py"
- "tests/test_core_benchmark_distribution.py"
Comment thread
loopx-agent marked this conversation as resolved.
Resolved
- "tests/test_core_recall_distribution.py"
- "tests/test_core_pr_review_distribution.py"
- "tests/test_core_issue_fix_distribution.py"
Expand All @@ -30,6 +31,7 @@ on:
- "loopx/**"
- "tests/test_core_distribution.py"
- "tests/test_core_workspace_distribution.py"
- "tests/test_core_benchmark_distribution.py"
- "tests/test_core_recall_distribution.py"
- "tests/test_core_pr_review_distribution.py"
- "tests/test_core_issue_fix_distribution.py"
Expand Down Expand Up @@ -81,6 +83,17 @@ jobs:
uv run --extra test python -m pytest -q
tests/test_core_distribution.py
tests/control_plane/test_installed_core_context.py
- name: Qualify matching Benchmark Toolkit installation and recovery
env:
LOOPX_USAGE_PING: "0"
run: |
uv run --extra test python packages/loopx-core/prepare.py \
--distribution loopx-capability-benchmark-toolkit --output "$RUNNER_TEMP/benchmark-source"
uv build --wheel "$RUNNER_TEMP/benchmark-source" --out-dir "$RUNNER_TEMP/benchmark-dist"
export LOOPX_CORE_TEST_WHEEL=$(printf '%s' "$RUNNER_TEMP"/core-dist/loopx_core-*.whl)
export LOOPX_BENCHMARK_TEST_WHEEL=$(printf '%s' "$RUNNER_TEMP"/benchmark-dist/loopx_capability_benchmark_toolkit-*.whl)
uv run --extra test python -m pytest -q tests/test_core_benchmark_distribution.py

- name: Qualify matched recall installation, execution, and removal
env:
LOOPX_USAGE_PING: "0"
Expand Down Expand Up @@ -144,7 +157,6 @@ jobs:
uv pip uninstall --python "$LOOPX_CORE_TEST_PYTHON" loopx-capability-research
uv run --extra test python -m pytest -q tests/test_core_research_distribution.py
LOOPX_CORE_TEST_PYTHON="$LOOPX_CORE_TEST_PYTHON" uv run --extra test python -m pytest -q tests/test_core_distribution.py -k 'identity_help_and_unavailable_workspace or defers_explore_evaluation'

- name: Build the matching Workspace wheel
run: |
uv run --extra test python scripts/chat_bundle.py build --install
Expand Down
11 changes: 11 additions & 0 deletions docs/architecture/rfcs/monorepo-distribution-split-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,17 @@ objective. Moving a file while retaining its shim does not reduce that count;
combining unrelated responsibilities to meet it is not a successful refactor.
Measure representative change locality and installation cost separately.

Standalone Core holds the benchmark catalog and its referenced four-arm
contract. The matching [Benchmark Toolkit wheel](../../../packages/loopx-capability-benchmark-toolkit/README.md)
owns the existing execution modules and CLI adapters. The capability catalog
reports availability from matching installed files, and ordinary discovery
leaves execution unloaded. An explicit benchmark command or scoped Workspace
analysis request uses the original toolkit. Installing or removing the wheel
preserves the existing task and analysis records. The ordinary distribution
continues to bundle the same implementation. This qualifies a D2 package
boundary for the tested toolkit journey. Benchmark-family execution, public
release and model-visible overhead have separate acceptance.

### State model and schema

No canonical record changes. The only new durable artefact is the architecture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ import 方向、剩余兼容接缝和从失败定位 owner 的路径。每个发
把无关职责塞进一个文件来满足预算不构成成功重构。代表性修改局部性与安装成本
分别测量。

独立 Core 保留 benchmark 目录及其引用的四臂实验契约。同版本的
[Benchmark Toolkit wheel](../../../packages/loopx-capability-benchmark-toolkit/README.md)
包含既有执行模块和 CLI 适配器。能力目录根据同版本安装文件报告可用性,常规发现
不会加载执行模块。显式 benchmark 命令或经范围校验的 Workspace 分析请求使用原有
工具包。安装和卸载保留既有任务及分析记录。普通发行物继续包含同一实现。已测试的
工具包流程验证了 D2 的这项打包边界。具体 benchmark 家族的执行、公开发布和模型可见
开销仍分别验收。

### 状态模型与 schema

不改任何规范记录。唯一新增的持久产物是架构 fixture:
Expand Down
29 changes: 29 additions & 0 deletions loopx/capabilities/benchmark_toolkit/catalog_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,40 @@

from typing import Any

from ...python_install_owner import BENCHMARK_TOOLKIT_DISTRIBUTION, builtin_capability_installed
from .four_arm_contract import (
BENCHMARK_FOUR_ARM_ATTESTATIONS,
BENCHMARK_FOUR_ARM_RUNNER_OBLIGATIONS,
)

BENCHMARK_TOOLKIT_INSTALL_HINT = (
"Install the matching loopx-capability-benchmark-toolkit wheel "
"or use the ordinary LoopX installation."
)


BENCHMARK_TOOLKIT_STARTUP_MODULES = (
"loopx.cli_commands.benchmark_dispatch",
"loopx.cli_commands.benchmark_boundary",
"loopx.cli_commands.benchmark_concurrency",
"loopx.cli_commands.benchmark_continuation",
"loopx.cli_commands.benchmark_experiment_board",
"loopx.cli_commands.benchmark_rebalance",
"loopx.cli_commands.benchmark_study",
"loopx.cli_commands.benchmark_token_capacity",
"loopx.cli_commands.benchmark_trajectory",
"loopx.capabilities.benchmark_toolkit.trajectory_assessment_store",
)


def benchmark_toolkit_installed(*, builtin_cli_present: bool | None = None) -> bool:
return builtin_capability_installed(
BENCHMARK_TOOLKIT_DISTRIBUTION,
BENCHMARK_TOOLKIT_STARTUP_MODULES,
builtin_cli_present=builtin_cli_present,
)


BENCHMARK_TOOLKIT_CATALOG_ENTRY: dict[str, Any] = {
"id": "benchmark-toolkit",
"origin": "builtin",
Expand Down
18 changes: 16 additions & 2 deletions loopx/capabilities/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
from typing import Any

from ..extensions.runtime import extension_catalog_entries
from ..python_install_owner import RESEARCH_DISTRIBUTION
from .benchmark_toolkit.catalog_entry import BENCHMARK_TOOLKIT_CATALOG_ENTRY
from ..python_install_owner import BENCHMARK_TOOLKIT_DISTRIBUTION, RESEARCH_DISTRIBUTION
from .benchmark_toolkit.catalog_entry import (
BENCHMARK_TOOLKIT_CATALOG_ENTRY,
BENCHMARK_TOOLKIT_INSTALL_HINT,
benchmark_toolkit_installed,
)
from .integration_branch.catalog_entry import INTEGRATION_BRANCH_CATALOG_ENTRY
from .repository_change_window.catalog_entry import (
REPOSITORY_CHANGE_WINDOW_CATALOG_ENTRY,
Expand Down Expand Up @@ -158,6 +162,16 @@ def _record_for_installed_capability(
*,
builtin_cli_present: bool,
) -> Mapping[str, object]:
if record is BENCHMARK_TOOLKIT_CATALOG_ENTRY and not builtin_cli_present:
installed = benchmark_toolkit_installed(builtin_cli_present=False)
if not any(provider["id"] == BENCHMARK_TOOLKIT_DISTRIBUTION for provider in registry.providers()):
registry.register_provider(
{"id": BENCHMARK_TOOLKIT_DISTRIBUTION, "origin": "builtin", "installed": installed}
)
updated = dict(record) | {"provider_id": BENCHMARK_TOOLKIT_DISTRIBUTION}
if not installed:
updated["next_real_step"] = BENCHMARK_TOOLKIT_INSTALL_HINT
return updated
if record is AGENT_TURN_RECALL_CATALOG_ENTRY:
installed = agent_turn_recall_installed(builtin_cli_present=builtin_cli_present)
hint = RECALL_INSTALL_HINT
Expand Down
28 changes: 28 additions & 0 deletions loopx/cli_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,12 @@ def _dispatch_selected(args: argparse.Namespace, raw_argv: list[str]) -> int:
args, registry_path=registry_path, runtime_root_arg=args.runtime_root,
print_payload=print_payload,
)
elif args.command == "benchmark":
from .cli_commands.benchmark_dispatch import handle_benchmark_command

result = handle_benchmark_command(
args, registry_path=registry_path, print_payload=print_payload, output_format=output_format,
)
elif args.command == "agent-turn-recall":
from .capabilities.agent_turn_recall.cli import handle_agent_turn_recall_command

Expand Down Expand Up @@ -1053,11 +1059,14 @@ def _dispatch_selected(args: argparse.Namespace, raw_argv: list[str]) -> int:

def _available_selected_commands() -> frozenset[str]:
from .capabilities.agent_turn_recall.catalog_entry import agent_turn_recall_installed
from .capabilities.benchmark_toolkit.catalog_entry import benchmark_toolkit_installed
from .capabilities.deep_research.catalog_entry import research_workflows_installed
from .capabilities.issue_fix.catalog_entry import issue_fix_workflow_installed
from .capabilities.pr_review_queue.catalog_entry import pull_request_review_installed

commands = set(_SELECTED_COMMANDS)
if benchmark_toolkit_installed(builtin_cli_present=False):
commands.add("benchmark")
if agent_turn_recall_installed(builtin_cli_present=False):
commands.add("agent-turn-recall")
if pull_request_review_installed(builtin_cli_present=False):
Expand Down Expand Up @@ -1176,6 +1185,25 @@ def main(argv: list[str] | None = None) -> int:


def _run_command(command: str | None, raw_argv: list[str]) -> int:
if command == "benchmark" and _standalone_core():
from .capabilities.benchmark_toolkit.catalog_entry import (
BENCHMARK_TOOLKIT_INSTALL_HINT, benchmark_toolkit_installed,
)

parser, subparsers = build_cli_parser()
if not benchmark_toolkit_installed(builtin_cli_present=False):
parser.error(f"benchmark is unavailable in the standalone core. {BENCHMARK_TOOLKIT_INSTALL_HINT}")
try:
from .cli_commands.benchmark_dispatch import register_benchmark_command_group

register_benchmark_command_group(subparsers, add_subcommand_format)
except ModuleNotFoundError as exc:
if not (exc.name or "").startswith(
("loopx.capabilities.benchmark_toolkit", "loopx.cli_commands.benchmark_")
):
raise
parser.error(f"benchmark is unavailable in the standalone core. {BENCHMARK_TOOLKIT_INSTALL_HINT}")
return _dispatch_selected(parse_cli_args(parser, raw_argv), raw_argv)
if command in {"agent-turn-recall", "pr-review", "issue-fix"} and _standalone_core():
parser, subparsers = build_cli_parser()
if command == "agent-turn-recall":
Expand Down
13 changes: 12 additions & 1 deletion loopx/presentation/research_analysis_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from importlib import import_module
from urllib.parse import parse_qs, urlparse

from ..capabilities.benchmark_toolkit.catalog_entry import (
BENCHMARK_TOOLKIT_INSTALL_HINT,
benchmark_toolkit_installed,
)
from ..feedback import validate_goal_id
from ..control_plane.effect_runtime import EffectRuntimeRejected
from .goal_source_routing import goal_source_catalog, linked_goal_source
Expand All @@ -18,13 +22,20 @@

class ResearchAnalysisRequestMixin:
def _research_analysis_store(self):
if not benchmark_toolkit_installed():
self._send_error(
BENCHMARK_TOOLKIT_INSTALL_HINT,
status=503,
error_code="research_analysis_unavailable",
)
return None
try:
return import_module(_ASSESSMENT_STORE)
except ModuleNotFoundError as exc:
if exc.name not in {_ASSESSMENT_PACKAGE, _ASSESSMENT_STORE}:
raise
self._send_error(
"Research analysis needs the Benchmark Toolkit. Use an installation that includes it.",
BENCHMARK_TOOLKIT_INSTALL_HINT,
status=503,
error_code="research_analysis_unavailable",
)
Expand Down
1 change: 1 addition & 0 deletions loopx/python_install_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def builtin_capability_installed(

WORKSPACE_DISTRIBUTION = "loopx-workspace"
RESEARCH_DISTRIBUTION = "loopx-capability-research"
BENCHMARK_TOOLKIT_DISTRIBUTION = "loopx-capability-benchmark-toolkit"
@dataclass(frozen=True)
class PythonInstallOwner:
manager: str
Expand Down
2 changes: 2 additions & 0 deletions loopx/release_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from . import __version__
from .doctor_git import GitSourceState, git_source_metadata
from .python_install_owner import (
BENCHMARK_TOOLKIT_DISTRIBUTION,
RESEARCH_DISTRIBUTION,
WORKSPACE_DISTRIBUTION,
distribution_recorded_files,
Expand Down Expand Up @@ -314,6 +315,7 @@ def release_runtime_identity(release_root: Path | None = None) -> dict[str, str

_CORE_COMPANION_DISTRIBUTIONS = (
WORKSPACE_DISTRIBUTION,
BENCHMARK_TOOLKIT_DISTRIBUTION,
"loopx-capability-agent-turn-recall",
"loopx-capability-pull-request-review",
"loopx-capability-issue-fix",
Expand Down
2 changes: 2 additions & 0 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Current co-located distributions, in directory order:
- [`loopx-ark-turn`](loopx-ark-turn/README.md): an optional host for one
LoopX-governed work unit on Ark Managed Agents (Python distribution, no
`extension.toml`; selected with `turn run-once --host generic-cli`);
- [`loopx-capability-benchmark-toolkit`](loopx-capability-benchmark-toolkit/README.md)
adds benchmark commands and registered analysis packs to the matching Core.
- [`loopx-codex-provider-routing`](loopx-codex-provider-routing/README.md):
native Codex account slots, allowance observation and automatic handoff at
safe boundaries, with legacy CPA qualification and rollback compatibility;
Expand Down
36 changes: 36 additions & 0 deletions packages/loopx-capability-benchmark-toolkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Benchmark Toolkit for LoopX Core

Install this source-built wheel when you need benchmark commands or registered
analysis packs. It uses the same version of [LoopX Core](../loopx-core/README.md)
and the same Goal registry and runtime state. Capability discovery reads its
catalog without loading the toolkit's execution modules.

Build both wheels from the same checkout and add the toolkit to your Core environment.

```sh
uv run --extra test python packages/loopx-core/prepare.py --distribution loopx-capability-benchmark-toolkit --output /tmp/loopx-bench-source
uv build --wheel /tmp/loopx-bench-source --out-dir /tmp/loopx-bench-dist
uv pip install --python /tmp/loopx-core-env/bin/python /tmp/loopx-bench-dist/loopx_capability_benchmark_toolkit-*.whl
```

Check readiness and discover a registered Goal's analysis packs using the same
registry and runtime you used to run it.

```sh
/tmp/loopx-core-env/bin/loopx capability show benchmark-toolkit
/tmp/loopx-core-env/bin/loopx --registry .loopx/registry.json benchmark trajectory-packs --goal-id "<goal-id>"
```

Pass the original `--runtime-root` if you supplied one. The toolkit exposes the
existing authority and evidence checks. See the
[capability guide](../../loopx/capabilities/benchmark_toolkit/README.md) for
benchmark families and execution prerequisites.

When using a matching Workspace wheel, restart Workspace after adding or
removing the toolkit. Research Analysis reads the same registered packs.
Remove the toolkit when you no longer need those commands. The existing Goal
registry, task history and analysis records remain in your runtime directory.

```sh
uv pip uninstall --python /tmp/loopx-core-env/bin/python loopx-capability-benchmark-toolkit
```
22 changes: 22 additions & 0 deletions packages/loopx-capability-benchmark-toolkit/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["setuptools==83.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "loopx-capability-benchmark-toolkit"
dynamic = ["version", "dependencies"]
description = "Optional Benchmark Toolkit for the matching LoopX Core release."
readme = "README.md"
requires-python = ">=3.11"
license = "Apache-2.0"
license-files = ["LICENSE", "NOTICE", "LICENSE-MIT"]

[tool.setuptools.dynamic]
version = {file = "VERSION"}
dependencies = {file = "requires-core.txt"}

[tool.setuptools.packages.find]
include = ["loopx.capabilities.benchmark_toolkit", "loopx.capabilities.benchmark_toolkit.*", "loopx.cli_commands"]

[tool.setuptools.package-data]
"*" = ["*.ts", "*.json", "*.mjs", "*.js", "*.md", "*.toml"]
8 changes: 7 additions & 1 deletion packages/loopx-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ To view the same work in your browser, install the matching
[`loopx-workspace` wheel](../loopx-workspace/README.md) in this environment and
start `loopx dashboard` with the original registry.

Core keeps the benchmark catalog and the four-arm contract it references.
Install the matching [Benchmark Toolkit wheel](../loopx-capability-benchmark-toolkit/README.md)
to run `loopx benchmark` or use registered analysis packs in Workspace.
`loopx capability show benchmark-toolkit` reports availability and installation
guidance. Normal discovery leaves benchmark execution unloaded.

Ordinary Core goal previews omit Issue Fix command templates. Install the
[matching workflow wheel](../loopx-capability-issue-fix/README.md) to select
`--capability-route issue-fix` or run `loopx issue-fix`. Core retains existing
Expand Down Expand Up @@ -131,7 +137,7 @@ new default, migration, automatic upgrade, PyPI publication or platform release.

This is the first independently installable core-artifact slice of R1/M3 in the
[small-kernel RFC](../../docs/architecture/rfcs/monorepo-distribution-split-v0.md).
It still retains built-in capability implementations, policy helpers and several
It still retains other built-in capability implementations, policy helpers and several
host/CLI dependencies because the current imports are coupled. This makes it a
workspace-free installation prerequisite, not a qualified minimal mechanism
closure. Those dependencies are migration debt, not evidence that every
Expand Down
Loading
Loading