Skip to content

fix(brain): scope planner examples by distro - #656

Merged
vladimirrott merged 3 commits into
lacs-project:mainfrom
dannyward630:fix/648-distro-filtered-plan-examples
Oct 25, 2026
Merged

vladimirrott merged 3 commits into
lacs-project:mainfrom
dannyward630:fix/648-distro-filtered-plan-examples

Conversation

@dannyward630

@dannyward630 dannyward630 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Build propose_plan parameter examples from the same distro-filtered action list as its enum and catalogue. Ubuntu no longer sees Fedora-only or Toolbox examples; retained Fedora examples keep their existing wording. This PR covers only propose_plan; query-tool filtering and matching prompt text are tracked in #657.

Related Issue

Closes #648

Validation

  • Tests added or updated (two distro-specific Rust regression tests)
  • Documentation updated if behavior changed
  • Security impact considered (the planner offers only actions allowed for the distro; daemon execution and privilege boundaries are unchanged)
  • Trust boundary preserved (daemon remains the only privileged executor)
  • CI passes (the Rust test baseline needs a maintainer refresh)

Notes for Reviewers

  • Review-driven narrowing removes planner.rs and query_tools.rs; the coordinated query-tool and prompt change is tracked in The planner offers Fedora-only query tools on Ubuntu, and Example B tells it to call one #657.
  • Exact-head GitHub CI ran 1,998 Rust tests: all 1,998 passed, with six skipped. The rust job fails afterward because the checked-in baseline says 1,996. Per the review request, the baseline artifact and three prose counts remain unchanged for the maintainer's Linux measurement. The container image and Rust analysis checks are still pending.
  • I did not run the full workspace suite locally; this Mac has Rust 1.95 while the repository requires Rust 1.96. The two proposal-specific tests passed in the earlier focused package run; the proposal source and tests are unchanged by the scope reduction.
  • AI assistance: Codex was used to implement and review this patch.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking #648 the morning it came free, @dannyward630. Filtering the examples through the same available_on check as the action_name enum is the right fix. Your test that compares each query tool's filter key with the action query_tool_to_action dispatches pins the drift I was worried about.

I reviewed 1285503b.

One change before this leaves draft. The query-tool filtering opens a gap in the prompt. On Ubuntu, query_tools_for_distro now drops query_packages, query_deployments, query_toolboxes, query_kernel_args, query_package_repos, query_deployment_history and the two Flatpak queries. The shared PREAMBLE still lists all of them under "Available query_* tools" (crates/sysknife-brain/src/prompt.rs:115-124), and Example B (prompt.rs:230) tells the model to call query_packages before an install. On an Ubuntu host the model would read about a tool, call it, and get "unknown tool" back. CLAUDE.md names that path, a query error followed by an unrelated plan, as one of the two failures the examples exist to prevent, and any change to what the prompt promises needs the E2E story suite.

You said on #648 you'd leave the query-tool part out if it needed its own decision, and it does. Please drop the query_tools.rs and planner.rs changes from this PR and keep it to the propose_plan examples. I'll file the query-tool list and the prompt text that names it as a separate issue, because the two have to move together.

Optional. The example table can be smaller. ParameterSection, ParameterLine and ParameterExample carry an action_separator, a template and a prefix_without_toolboxes, and most entries repeat the action name twice (("InstallFlatpak", "InstallFlatpak")). A list of (action, line) pairs per section, filtered by available_on, would render the same text from about a third of the code, and you could check it against the old string by eye. Your call.

Leave tests/evidence/workspace-tests.json and the three prose counts to me. I'll set them from the Linux run when this merges.

Thank you for this, and for being upfront about the macOS limit. It told me which runs to do on my side.

@vladimirrott

Copy link
Copy Markdown
Member

The query-tool and prompt follow-up is #657, so nothing from that part gets lost when you drop it here.

@dannyward630
dannyward630 force-pushed the fix/648-distro-filtered-plan-examples branch from 1285503 to 85d2191 Compare October 25, 2026 07:49
The table-driven params description put all four Identity examples on one
line, so a host that offers every action no longer got the text it had
before. Split the section back into its two original lines; with every
example offered the description is now byte-identical to the old literal.

Pin that layout in the Fedora test, and assert on Ubuntu that a section
whose actions are all withheld leaves no bare parameter line behind
(deleting either empty-check in parameter_description failed nothing
before). `available_on` goes back to private, since nothing outside the
module calls it now. Test count moves to 1,998.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dannyward630 thanks for turning this around so fast. Dropping the planner.rs and query_tools.rs half was the right call, and the Ubuntu description reads well: no Toolbox, no Layering, no Repos, and the Containers heading loses its "/Toolbox" suffix with the rest.

I pushed one commit on top (f5425058), since you allow maintainer edits:

  • Identity layout. The table put all four Identity examples on one line. I fed parameter_description every action the table names and diffed it against the old literal: that one line break was the only difference. I split the section back into its two lines, so a host that offers everything now gets the old text byte for byte, and the Fedora test pins it.
  • One more assertion on Ubuntu. I changed if actions.is_empty() to if false, and both tests stayed green. The mutant printed • Layering: : {"package":"vim"} and a bare target_ref line on Ubuntu. The Debian test now checks that • Layering, • Repos, target_ref and repo_url are absent, and that mutant fails along with the other three I tried (filter always true, prefix always the Toolbox one, empty-line check removed).
  • available_on went back to private. Nothing outside the module calls it once the query-tool change left.
  • Test count is 1,998, measured on Linux: 1,998 passed, 6 skipped.

Locally clippy is clean and the pre-commit and pre-push boards passed. I'll merge once CI agrees. Thanks as well for picking up #657.

@vladimirrott
vladimirrott merged commit edfb6f2 into lacs-project:main Oct 25, 2026
13 checks passed
@vladimirrott

Copy link
Copy Markdown
Member

Merged as edfb6f24, which closes #648. Thanks, @dannyward630. On Ubuntu the planner now sees parameter examples only for the actions it can propose, and #657 will bring the query tools and the prompt in line with it.

vladimirrott added a commit that referenced this pull request Oct 27, 2026
Minor release. #627 keys request_hash with an HMAC under the audit key
(chain_version 4; previews stored by an older release fail closed after
upgrading) and #639 changes the history request a newer CLI sends, so a
caller relying on the old behaviour notices: the middle digit moves.

Also: the planner sees only its host's distribution (#626, #656, #658,
#684), checkpoint and the MCP audit tools share the audit-store resolver
(#636), every workflow job has a time limit (#662), a weekly cargo audit
(#640), release hardening (#635, #637, #660), and every published figure
is rendered from its source (#685).


Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

propose_plan's params description lists Fedora-only and toolbox actions to Ubuntu hosts

2 participants