feat(concurrency): add plan and project locks #423
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!423
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/m4-concurrency-locks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds plan-level and project-level advisory locking with configurable timeouts to prevent concurrent modifications to shared resources. Implements the
LockServicewith re-entrant acquisition, conflict detection, lock renewal, graceful shutdown release, startup cleanup of expired locks, and a diagnostics check for stale lock reporting. Backed by a newlockstable (Alembic migrationm4_001_concurrency_locks) storing owner_id, resource_type, resource_id, acquired_at, and expires_at.Closes #327
Changes
LockServiceinsrc/cleveragents/application/services/lock_service.pywith acquire, release, renew, cleanup, and diagnostics operations.LockModelinsrc/cleveragents/infrastructure/database/models.pywith unique constraint on(resource_type, resource_id).m4_001_concurrency_locksfor thelockstable.LockConflictErrorandLockExpiredErrorexception classes insrc/cleveragents/core/exceptions.py.src/cleveragents/cli/commands/system.py.docs/reference/concurrency.mddocumenting lock behavior, TTL defaults, and renewal strategy.features/concurrency.featurewith step definitions covering lock contention, expiry, renewal, validation, and cleanup.robot/concurrency_locks.robot.benchmarks/concurrency_lock_bench.pyfor lock overhead baseline.e6a62715468858e86fb2CONTRIBUTING.md Compliance Review
Reviewed PR #423 against
CONTRIBUTING.mdrequirements. The following issues were identified and addressed:Fixed (pushed to branch)
Closes #327closing keyword per §Pull Request Process requirement 1.CHANGELOG.mdper §Pull Request Process requirement 6.src/cleveragents/cli/commands/system.py—_check_stale_locks()had imports inside atry:block. Moved all imports to the top of the file per §Import Guidelines.# type: ignoresuppression comments insrc/cleveragents/application/services/lock_service.py— Removed 6# type: ignore[assignment]and# type: ignore[union-attr]comments by usingsetattr()/getattr()for SQLAlchemy model attribute access, per §Type Safety ("never use inline comments or annotations to suppress individual type checking errors").lock_service.py— Removed unusedif TYPE_CHECKING: passblock and pointlessfinally: passblock.Remaining item (requires manual action)
feature/m4-concurrency-locksto associate the issue with the working branch in Forgejo's UI. This must be set manually in the Forgejo issue form.5662b840e938617da46938617da4697a298ede6e