From aa186faf4289281ee595e73ed7dd3a2dd66fa67f Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Thu, 5 Nov 2026 08:13:55 +0800 Subject: [PATCH] test(quota): qualify complete inline CLI output Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Signed-off-by: huangruiteng --- .../contracts/interface-budget-contract.md | 18 ++++ ...cli-output-base-head-differential-smoke.py | 14 ++- .../testing/cli_output_budget.py | 18 ++-- tests/control_plane/test_cli_output_budget.py | 93 ++++--------------- .../test_cli_output_differential.py | 7 +- 5 files changed, 55 insertions(+), 95 deletions(-) diff --git a/docs/reference/contracts/interface-budget-contract.md b/docs/reference/contracts/interface-budget-contract.md index 7c50cac407..d8b949032e 100644 --- a/docs/reference/contracts/interface-budget-contract.md +++ b/docs/reference/contracts/interface-budget-contract.md @@ -452,6 +452,24 @@ three affected JSON surfaces; dense-to-dense changes retain ordinary limits. ### Canonical CLI fixture qualification +The historical quota policy rows explicitly use `--context-delivery off`, +including detail selectors and the TurnEnvelope variant. Their complete JSON +and Markdown, semantic keys, growth checks and ceilings remain unchanged. +Default progressive navigation is a different transport: the real File/SQLite +test follows its digest-bound recovery through every byte, checks the complete +policy and unchanged effect log, and rejects a modified capture. Navigation +and all recovery-page bytes are measured separately; a small descriptor is +neither a complete policy nor evidence of lower total model cost. Production +defaults are unchanged. Both differential arms import their own pinned product +with one frozen current caller fixture, so a fixture revision alone cannot +appear as a product output change. + +历史 quota 策略行显式使用 `--context-delivery off`,详情和 TurnEnvelope 变体同样适用; +完整正文、语义、增长和原预算保留。默认渐进导航另经真实 File/SQLite reader 完整补读、 +effect 日志不变与原捕获被改写后的拒绝验证。分别计量导航和全部补读字节,不将短导航 +冒充完整决策或模型成本收益;生产默认不变。两端各自导入已固定的产品版本,并共用 +同一份冻结的当前调用夹具,避免将夹具修订误计为产品输出变化。 + Ordinary CLI reads require canonical authority. Both differential arms explicitly back up and import the same complete synthetic source before measuring; fixture setup is outside the measured commands. On base `887d66551` and the read-retirement diff --git a/examples/control_plane/cli-output-base-head-differential-smoke.py b/examples/control_plane/cli-output-base-head-differential-smoke.py index d303940087..5bf7d9bce3 100644 --- a/examples/control_plane/cli-output-base-head-differential-smoke.py +++ b/examples/control_plane/cli-output-base-head-differential-smoke.py @@ -209,11 +209,15 @@ def main() -> int: temp_root = Path(temp) base_root = temp_root / "base" probe_runner = temp_root / "cli_output_probe_runner.py" + probe_test = temp_root / "cli_output_probe_fixture.py" semantics_source = temp_root / "cli_output_semantics.py" fixture_root = temp_root / "public-fixture" base_receipt = temp_root / "base-receipt.json" candidate_receipt = temp_root / "candidate-receipt.json" shutil.copy2(PROBE_RUNNER, probe_runner) + # Freeze one caller workload for both arms. Each subprocess still + # imports its own pinned product through source_root/PYTHONPATH. + shutil.copy2(PROBE_TEST, probe_test) shutil.copy2(FIXTURE_SUPPORT, temp_root / FIXTURE_SUPPORT.name) shutil.copy2(SEMANTICS_SOURCE, semantics_source) @@ -231,16 +235,10 @@ def main() -> int: cwd=REPO_ROOT, ) try: - base_probe_test = base_root / PROBE_TEST.relative_to(REPO_ROOT) - if not base_probe_test.is_file(): - raise RuntimeError( - "base ref is missing the CLI output probe source: " - f"{PROBE_TEST.relative_to(REPO_ROOT)}" - ) _run_probe( source_root=base_root, probe_runner=probe_runner, - probe_test=base_probe_test, + probe_test=probe_test, semantics_source=semantics_source, fixture_root=fixture_root, receipt_path=base_receipt, @@ -262,7 +260,7 @@ def main() -> int: _run_probe( source_root=REPO_ROOT, probe_runner=probe_runner, - probe_test=PROBE_TEST, + probe_test=probe_test, semantics_source=semantics_source, fixture_root=fixture_root, receipt_path=candidate_receipt, diff --git a/loopx/control_plane/testing/cli_output_budget.py b/loopx/control_plane/testing/cli_output_budget.py index 69d5b5bca7..792f691128 100644 --- a/loopx/control_plane/testing/cli_output_budget.py +++ b/loopx/control_plane/testing/cli_output_budget.py @@ -131,9 +131,9 @@ class CliOutputCommandClassification: ), CliOutputBudgetSpec( surface_id="quota_should_run", - command="quota should-run", + command="quota should-run --context-delivery off", owner="quota guard", - consumer_action="decide whether one agent may run", + consumer_action="inspect the complete inline quota policy", qualification_policy="absolute_hot_path", cold_path=( "status, history, active state, and repeatable --include-detail " @@ -438,7 +438,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_scheduler_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail scheduler", + command="quota should-run --context-delivery off --include-detail scheduler", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -448,7 +448,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_todo_summary_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail agent-todos", + command="quota should-run --context-delivery off --include-detail agent-todos", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -458,7 +458,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_user_todo_summary_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail user-todos", + command="quota should-run --context-delivery off --include-detail user-todos", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -468,7 +468,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_goal_boundary_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail goal-boundary", + command="quota should-run --context-delivery off --include-detail goal-boundary", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -478,7 +478,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_vision_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail vision", + command="quota should-run --context-delivery off --include-detail vision", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -490,7 +490,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_all_detail", parent_surface_id="quota_should_run", - command="quota should-run --include-detail all", + command="quota should-run --context-delivery off --include-detail all", output_formats=("json", "markdown"), semantic_json_keys=("interaction_contract", "scheduler_hint", "selected_todo"), markdown_anchor="# LoopX Quota Should Run", @@ -500,7 +500,7 @@ class CliOutputCommandClassification: CliOutputModeVariantSpec( variant_id="quota_should_run_turn_envelope", parent_surface_id="quota_should_run", - command="quota should-run --turn-envelope", + command="quota should-run --context-delivery off --turn-envelope", output_formats=("json", "markdown"), semantic_json_keys=("schema_version", "contract_capsule", "action_signature"), markdown_anchor="# LoopX Turn Envelope", diff --git a/tests/control_plane/test_cli_output_budget.py b/tests/control_plane/test_cli_output_budget.py index 8bbae8876b..745b6c716e 100644 --- a/tests/control_plane/test_cli_output_budget.py +++ b/tests/control_plane/test_cli_output_budget.py @@ -363,7 +363,11 @@ def _surface_commands( registry_path: Path, state_file: Path, output_format: str, + context_delivery: str | None = "off", ) -> dict[str, list[str]]: + # These ceilings characterize the complete inline policy, not its shorter + # file-navigation descriptor. Qualify default progressive recovery below. + delivery = ["--context-delivery", context_delivery] if context_delivery else [] common = [ "--registry", str(registry_path), @@ -412,7 +416,7 @@ def _surface_commands( GOAL_ID, "--agent-id", AGENT_IDS[0], - ], + ] + delivery, "loopx_turn_plan": common + [ "turn", @@ -551,6 +555,10 @@ def _mode_variant_commands( "--agent-scope", "Public CLI output qualification.", ] + quota = _surface_commands( + project=project, runtime=runtime, registry_path=registry_path, + state_file=state_file, output_format=output_format, + )["quota_should_run"] return { "start_goal_guided_command_pack_detail": [ "--format", @@ -583,82 +591,13 @@ def _mode_variant_commands( GOAL_TEXT, "--message-only", ], - "quota_should_run_scheduler_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "scheduler", - ], - "quota_should_run_todo_summary_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "agent-todos", - ], - "quota_should_run_user_todo_summary_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "user-todos", - ], - "quota_should_run_goal_boundary_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "goal-boundary", - ], - "quota_should_run_vision_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "vision", - ], - "quota_should_run_all_detail": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--include-detail", - "all", - ], - "quota_should_run_turn_envelope": common - + [ - "quota", - "should-run", - "--goal-id", - GOAL_ID, - "--agent-id", - AGENT_IDS[0], - "--turn-envelope", - ], + "quota_should_run_scheduler_detail": quota + ["--include-detail", "scheduler"], + "quota_should_run_todo_summary_detail": quota + ["--include-detail", "agent-todos"], + "quota_should_run_user_todo_summary_detail": quota + ["--include-detail", "user-todos"], + "quota_should_run_goal_boundary_detail": quota + ["--include-detail", "goal-boundary"], + "quota_should_run_vision_detail": quota + ["--include-detail", "vision"], + "quota_should_run_all_detail": quota + ["--include-detail", "all"], + "quota_should_run_turn_envelope": quota + ["--turn-envelope"], "loopx_turn_plan_transaction_detail": common + [ "turn", diff --git a/tests/control_plane/test_cli_output_differential.py b/tests/control_plane/test_cli_output_differential.py index 4c3000e1fb..536a0789c5 100644 --- a/tests/control_plane/test_cli_output_differential.py +++ b/tests/control_plane/test_cli_output_differential.py @@ -138,7 +138,8 @@ def test_over_budget_base_is_reported_before_candidate_failure_without_waiver( row_id="surface/quota_should_run/crowded/json", surface_id="quota_should_run", scenario="crowded", chars=chars, lines=1, ) - probes, git_commands = [], [] + probes, git_commands, workloads = [], [], [] + fixture_bytes = namespace["PROBE_TEST"].read_bytes() def git_transport(command, **_): git_commands.append(command) @@ -149,6 +150,7 @@ def git_transport(command, **_): def probe_transport(**kwargs): probes.append(kwargs["enforce_budget"]) + workloads.append((kwargs["probe_test"], kwargs["probe_test"].read_bytes(), kwargs["source_root"])) if not kwargs["enforce_budget"]: kwargs["receipt_path"].write_text(json.dumps(_receipt(row))) else: @@ -167,6 +169,9 @@ def probe_transport(**kwargs): with pytest.raises(AssertionError, match="baseline ceiling"): main() assert probes == [False, True] + assert workloads[0][0] == workloads[1][0] + assert all(body == fixture_bytes for _, body, _ in workloads) + assert workloads[0][2] != workloads[1][2] assert "remove" in git_commands[-1] output = capsys.readouterr().out prefix = "cli-output-base-current-ceilings "