← Back to Pull requests

[16.0][IMP] queue_job: retry concurrency errors wrapped in other exceptions #1013

Open
unknown opened this pull request with 412 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 20, 2026 10:57 UTC
Author

A job that fails with a serialization failure, deadlock or lock timeout is retried only if the error reaches the runner as an OperationalError. When some code wraps it in another exception (Odoo does it in auth_signup, for example), the job fails and is never retried.
The runner now looks for the concurrency error in the exception chain before deciding. Errors raised by the job itself and any other error behave as before.

Example of job failed with this kind of error and not retried:


<img width="1249" height="740" alt="image" src="https://github.com/user-attachments/assets/ec67cfe9-ee06-4046-ba2c-d6b276a4ff2f" />

Exception Information
Exception:odoo.addons.auth_signup.models.res_partner.SignupError
Traceback (most recent call last):
  File "/home/ricard/odoo/odoo16/odoo/addons/auth_signup/models/res_users.py", line 145, in _create_user_from_template
    with self.env.cr.savepoint():
  File "/home/ricard/odoo/odoo16/odoo/odoo/sql_db.py", line 82, in __exit__
    self.close(rollback=exc_type is not None)
  File "/home/ricard/odoo/odoo16/odoo/odoo/sql_db.py", line 86, in close
    self._close(rollback)
  File "/home/ricard/odoo/odoo16/odoo/odoo/sql_db.py", line 110, in _close
    self._cr.flush()
  File "/home/ricard/odoo/odoo16/odoo/odoo/sql_db.py", line 134, in flush
    self.transaction.flush()
  File "/home/ricard/odoo/odoo16/odoo/odoo/api.py", line 899, in flush
    env_to_flush.flush_all()
  File "/home/ricard/odoo/odoo16/odoo/odoo/api.py", line 763, in flush_all
    self[model_name].flush_model()
  File "/home/ricard/odoo/odoo16/odoo/odoo/models.py", line 5676, in flush_model
    self._flush(fnames)
  File "/home/ricard/odoo/odoo16/odoo/odoo/models.py", line 5778, in _flush
    model.browse(ids)._write(vals)
  File "/home/ricard/odoo/odoo16/odoo/odoo/models.py", line 3917, in _write
    cr.execute(query, params + [sub_ids])
  File "/home/ricard/odoo/odoo16/odoo/odoo/sql_db.py", line 324, in execute
    res = self._obj.execute(query, params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.SerializationFailure: could not serialize access due to concurrent update


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ricard/odoo/worktrees/queue-job-pristine/queue_job/controllers/main.py", line 155, in _runjob
    cls._try_perform_job(env, job)
  File "/home/ricard/odoo/worktrees/queue-job-pristine/queue_job/controllers/main.py", line 102, in _try_perform_job
    job.perform()
  File "/home/ricard/odoo/worktrees/queue-job-pristine/queue_job/job.py", line 533, in perform
    self.result = self.func(*tuple(self.args), **self.kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ricard/odoo/worktrees/queue-job-demo/queue_job_demo/models/queue_job_demo.py", line 23, in create_portal_user
    return self.env["res.users"].sudo()._create_user_from_template(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ricard/odoo/odoo16/odoo/addons/auth_signup/models/res_users.py", line 149, in _create_user_from_template
    raise SignupError(ustr(e))
odoo.addons.auth_signup.models.res_partner.SignupError: could not serialize access due to concurrent update

Diff: 412 lines (+309 / -103) across 5 files Reviewer: RicardCForgeFlow Review duration: 60273m
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 412 lines diff across 5 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.360
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1013"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 44.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 51.9% (MEDIUM) · Higher = larger blast radius
51.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 44.7% · Lower = rushed or shallow review
44.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 28.7% · Safe to merge
28.7%
Repository