Skip to content

fix: serialize chat run state mutations#457

Merged
chubes4 merged 2 commits into
mainfrom
fix/451-queue-owner-binding
Jul 21, 2026
Merged

fix: serialize chat run state mutations#457
chubes4 merged 2 commits into
mainfrom
fix/451-queue-owner-binding

Conversation

@chubes4

@chubes4 chubes4 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a generic optional atomic mutation seam for run-control stores and use it for chat ownership, lifecycle, enqueue, and claim mutations
  • implement the default mutex with bounded non-autoloaded rows in existing WordPress options storage, including token expiry, conditional takeover, transactional fencing, and token-checked release
  • reserve run IDs before handlers execute, including pre-session dispatch, so foreign-owner and same-owner duplicate requests cannot both run
  • preserve canonical conversation-session ownership, workspace scoping, single-site compatibility, and generic layer purity
  • add no custom production tables or migrations

Concurrency Coverage

  • independent MariaDB connections serialize site and workspace state mutations
  • expired holders cannot overwrite takeover winners
  • different-owner, same-owner, and pre-session duplicate run races admit one execution
  • double claims return each queued message exactly once
  • enqueue concurrent with claim loses or resurrects no messages
  • active contention, stale takeover, exception release, corrupt state, cache coherence, and single-site fallback

Tests

  • composer test
  • composer phpstan
  • composer validate --strict
  • php tests/agents-chat-ability-smoke.php
  • php tests/default-agents-chat-handler-smoke.php
  • php tests/provider-turn-adapter-smoke.php
  • php tests/chat-run-control-smoke.php
  • php tests/chat-run-control-multisite-smoke.php
  • php tests/bootstrap-version-skew-smoke.php
  • real WordPress wpdb / MariaDB integration: php tests/run-control-option-store-integration.php with isolated option and sitemeta fixtures
  • PHP syntax checks and git diff --check

Follow-up to #452 and #451.

@chubes4
chubes4 force-pushed the fix/451-queue-owner-binding branch from 09a2f65 to 8980da5 Compare July 21, 2026 15:37
@chubes4
chubes4 merged commit 8cb6f1c into main Jul 21, 2026
4 checks passed
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