Skip to content

test(harness-ops): add behavior-probes cases for autocompact window precedence - #10351

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-6930-40390872508-1
Oct 26, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-6930-40390872508-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #6930

Summary

Opened by the work-resolve-issue lane. The run's own summary:

behavior-probes gains a prints outcome that judges the first non-blank line a slash command prints, a per-case cli_args list restricted to allowed flag-value pairs (today only --autocompact), and PROBE_MODEL for scaffolds. A new autocompact area holds the three precedence cases the 2026-10-13 decision approved (per-model over top-level in one project file, the flag over settings, the env var over the flag) plus a base control, and each case runs /autocompact with no argument. Live confirmation is left to an attended session.

Remaining work

  • One capped live run of the autocompact area in an attended session (4 cases, each with max_budget_usd 0.25, with --max-runs and --max-cost-usd stated before it starts), confirming whether claude -p prints the window without a metered turn, then adding the outcome to records.md
  • Point context-guard's dated precedence observation (plugins/context-guard/reference/reader-contract.md) at the autocompact cases once a live run passes
  • Rows 1 and 2 (user scope: /autocompact's save location, project top-level over user per-model) and their runner changes (per-case CLAUDE_CONFIG_DIR isolation), deferred until the owner asks, per the 2026-10-13 decision

Not verified

  • probe.py's unittest suite (probe.test.sh), probe.py validate and probe.py run --dry-run were not executed: this lane runs no Python interpreter and check-affected skips checks that run code from the checked tree. They were traced by hand in review only. Left to the PR's plugin-test CI.
  • ruff lint of probe.py and test_probe.py was not run (no interpreter or ruff wrapper available in this lane); left to CI
  • The stream shape of claude -p running /autocompact (a <local-command-stdout> user message or the result text) and the printed line's wording are assumptions. The dry-run examples (Auto-compact window: 250k and so on) are placeholders, and the first live run must confirm them or correct
  • skill-quality changed-skills, typos and the CI-only scanners listed by check-affected did not run here; left to CI
  • records.md has no record for the autocompact cases: a record needs a live run, which this lane cannot make

Fix

  • plugins/harness-ops/skills/behavior-probes/scripts/probe.py: prints outcome (validation in case_problems/print_problems, print_verdict reading <local-command-stdout> output or the result text when no model turn ran, optional printed_match that makes an unrecognized line inconclusive), fake
  • plugins/harness-ops/skills/behavior-probes/scripts/test_probe.py: tests for the prints verdict (pass, first line only, result fallback, model answer inconclusive, printed_match shape), control chains and loops, cli_args pairs (rejecting bare tokens such as Bash(*) and update), argv order, the au
  • plugins/harness-ops/skills/behavior-probes/SKILL.md: documents the prints outcome, text_match/printed_match/example, cli_args, PROBE_MODEL, prints controls, and the autocompact area, including that print-mode output stays unconfirmed until the first live run
  • plugins/harness-ops/skills/behavior-probes/cases/lib/autocompact-project.sh: writes the case's project .claude/settings.json with a top-level autoCompactWindow and, optionally, a modelSettings entry keyed to PROBE_MODEL
  • plugins/harness-ops/skills/behavior-probes/cases/autocompact/project-top-level-window-applies/*: base control, project top-level 250000, expects 250k
  • plugins/harness-ops/skills/behavior-probes/cases/autocompact/project-per-model-beats-top-level/*: project top-level 250000 plus modelSettings.claude-sonnet-5-5 400000, expects 400k, control = base
  • plugins/harness-ops/skills/behavior-probes/cases/autocompact/flag-beats-project-settings/*: project top-level 250000 plus --autocompact 200000, expects 200k, control = base
  • plugins/harness-ops/skills/behavior-probes/cases/autocompact/env-beats-flag/*: as flag case plus CLAUDE_CODE_AUTO_COMPACT_WINDOW=150000, expects 150k, control = flag case
  • .changes/harness-ops/test-autocompact-window-probes-6930a7c1.md: minor changelog fragment for harness-ops

Verification

The runner ran each check from the base copy against 19e4b6a:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //code.claude.com/docs/en/model-config (Set the auto-compact window): /autocompact with a value saves under the current model in user modelSettings, a per-model window beats the top-level autoCompactWindow in the same file, --autocompact overrides saved settings for one launch, CLAUDE_CO
  • read https: //code.claude.com/docs/en/settings-reference (modelSettings): entries are written under the model's canonical name such as claude-opus-5-5, and aliases match the same entry; autoCompactWindow there takes 100000 to 1000000 or "auto"
  • read https: //code.claude.com/docs/en/commands (/autocompact row): with no argument it opens a dialog showing the current window, and with a value it saves to user settings
  • read https: //code.claude.com/docs/en/cli-reference (--autocompact, --setting-sources, --settings rows): --autocompact sets the window for the session without changing saved settings
  • read https: //platform.claude.com/docs/en/about-claude/models/overview: claude-sonnet-5-5 has a 1M-token context window, so 400k is not capped
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: all 5 fragments valid
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 11 passed, 5 skipped (checks that run code from the checked tree, and typos, which is not installed), over 21 changed files
  • cant-fail-scan --file plugins/harness-ops/skills/behavior-probes/scripts/test_probe.py --check: PASS, 51 test blocks, no gating findings
  • fresh-context review subagent over the whole diff: by hand-tracing, all tests, validate and the dry run pass; it reported a cli_args bare-token widening hole, non-window output being graded fail, an unescaped model id in the scaffold JSON, and an undetected control loop, and all four were fixed
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40390872508

Left out: the items under Not verified.

Related

#6930

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 19e4b6a2a2803064f758beded379032fe9206326: 0 finding(s), 0 as inline comments.

No security issues found in this pull request.

No changed file matches a trusted path. The diff touches no plugin manifest, trust control, merge hold, token broker input, or kill switch. It adds no standing instruction and deletes none.

What I checked:

  • cli_args allowlist (probe.py). Only --autocompact is permitted, and its value must fully match auto|\d+[kKmM]?.
    • cli_args_ok requires a list of even length made of flag-value pairs, so a bare token such as Bash(*) or update is rejected.
    • A value cannot smuggle a second flag. The argv is a list with no shell, and the full match rejects embedded spaces or a leading --.
    • run_case re-checks cli_args before launch, so a case that skips validate still cannot widen the launch.
    • The args are appended after the fixed flags, so they cannot remove the permission or tool-list flags.
  • PROBE_MODEL and autocompact-project.sh.
    • The model id comes from the case or the operator's --model, not from untrusted PR text at runtime. The script also checks it against ^[A-Za-z0-9._:-]+$ before writing it as a JSON key.
    • The window values are fixed numeric literals in each case's scaffold.sh.
    • The settings file is written under $PROBE_WORKDIR/.claude/ in a temp directory, never to the user's settings.
  • Cases. Every prompt is the bare /autocompact, which opens a dialog and saves nothing. The only env entry is CLAUDE_CODE_AUTO_COMPACT_WINDOW=150000. No tool grants are added.
  • Stream parsing and verdicts. COMMAND_OUTPUT and ANSI are linear regexes over the CLI's own output. verdict_only still blanks the saved text. A case that prints nothing, or prints a line not shaped like printed_match, comes back inconclusive, not pass. apply_controls now iterates to a fixed point and case_problems rejects control loops, so a pass cannot survive a failed control. This does not weaken the existing deny and refused control logic.
  • PR context. The description holds no embedded instructions aimed at the lane.

Spend: live runs of these cases would use prepaid API credit (4 cases at max_budget_usd 0.25 each). The PR leaves the live run to an attended session. It is not a hold and not a counted finding.

manifest fields: not hit (no plugin.json or marketplace.json change).
critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 19e4b6a2a2803064f758beded379032fe9206326: 0 finding(s), 0 as inline comments.

Code review: no blocking findings.

I read the full diff (21 files), the PR context and the surrounding probe.py (build_argv, live_runner, child_env, run_suite). I ran nothing, because this lane has no shell or interpreter. Everything below comes from reading the code, not from running it.

Checked and found consistent

  • cli_args is validated twice, in case_problems and again in run_case. Each flag must be in CLI_FLAGS and each value must match that flag's regex via fullmatch. Bare tokens, a missing value, and a value with an embedded space are all rejected. The args are appended after the fixed flags, and the prompt goes over stdin, so they cannot displace it.
  • apply_controls repeats until nothing changes, so a control that is itself controlled downgrades every dependent case. print_problems catches a control loop that includes the case and one that does not. It also rejects a control whose example already satisfies the case's text_match.
  • PROBE_MODEL matches the model the live run uses. run_suite copies the resolved model into the case, and build_argv reads case.get("model", model). autocompact-project.sh checks the model id against a plain-name regex before writing it into the JSON key.
  • The env field passes through child_env, which filters the operator's environment through an allowlist. CLAUDE_CODE_AUTO_COMPACT_WINDOW therefore reaches only env-beats-flag. The runner's --setting-sources project,local setting keeps user-scope settings out of the other cases.
  • No case passes an argument to /autocompact, and a test enforces that. So no case writes to the operator's user settings.
  • The changelog fragment is bump: minor for an added outcome type and area, which fits SemVer.
  • No manifest files changed, so there are no manifest checks to report.
  • No file under the lane's trusted-path globs changed.

Left as the author reported (not findings)

  • Whether claude -p prints the /autocompact window without a model turn is unconfirmed. The PR says so, and SKILL.md and the changelog say so too. The prints verdict handles the failure case by returning inconclusive rather than fail. The live run is listed as remaining work.
  • The Python tests, validate, the dry run and ruff were not run, by the author or by me. They are left to the plugin-test CI.
  • The PR context names no closing issue with acceptance criteria beyond Refs: #6930. There was nothing to check against beyond the PR description.

Spend: the later live run (4 cases at up to $0.25 each) draws on prepaid API credit only. It is not a hold and not a finding.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 19e4b6a2a2803064f758beded379032fe9206326.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 38106df Oct 26, 2026
41 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-6930-40390872508-1 branch October 26, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants