Refactor Ansible pi_agent/plannotator vars to shared base + host-local combine - #106
Merged
Conversation
…+local combine
MCP servers, settings overrides, subagent overrides, and plannotator
thinking levels were duplicated (or partially duplicated) across
group_vars/all.yml and host_vars/{home,work}/vars.yml. Split each into
a *_base (group_vars) and *_local (host_vars) dict, merged via
combine(recursive=True), so shared values live in one place and hosts
only declare their deltas.
Also restores ansible_python_interpreter in host_vars/home/vars.yml,
which had been accidentally commented out.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAnsible Pi agent configuration now combines shared base values with host-local overrides for MCP servers, agent settings, subagent behavior, and Plannotator thinking levels. Home and work hosts provide their configurations through the new local override variables. ChangesPi agent configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
boga
marked this pull request as ready for review
July 21, 2026 08:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
MCP servers, settings overrides, subagent overrides, and plannotator thinking
levels were duplicated (or partially duplicated) across
group_vars/all.ymland
host_vars/{home,work}/vars.yml. One entry (pi_agent_mcp_servers) evencarried an explicit comment warning that
workredefines the whole dict infull and must be kept manually in sync — a drift risk on every future edit.
Approach
Reused the existing
combine(recursive=True)pattern already used elsewherein this repo: a
*_basedict ingroup_vars/all.ymlholding values sharedacross hosts, and an optional
*_localdict per host_vars file holding onlythe deltas. The final var is computed once in
group_vars/all.ymlviahostvars[inventory_hostname].get('..._local', {}), so hosts that don'toverride anything just omit the
_localvar.Considered leaving per-host vars fully duplicated (status quo) but rejected it
since it's exactly the kind of drift the MCP servers comment already flagged.
How it works
pi_agent_mcp_servers_base(context-mode, context7, intellij-idea) +per-host
pi_agent_mcp_servers_local(work adds notion/new-relic/linear/n8n).pi_agent_settings_overrides_base(collapseChangelog,enableInstallTelemetry) + per-hostpi_agent_settings_overrides_local(
enabledModels), rendered back to a JSON string viato_jsonsinceroles/pi_agent/tasks/settings.ymlstill expects a JSON string it canfrom_jsonat apply time.pi_agent_subagent_overrides_base(thinking levels identical on both hoststoday) + per-host
pi_agent_subagent_overrides_local(model assignments andextra per-agent fields like
maxExecutionTimeMs/defaultContext), mergedrecursively so per-agent dicts combine field-by-field rather than replace.
pi_plannotator_thinking_base(planning/executing/reviewinglevels,identical on both hosts today) + a
pi_plannotator_thinking_localhook forfuture per-host deviation;
pi_plannotator_*_modelstay host-specific sincethey differ entirely per host (openai-codex vs anthropic).
Verified the merged output for both hosts matches the pre-refactor values
exactly (simulated the combine + to_json logic), and confirmed
yamllint/ansible-lintreport no new violations. Also restoredansible_python_interpreterinhost_vars/home/vars.yml, which had beenaccidentally commented out.
Consumer-facing variable names (
pi_agent_mcp_servers,pi_agent_settings_overrides,pi_agent_subagent_overrides,pi_plannotator_*_thinking) are unchanged, sosite.yml, thepi_agent/git/config_files/cproles, andtemplates/pi/plannotator.jsonall resolve thesame final values with no code changes needed.
Links
Summary by CodeRabbit