Skip to content

n,,,[T3374] FIX: batch and commit the communication attachment vacuum - #2136

Merged
Danielgergely merged 3 commits into
14.0from
T3374-vacuum-attachments
Aug 17, 2026
Merged

n,,,[T3374] FIX: batch and commit the communication attachment vacuum#2136
Danielgergely merged 3 commits into
14.0from
T3374-vacuum-attachments

Conversation

@Danielgergely

Copy link
Copy Markdown
Member

The vacuum ran as inline code on the cron, deleting every match in one transaction. Once a busy week crossed the rolling 2-year cutoff it could no longer finish within the 300s limit, and each timeout discarded the work and retried the same slice — livelocking every scheduled action

The vacuum ran as inline code on the cron, deleting every match in one
transaction. Once a busy week crossed the rolling 2-year cutoff it could
no longer finish within the 300s limit, and each timeout discarded the
work and retried the same slice — livelocking every scheduled action
@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Expired direct attachments on communication jobs without wrapper records are not removed, so the cleanup cannot reliably reclaim all eligible storage.

One actionable non-security failure remains in the attachment-vacuum path. Danielgergely stated that the next commit would address the issue, but the current attachment_ids != False filter still excludes an expired job that has a direct attachment and no wrapper.

Files Needing Attention: partner_communication/models/communication_job.py

T-Rex T-Rex Logs

What T-Rex did

  • Executed the wrapperless repro with the exact before/after commands; observed direct_attachment_deleted: True before and direct_attachment_deleted: False after, and the comparison reported reproduced.
  • Encountered environment blockers: importing Odoo fails with ModuleNotFoundError and pg_isready/psql are not installed, blocking full publication of the proof.
  • Produced proof for a posted P1 finding and directed reviewers to the corresponding review comment for details.
  • Noted that the uploaded evidence references did not include the required labels, so they cannot be published as a complete severity-bearing proof.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Vacuum skips direct attachments on wrapperless old jobs

    • Bug
      • The current batch job search requires attachment_ids != False. An old job that only has a direct ir.attachment has no wrapper and is excluded, so the subsequent direct-attachment lookup cannot include its ID and the attachment remains indefinitely.
    • Cause
      • The wrapper-presence predicate was added before querying direct ir.attachment rows, conflating wrapper-backed jobs with jobs that may have direct attachments.
    • Fix
      • Search all old jobs (remove ("attachment_ids", "!=", False)) before querying direct attachments, or separately union old jobs with wrappers and old jobs referenced by ir.attachment; retain batching/progress semantics so wrapperless jobs do not cause repeated empty batches.

    T-Rex Ran code and verified through T-Rex

Reviews (3): Last reviewed commit: "[T3374] REF: drop the vacuum cursor, kee..." | Re-trigger Greptile

Comment thread partner_communication/models/communication_job.py
Comment thread partner_communication/models/communication_job.py Outdated
- kept already existing & tested version, and only improve it slightly
- removed unnecessary complexity
Comment thread partner_communication/models/communication_job.py
@Danielgergely
Danielgergely merged commit c1f7bb1 into 14.0 Aug 17, 2026
2 checks passed
@Danielgergely
Danielgergely deleted the T3374-vacuum-attachments branch August 17, 2026 13:54
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