Skip to content

bug(deploy): a role's source path depends on the playbook's folder, so a deploy can restore months-old code #20509

Open
1 of 1 issue completed

Description

@mrveiss

Problem

A role deploy can silently put months-old code on a host. On the local install at 64943e3, the Full-Tree Drift Check showed autobot-ai-stack/ai_api_server.py differing from source by 31 lines, dated that day.

roles/ai-stack/tasks/main.yml:297-298 copied from {{ playbook_dir }}/../../../autobot-infrastructure/.... playbook_dir changes with where the playbook lives:

Playbook in Those three .. reach
ansible/playbooks/ the repo root, correct
ansible/ one level above the repo root

The log for that run shows the source as <code_source>/autobot-slm-backend/ansible/../../../autobot-infrastructure/..., so it read a sibling autobot-infrastructure directory beside code_source. That directory is stale: 926 files, with none changed since before July. The file there is 363 lines against 382 on main, and lacks the #16428 validation handler. The service restarted on it.

Same pattern, also under roles/: monitoring/tasks/grafana.yml, slm_manager/tasks/grafana.yml, slm_manager/tasks/main.yml (autobot_shared), and _shared/tasks/clear_venv_husks.yml and stage_shared_manifests.yml.

Not known: who started the playbook that ran, and whether the other sites have also copied stale files on a host.

Acceptance criteria

Activity

  1. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20598, merge 87eae8acf8) via #20515

  2. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Verified against origin/main after the merge train (PR #20598) landed (#20515 is a member).

    AC Evidence
    No role resolves repo files through playbook_dir; same path from either depth (test, real run from both) NOT MET. The ten role sites now use {{ role_path }}/../../../../, but roles/_shared/tasks/clear_venv_husks.yml:39, stage_shared_manifests.yml:43,56 still fall back to playbook_dir, and install_agent_autobot_shared.yml:26 derives from `playbook_dir
    A guard fails on the pattern under roles/ repo_tests/role_source_paths_depth_proof_20509_test.py: test_no_role_reaches_the_repo_through_playbook_dir, test_contrast_the_old_form_is_caught, test_the_ai_stack_copies_from_its_own_tree.
    Host: drift check shows autobot-ai-stack matching source after a builtin update NOT MET. Needs a host update and output.
    Stale directory proposed through the review queue (#17038) NOT MET. No proposal found in the change; a related fallback is filed as #20520 (open).

    Stays open for AC 1 (partly), 3 and 4.

  3. github-actions commented on Nov 14, 2026

    @github-actions
    Contributor

    Landed in #21435, merge 5b3508e8db

  4. mrveiss commented on Nov 14, 2026

    @mrveiss
    OwnerAuthor

    Closure pass against origin/main at 5b3508e8db (#21435) plus read-only checks on the local node.

    Criterion Verdict Evidence
    No role resolves repo files through playbook_dir unchecked git grep -n playbook_dir origin/main -- autobot-slm-backend/ansible/roles still shows a read in roles/_shared/tasks/install_agent_autobot_shared.yml:37 (shared_parent: ... default(playbook_dir | dirname | dirname | dirname, true)). It is a fallback when code_source_dir is unset, and the file argues its derivation is proven, but the criterion says no role resolves through playbook_dir. The other _shared tasks (clear_venv_husks.yml, stage_shared_manifests.yml) now only mention it in a task name. A real run from both playbook depths is not evidenced here.
    A guard fails on the pattern under roles/ ticked earlier repo_tests/role_source_paths_depth_proof_20509_test.py (test_no_role_reaches_the_repo_through_playbook_dir, with contrast test test_contrast_the_old_form_is_caught).
    Host: after a builtin update, the drift check shows autobot-ai-stack matching source, output pasted unchecked The drift check is GET /code-sync/drift/full (api/full_tree_drift.py), which needs an authenticated user; no recorded result exists in the service logs. Supporting read-only evidence only: the installed autobot-ai-stack/ai_api_server.py has sha256 3bed8e13e255a4558ba06c0ea60f0ef5938b3dd45fc849d127dfbb3213332cfe, identical to origin/main:autobot-infrastructure/shared/docker/ai-stack/ai_api_server.py. That is not the drift-check output the criterion asks for. Satisfied by: an authenticated call to that endpoint after the update, pasting the autobot-ai-stack component row.
    Stale directory proposed through the review queue (#17038) unchecked No proposal found in the merged change.

    Stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions