Skip to content

feat(agent): Add job cleanup playbook task in update_agent#6554

Open
20vikash wants to merge 3 commits into
frappe:developfrom
20vikash:agent-job-cleanup
Open

feat(agent): Add job cleanup playbook task in update_agent#6554
20vikash wants to merge 3 commits into
frappe:developfrom
20vikash:agent-job-cleanup

Conversation

@20vikash
Copy link
Copy Markdown
Contributor

Description
This calls Agent's agent-db-cleanup cli to setup DB cleanup crontab.

Related PR
Agent

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR adds a new Ansible task to the update_agent playbook that runs agent setup agent-db-cleanup to register a DB cleanup crontab for the frappe user. The task follows the same pattern as the other agent setup tasks already present in the file (become: yes, become_user: frappe, fixed binary path, chdir: /home/frappe/agent).

  • New task is placed logically after the "Update Agent" step and before log-ownership cleanup.
  • The agent CLI (/home/frappe/agent/env/bin/agent setup agent-db-cleanup) is expected to be idempotent; repeated playbook runs should not create duplicate cron entries, consistent with how other agent setup sub-commands work in this codebase.

Confidence Score: 5/5

Safe to merge — the change is a single Ansible task that follows the existing patterns in the file exactly.

The new task runs agent setup agent-db-cleanup using the same binary path, working directory, and privilege escalation as every other agent setup step in this playbook. No variables are interpolated into the command, so there is no injection surface.

No files require special attention.

Important Files Changed

Filename Overview
press/playbooks/roles/update_agent/tasks/main.yml Adds a single Ansible task to run agent setup agent-db-cleanup during agent updates, registering a DB cleanup crontab for the frappe user.

Sequence Diagram

sequenceDiagram
    participant Ansible
    participant AgentCLI as Agent CLI
    participant Cron as frappe crontab

    Ansible->>AgentCLI: "agent update {{ agent_update_args }}"
    AgentCLI-->>Ansible: done
    Ansible->>AgentCLI: agent setup agent-db-cleanup
    AgentCLI->>Cron: Register DB cleanup cron job
    Cron-->>AgentCLI: crontab updated
    AgentCLI-->>Ansible: done
    Ansible->>Ansible: Set log ownership (frappe:frappe)
    Ansible->>Ansible: Ensure Agent processes started (supervisorctl)
Loading

Reviews (5): Last reviewed commit: "fix(agent): Move cleanup task after agen..." | Re-trigger Greptile

@20vikash 20vikash force-pushed the agent-job-cleanup branch from b4f149c to a1331f5 Compare May 29, 2026 08: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.

2 participants