← Back to Pull requests

fix(subscriptions): release advisory locks when the lock connection reconnects on a new session #24

Open
unknown opened this pull request with 297 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 19, 2026 16:25 UTC
Author

  • A subscription's advisory lock lives only as long as the database session that took it, but the event store only noticed a lost lock when the whole lock connection pool died. A lock session ending while the pool survived (a terminated backend, a failover, a network drop the pool reconnects from) went unnoticed.

  • The subscription kept processing events with no lock held, so the next node retrying the lock took it too and both processed every event. Event handlers ran twice and process managers dispatched their commands twice, appending duplicate events for a single source event when the command was not idempotent.

  • Nothing was logged when this happened, so the only symptom was duplicated work showing up downstream.

  • Telling the subscription about the lost lock sends it back to retrying, which is the same recovery it already gets when the pool itself goes down.
  • <!-- codesmith:footer -->
    ---
    <a href="https://app.blacksmith.sh/TrogonStack/codesmith/commanded_eventstore/pr/24?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1795019106&installation_model_id=437969&pr_number=24&ref=codesmith_pr_footer&repository=TrogonStack%2Fcommanded_eventstore&return_to=https%3A%2F%2Fgithub.com%2FTrogonStack%2Fcommanded_eventstore%2Fpull%2F24&signature=e30e6cbd4c7f5183cc29497e68d775049b26a84ce0dafaa80354e2675d0ce3d5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a>
    <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    Diff: 297 lines (+222 / -75) across 3 files Reviewer: yordis Review duration: 3600m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 297 lines diff across 3 files
    0.40
    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%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.341
    Real PR Conversation Timeline
    1 comments
    "Review active on #24"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.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: 40% (MEDIUM) · Higher = larger blast radius
    40%
    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: 46.7% · Lower = rushed or shallow review
    46.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: 21.3% · Safe to merge
    21.3%