Skip to content

fix(slm): a limited ansible run proves every host it names, not just one (#19766) - #20434

Closed
mrveiss wants to merge 2 commits into
mainfrom
issue-19766-limit-proof
Closed

mrveiss wants to merge 2 commits into
mainfrom
issue-19766-limit-proof

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

limit_run_failure accepted an exit-0 run when any named host beyond localhost had run. With several hosts, one that ran covered for one that was skipped, and the run reported success for a node that did nothing.

What Changed

  • services/ansible_utils.py: every non-localhost host in the limit needs ok>=1 in the last recap, or the run fails and names those that did not. The tolerance for group names is gone.
  • execute_playbook(must_run=...) narrows that. Self-update passes only the SLM's own node: its limit adds every row at the machine's IP, including stale rows and rows no play targets, and a false failure after a working update clears the resume plan and marks the stage failed. Co-located rows that did not run are printed as a NOTE, and fail nothing. This is narrower than the issue's text, on purpose; noted on fix(slm): an exit-0 ansible run limited to several hosts passes when only one of them ran #19766.

Verification

test_fleet_skip_lines_are_not_failures_19762.py and playbook_executor_limit_proof_19762_test.py pass locally; only these. New: two named hosts with one skipped fails and names only it, both ran passes, an all-skipped host (ok=0) fails, self-update passes with a stale row and prints it, and fails if the SLM node itself did not run. The single-host and mixed-play cases from #19762 are unchanged. No real fleet run.

Worth reviewing:

  • Group names: I read the limit at every execute_playbook caller, and they pass node ids or inventory names, not groups. api/infrastructure.py takes free limit_hosts but builds its own command, so this proof does not apply there. A future caller passing a group would read as a host that did not run; a test pins that.
  • The strict rule stays for the multi-host callers, which each pass a list someone chose: settings.py and llm_config.py (request.node_ids, both with --tags), updates.py (node_ids), secrets.py (nodes of the dependent roles), setup_wizard.py (reachable nodes). A host there with ok=0, from a --tags run matching nothing or all tasks skipped, now fails the run; single-host runs already did. Not run on a real fleet.
  • updates.py falls back to a bare IP when it finds no inventory name. Such a run now fails naming the IP.

Model Used

Claude Opus 5.5

Closes #19766

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

limit_run_failure now fails when any non-localhost entry in the limit is absent from the last recap or has ok < 1. Tests cover missing and present hosts, and the updated failure message.

Changes: Limit run proof

Layer / File(s) Summary
Per-host limit check
autobot-slm-backend/services/ansible_utils.py, autobot-slm-backend/services/playbook_executor_limit_proof_19762_test.py, autobot-slm-backend/tests/api/test_fleet_skip_lines_are_not_failures_19762.py
The check reports limit entries that are absent from the last recap or have ok < 1. Tests cover missing hosts, hosts that ran, and the updated error message.

Severity of issue fixed: Medium

Merge Risk: Minimal · previous review b7b5d

The stricter limit check requires successful-task evidence for every named remote host. No new merge-blocking issue is established; the infrastructure API's existing completion-check gap remains a separate follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a limited Ansible run must prove every host it names ran, not just one. The raw summary confirms that limit_run_failure now fails when any non-localhost host named in …
Linked Issues check Passed Issue #19766 requires proof for every non-localhost limit entry. limit_run_failure reads the last PLAY RECAP and reports each entry that is absent or has ok < 1. The tests cover two named hosts …
Out of Scope Changes check Passed The changes are limited to the limit-proof logic and its focused tests. The group-name test verifies the stated removal of group tolerance. The test updates support issue #19766 behaviour. No unrelate…
Full details: Title check

Explanation

The title names the main change: a limited Ansible run must prove every host it names ran, not just one. The raw summary confirms that limit_run_failure now fails when any non-localhost host named in the limit is missing from the recap or has ok < 1. The title is specific and matches the linked issue objective. It uses a conventional commit prefix and an issue reference, which is acceptable.

Full details: Linked Issues check

Explanation

Issue #19766 requires proof for every non-localhost limit entry. limit_run_failure reads the last PLAY RECAP and reports each entry that is absent or has ok &lt; 1. The tests cover two named hosts with one skipped, both named hosts running, localhost-only behaviour, and the existing single-host and mixed-play cases from #19762. The executor test also confirms that the failed result names the missing host and that a complete recap succeeds.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the limit-proof logic and its focused tests. The group-name test verifies the stated removal of group tolerance. The test updates support issue #19766 behaviour. No unrelated change is demonstrated.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up Comments

Major follow-up Apply the per-host limit check to the infrastructure API run.

88-88: Major · Functional Correctness · Quick win

Apply the per-host limit check to the infrastructure API run.

_run_playbook marks a limited run COMPLETED when any host ran. A named host can still be skipped. This path predates the change, but this PR's rule does not reach it. Call limit_run_failure(text, limit_hosts) after ansible_run_failure returns None.

Suggested fix

Add limit_run_failure to the existing import from services.ansible_utils. The import line was not inspected, so the diff covers only the call site.

-        failure = ansible_run_failure(text, None, process.returncode)
+        failure = ansible_run_failure(text, None, process.returncode) or limit_run_failure(text, limit_hosts)

Note: this behaviour predates this PR (already present at merge base 04c4ed79941d); the change keeps it reachable.

Open the source location


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 04c4ed7 and b7b5dc7.

Files selected for processing: 3
  • autobot-slm-backend/services/ansible_utils.py
  • autobot-slm-backend/services/playbook_executor_limit_proof_19762_test.py
  • autobot-slm-backend/tests/api/test_fleet_skip_lines_are_not_failures_19762.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20434 (head a7e2789): approve. Delta since b7b5dc7, read only: self-update requires only its own node to have run, and co-located rows that did not run print as a note. Strict stays for the five named callers. Risk: --tags on the strict multi-host callers can now fail where a tag matches nothing on one host; not run on a fleet. Narrower than the issue text, as noted there.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Landed via the merge train (PR #20458), main 0dbb02f.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Closed: 0 changed files; the content is on main via the merge train (PR #20458).

@mrveiss mrveiss closed this Nov 1, 2026
@mrveiss
mrveiss deleted the issue-19766-limit-proof branch November 1, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(slm): an exit-0 ansible run limited to several hosts passes when only one of them ran

1 participant