Skip to content

fix(ansible): auto-detect WSL2 and set correct ai_stack_host per deployment (#3503)#3516

Merged
mrveiss merged 2 commits intoDev_new_guifrom
issue-3503
Apr 5, 2026
Merged

fix(ansible): auto-detect WSL2 and set correct ai_stack_host per deployment (#3503)#3516
mrveiss merged 2 commits intoDev_new_guifrom
issue-3503

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 5, 2026

Summary

  • Adds WSL2 detection in the backend Ansible role by reading /proc/version on each target host at deploy time
  • If the host is WSL2 (contains microsoft) and backend_ai_stack_host is still the default 127.0.0.1, overrides it to 10.255.255.254 (WSL2 mirrored networking loopback IP)
  • The when: backend_ai_stack_host == '127.0.0.1' guard preserves any explicit operator override (e.g. pointing at a remote AI stack VM)
  • Every subsequent reprovisioning run will now produce a correct AUTOBOT_AI_STACK_HOST in the env file without any manual intervention

Closes #3503

Test plan

  • Deploy to a WSL2 backend host — verify AUTOBOT_AI_STACK_HOST=10.255.255.254 in /etc/autobot/autobot-backend.env
  • Deploy to a native Linux host — verify AUTOBOT_AI_STACK_HOST=127.0.0.1 (unchanged)
  • Deploy with backend_ai_stack_host explicitly set in inventory — verify override is not clobbered

🤖 Generated with Claude Code

mrveiss and others added 2 commits April 5, 2026 21:48
…3503)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…#3503)

Detect WSL2 at deploy time by reading /proc/version on each target host.
When the host is WSL2 and backend_ai_stack_host has not been overridden
from the default 127.0.0.1, set it to 10.255.255.254 (the WSL2 mirrored
networking loopback IP). This ensures every re-provisioning produces a
correct AUTOBOT_AI_STACK_HOST in the env file without any manual override.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Copy link
Copy Markdown
Owner Author

@mrveiss mrveiss left a comment

Choose a reason for hiding this comment

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

Code review complete. No issues found in the PR changes.

Review findings

Variables and defaults: backend_ai_stack_host and backend_ai_stack_port are both defined in roles/backend/defaults/main.yml (the same bug caught in PR #3513 — missing defaults — does not apply here). The template uses them without | default() guards, which is consistent with every other role-variable usage in backend.env.j2 and safe given the defaults.

WSL2 detection logic: The /proc/version slurp + b64decode | lower | search('microsoft') chain is correct and idiomatic Ansible. failed_when: false ensures graceful degradation on non-Linux hosts. The backend_ai_stack_host == '127.0.0.1' guard correctly preserves any explicit operator override.

Task ordering: The WSL2 detection tasks (lines 35–50 of tasks/main.yml) execute before the env template deployment task (line 64), so the overridden value is in scope when backend.env.j2 is rendered.

CI failure: The code-quality check fails on 20 Python files that this PR did not touch (analytics_code_generation_test.py, hooks.py, standardized_agent.py, etc.). This is pre-existing Black formatting drift on the base branch, not introduced by this PR. The PR changes only Ansible YAML files.

Conclusion: Fix is complete and correct. Merging.

@mrveiss mrveiss merged commit 8123ba8 into Dev_new_gui Apr 5, 2026
3 of 4 checks passed
@mrveiss mrveiss deleted the issue-3503 branch April 5, 2026 19:16
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.

1 participant