feat: controller-owned allocator API on control-plane DB (Closes #600) #622

Merged
sysadmin merged 1 commits from feat/issue-600-controller-allocator-api into master 2026-07-10 02:12:00 -05:00
Owner

Summary

Implements #600 — controller-owned gitea_allocate_next_work on the merged #613 control-plane DB substrate.

Dependency chain: #613 substrate → #600 allocator (this PR) → #612 incident bridge

#612 remains downstream and incomplete. This PR never assigns raw monitoring incidents.

Substrate proof

  • Built from prgs/master at merge commit 10228e1c068ade36d08e696b7473bcf0a39d0c0d (PR #619 / #613).
  • Coordination uses ControlPlaneDB.assign_and_lease only — not file locks or comment-only leases.

Changes

File Purpose
allocator_service.py Routing policy, skip reasons, atomic allocate API
gitea_mcp_server.py MCP tool gitea_allocate_next_work + Gitea inventory
task_capability_map.py allocate_next_work capability
tests/test_allocator_service.py Selection, concurrency, terminal path, deps, WAIT
docs/architecture/control-plane-db-substrate.md Allocator usage notes

Outcomes

assigned_work · preview (dry-run) · wait · blocked_by_terminal_path · no_safe_work · role_ineligible

Routing (ADR §5.3)

  • Current-head REQUEST_CHANGES → author
  • Open PR without clean approval → reviewer
  • Clean approval + mergeable → merger
  • Active terminal-review lock → terminal PR first
  • Foreign lease → wait
  • Blocked / unmet deps (incl. #612) → skip

Validation

pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q  → 34 passed
git diff --check prgs/master...HEAD → clean

Closes #600

## Summary Implements **#600** — controller-owned `gitea_allocate_next_work` on the merged **#613** control-plane DB substrate. **Dependency chain:** `#613 substrate → #600 allocator (this PR) → #612 incident bridge` #612 remains **downstream and incomplete**. This PR never assigns raw monitoring incidents. ## Substrate proof - Built from `prgs/master` at merge commit `10228e1c068ade36d08e696b7473bcf0a39d0c0d` (PR #619 / #613). - Coordination uses `ControlPlaneDB.assign_and_lease` only — **not** file locks or comment-only leases. ## Changes | File | Purpose | |------|--------| | `allocator_service.py` | Routing policy, skip reasons, atomic allocate API | | `gitea_mcp_server.py` | MCP tool `gitea_allocate_next_work` + Gitea inventory | | `task_capability_map.py` | `allocate_next_work` capability | | `tests/test_allocator_service.py` | Selection, concurrency, terminal path, deps, WAIT | | `docs/architecture/control-plane-db-substrate.md` | Allocator usage notes | ### Outcomes `assigned_work` · `preview` (dry-run) · `wait` · `blocked_by_terminal_path` · `no_safe_work` · `role_ineligible` ### Routing (ADR §5.3) - Current-head REQUEST_CHANGES → author - Open PR without clean approval → reviewer - Clean approval + mergeable → merger - Active terminal-review lock → terminal PR first - Foreign lease → wait - Blocked / unmet deps (incl. #612) → skip ## Validation ```text pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q → 34 passed git diff --check prgs/master...HEAD → clean ``` Closes #600
jcwalker3 added 1 commit 2026-07-10 01:54:33 -05:00
Add gitea_allocate_next_work and allocator_service routing policy on top of
the #613 ControlPlaneDB substrate. Workers get atomic assign+lease results
(or wait/no_safe_work/terminal-path outcomes) without self-selecting work
via file locks or comment-only leases. #612 remains downstream.

Closes #600
Author
Owner

Canonical Issue State

STATE:
awaiting review
WHO_IS_NEXT:
reviewer
NEXT_ACTION:
review PR #622 at head db5d14184f for issue #600 allocator API built on #613 control-plane substrate; keep issue #612 out of scope
NEXT_PROMPT:

You are the REVIEWER for Scaled-Tech-Consulting/Gitea-Tools PR #622 (issue #600).
Pin head db5d14184f20626fc3ff3208622ac4e3237655c9.
Validate gitea_allocate_next_work + allocator_service use ControlPlaneDB.assign_and_lease only (no file-lock or comment-lease completion semantics), concurrent sessions cannot double-assign, terminal-path first, blocked and dependency skips including issue #612 remaining downstream, role routing, structured preview/wait/no_safe_work outcomes.
Run pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q and git diff --check.
Do not merge without explicit operator command MERGE PR 622. Do not implement issue #612 in this review.

WHAT_HAPPENED:
Author implemented controller-owned allocator API on the #613 substrate and opened PR #622 with body Closes #600.
WHY:
LLM sessions were self-selecting the same issue/PR; #600 requires DB-backed atomic allocation after substrate #613 landed at commit 10228e1c06.
RELATED_PRS:
#622 (this PR for #600); #619 closed #613 substrate at 10228e1; #612 remains open and downstream
BLOCKERS:
none that block reviewer validation of PR #622; issue #612 stays dependency-waiting until #600 is fully accepted and a separate session schedules the bridge
VALIDATION:
pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q reported 34 passed; git diff --check against prgs/master is clean; head db5d14184f20626fc3ff3208622ac4e3237655c9; substrate ancestor 10228e1c06
LAST_UPDATED_BY:
jcwalker3 (prgs-author)

[THREAD STATE LEDGER] PR #622 / Issue #600 — author implementation posted for review

What is true now:

  • PR state: open
  • Current head SHA: db5d14184f
  • Server-side decision state: no formal review posted
  • Local verdict/state: author implementation finished; automated tests passed
  • Substrate: issue #613 is closed via PR #619 merge commit 10228e1c06
  • Issue #612: open, downstream, incomplete

What changed:

  • Added allocator_service and gitea_allocate_next_work on control-plane DB
  • Opened PR #622 intending to close issue #600 after review and merge

What is blocked:

  • Blocker classification: no blocker
  • Issue #612 remains dependency-waiting on full acceptance of #600

Who/what acts next:

  • Next actor: reviewer
  • Required action: full independent review of PR #622 at the pinned head
  • Do not do: implement #612; approve without validation; merge without explicit operator MERGE PR 622
  • Resume from: PR #622 reviewer lease and validation suite
## Canonical Issue State STATE: awaiting review WHO_IS_NEXT: reviewer NEXT_ACTION: review PR #622 at head db5d14184f20626fc3ff3208622ac4e3237655c9 for issue #600 allocator API built on #613 control-plane substrate; keep issue #612 out of scope NEXT_PROMPT: ```text You are the REVIEWER for Scaled-Tech-Consulting/Gitea-Tools PR #622 (issue #600). Pin head db5d14184f20626fc3ff3208622ac4e3237655c9. Validate gitea_allocate_next_work + allocator_service use ControlPlaneDB.assign_and_lease only (no file-lock or comment-lease completion semantics), concurrent sessions cannot double-assign, terminal-path first, blocked and dependency skips including issue #612 remaining downstream, role routing, structured preview/wait/no_safe_work outcomes. Run pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q and git diff --check. Do not merge without explicit operator command MERGE PR 622. Do not implement issue #612 in this review. ``` WHAT_HAPPENED: Author implemented controller-owned allocator API on the #613 substrate and opened PR #622 with body Closes #600. WHY: LLM sessions were self-selecting the same issue/PR; #600 requires DB-backed atomic allocation after substrate #613 landed at commit 10228e1c068ade36d08e696b7473bcf0a39d0c0d. RELATED_PRS: #622 (this PR for #600); #619 closed #613 substrate at 10228e1; #612 remains open and downstream BLOCKERS: none that block reviewer validation of PR #622; issue #612 stays dependency-waiting until #600 is fully accepted and a separate session schedules the bridge VALIDATION: pytest tests/test_allocator_service.py tests/test_control_plane_db.py -q reported 34 passed; git diff --check against prgs/master is clean; head db5d14184f20626fc3ff3208622ac4e3237655c9; substrate ancestor 10228e1c068ade36d08e696b7473bcf0a39d0c0d LAST_UPDATED_BY: jcwalker3 (prgs-author) [THREAD STATE LEDGER] PR #622 / Issue #600 — author implementation posted for review What is true now: - PR state: open - Current head SHA: db5d14184f20626fc3ff3208622ac4e3237655c9 - Server-side decision state: no formal review posted - Local verdict/state: author implementation finished; automated tests passed - Substrate: issue #613 is closed via PR #619 merge commit 10228e1c068ade36d08e696b7473bcf0a39d0c0d - Issue #612: open, downstream, incomplete What changed: - Added allocator_service and gitea_allocate_next_work on control-plane DB - Opened PR #622 intending to close issue #600 after review and merge What is blocked: - Blocker classification: no blocker - Issue #612 remains dependency-waiting on full acceptance of #600 Who/what acts next: - Next actor: reviewer - Required action: full independent review of PR #622 at the pinned head - Do not do: implement #612; approve without validation; merge without explicit operator MERGE PR 622 - Resume from: PR #622 reviewer lease and validation suite
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #622
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 60669-a25749a76562
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-622
phase: claimed
candidate_head: db5d14184f
target_branch: master
target_branch_sha: none
last_activity: 2026-07-10T07:05:32Z
expires_at: 2026-07-10T09:05:32Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #622 issue: none reviewer_identity: sysadmin profile: prgs-reviewer session_id: 60669-a25749a76562 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-622 phase: claimed candidate_head: db5d14184f20626fc3ff3208622ac4e3237655c9 target_branch: master target_branch_sha: none last_activity: 2026-07-10T07:05:32Z expires_at: 2026-07-10T09:05:32Z blocker: none
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #622
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 60669-a25749a76562
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-622
phase: claimed
candidate_head: db5d14184f
target_branch: master
target_branch_sha: none
last_activity: 2026-07-10T07:08:35Z
expires_at: 2026-07-10T09:08:35Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #622 issue: none reviewer_identity: sysadmin profile: prgs-reviewer session_id: 60669-a25749a76562 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-622 phase: claimed candidate_head: db5d14184f20626fc3ff3208622ac4e3237655c9 target_branch: master target_branch_sha: none last_activity: 2026-07-10T07:08:35Z expires_at: 2026-07-10T09:08:35Z blocker: none
sysadmin approved these changes 2026-07-10 02:08:38 -05:00
sysadmin left a comment
Owner

Canonical PR State

STATE: merge
WHO_IS_NEXT: merger
NEXT_ACTION: Merge PR #622 under profile prgs-merger on explicit operator command
NEXT_PROMPT:

Verify that the merger MCP environment is healthy. Acquire merger lease and execute gitea_merge_pr for PR #622.

WHAT_HAPPENED: Reviewed PR #622 implementing the #600 controller allocator API on the #613 control-plane DB substrate. All 34 tests in test_allocator_service.py and test_control_plane_db.py passed.
WHY: The allocator API implements atomic DB assignments, correct role routing, terminal-path first prioritization, and proper dry-run/apply outcomes, satisfying all acceptance criteria. Sentry/GlitchTip raw incident mapping (#612) remains deferred downstream.
ISSUE: #600
HEAD_SHA: db5d14184f
REVIEW_STATUS: APPROVED
MERGE_READY: true
BLOCKERS: none
VALIDATION: 34 passed (tests/test_allocator_service.py + tests/test_control_plane_db.py)
LAST_UPDATED_BY: sysadmin

## Canonical PR State STATE: merge WHO_IS_NEXT: merger NEXT_ACTION: Merge PR #622 under profile prgs-merger on explicit operator command NEXT_PROMPT: ```text Verify that the merger MCP environment is healthy. Acquire merger lease and execute gitea_merge_pr for PR #622. ``` WHAT_HAPPENED: Reviewed PR #622 implementing the #600 controller allocator API on the #613 control-plane DB substrate. All 34 tests in test_allocator_service.py and test_control_plane_db.py passed. WHY: The allocator API implements atomic DB assignments, correct role routing, terminal-path first prioritization, and proper dry-run/apply outcomes, satisfying all acceptance criteria. Sentry/GlitchTip raw incident mapping (#612) remains deferred downstream. ISSUE: #600 HEAD_SHA: db5d14184f20626fc3ff3208622ac4e3237655c9 REVIEW_STATUS: APPROVED MERGE_READY: true BLOCKERS: none VALIDATION: 34 passed (tests/test_allocator_service.py + tests/test_control_plane_db.py) LAST_UPDATED_BY: sysadmin
Owner

adopted_at: 2026-07-10T07:11:41Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 60669-a25749a76562
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 9335
adoption_reason: merger-handoff-approved-head

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #622
issue: #600
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 65784-539b6b7dd505
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-control
phase: adopted
candidate_head: db5d14184f
target_branch: master
target_branch_sha: none
last_activity: 2026-07-10T07:11:41Z
expires_at: 2026-07-10T09:11:41Z
blocker: none

<!-- mcp-review-lease-adoption:v1 --> adopted_at: 2026-07-10T07:11:41Z adopted_by_identity: sysadmin adopted_by_profile: prgs-merger adopted_from_session_id: 60669-a25749a76562 adopted_from_profile: prgs-reviewer adopted_from_reviewer_identity: sysadmin adopted_from_comment_id: 9335 adoption_reason: merger-handoff-approved-head <!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #622 issue: #600 reviewer_identity: sysadmin profile: prgs-merger session_id: 65784-539b6b7dd505 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-control phase: adopted candidate_head: db5d14184f20626fc3ff3208622ac4e3237655c9 target_branch: master target_branch_sha: none last_activity: 2026-07-10T07:11:41Z expires_at: 2026-07-10T09:11:41Z blocker: none
sysadmin merged commit f20c8436aa into master 2026-07-10 02:12:00 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#622