Web Console: Session, lease, lock, and worktree inventory API (Phase 1) #636

Closed
opened 2026-07-10 14:39:03 -05:00 by jcwalker3 · 3 comments
Owner

Problem statement

Leases (#433), worktrees (#432), and runtime (#430) are separate MVP views. The console needs a unified inventory API for sessions, capabilities, leases, locks, namespaces, and worktrees so traffic-control and recovery views share one machine-readable source.

User and operational impact

Incomplete operator picture and higher collision risk; workers cannot pull one inventory for next-safe-action.

Scope

  • Versioned read-only API aggregating sessions (CP-DB when available), role/namespace, capabilities summary, issue/PR leases, locks, worktree bindings, hygiene anomalies.
  • Correlate lease owner ↔ worktree ↔ namespace when possible.
  • Fail-soft sections when a subsystem is unavailable; never invent active ownership.
  • Align with #600/#613 assignment fields where present.

Explicit non-goals

  • No lease steal/release mutations (Phase 2+).
  • No worktree delete in Phase 1.
  • Do not replace Gitea history.

Required implementation investigation

lease_loader.py, worktree_scanner.py, runtime_health.py, control_plane_db.py, issue_lock_store.py, pr_work_lease.py, #433, #432, #430, #601, #613, #631.

Proposed architecture or implementation direction

InventorySnapshot DTO from existing loaders + optional CP-DB; GET /api/v1/inventory and/or resource-split endpoints with shared schema.

Security and workflow-safety requirements

Redact sensitive paths; no session tokens; mark stale/expired leases clearly.

Acceptance criteria

  1. Inventory API returns sessions/leases/locks/worktrees/namespaces sections.
  2. Unavailable subsystems degrade with reasons.
  3. Collision signals when detectable.
  4. Tests: empty, populated, partial failure.
  5. Docs: field authority (DB vs filesystem vs Gitea).

Required tests

Aggregation unit tests; route tests; no false unowned when lease active.

Observability and audit requirements

Read-only; optional scan timing fields.

Dependencies and linkage

  • Parent: #631 · Extends: #430/#432/#433 · Related: #605, #601 · Consumed by: traffic-control, runtime/session views

Canonical issue state

STATE: ready-for-author
WHO_IS_NEXT: author
NEXT_ACTION: Implement unified inventory API + tests
NEXT_PROMPT: Author implements inventory API only; PR; stop

Required final evidence

PR with schema, tests, sample payload.

Required final response and handoff expectations

Brief PR → reviewer.

## Problem statement Leases (#433), worktrees (#432), and runtime (#430) are separate MVP views. The console needs a **unified inventory API** for sessions, capabilities, leases, locks, namespaces, and worktrees so traffic-control and recovery views share one machine-readable source. ## User and operational impact Incomplete operator picture and higher collision risk; workers cannot pull one inventory for next-safe-action. ## Scope * Versioned read-only API aggregating sessions (CP-DB when available), role/namespace, capabilities summary, issue/PR leases, locks, worktree bindings, hygiene anomalies. * Correlate lease owner ↔ worktree ↔ namespace when possible. * Fail-soft sections when a subsystem is unavailable; never invent active ownership. * Align with #600/#613 assignment fields where present. ## Explicit non-goals * No lease steal/release mutations (Phase 2+). * No worktree delete in Phase 1. * Do not replace Gitea history. ## Required implementation investigation `lease_loader.py`, `worktree_scanner.py`, `runtime_health.py`, `control_plane_db.py`, `issue_lock_store.py`, `pr_work_lease.py`, #433, #432, #430, #601, #613, #631. ## Proposed architecture or implementation direction `InventorySnapshot` DTO from existing loaders + optional CP-DB; `GET /api/v1/inventory` and/or resource-split endpoints with shared schema. ## Security and workflow-safety requirements Redact sensitive paths; no session tokens; mark stale/expired leases clearly. ## Acceptance criteria 1. Inventory API returns sessions/leases/locks/worktrees/namespaces sections. 2. Unavailable subsystems degrade with reasons. 3. Collision signals when detectable. 4. Tests: empty, populated, partial failure. 5. Docs: field authority (DB vs filesystem vs Gitea). ## Required tests Aggregation unit tests; route tests; no false unowned when lease active. ## Observability and audit requirements Read-only; optional scan timing fields. ## Dependencies and linkage * Parent: #631 · Extends: #430/#432/#433 · Related: #605, #601 · Consumed by: traffic-control, runtime/session views ## Canonical issue state ```text STATE: ready-for-author WHO_IS_NEXT: author NEXT_ACTION: Implement unified inventory API + tests NEXT_PROMPT: Author implements inventory API only; PR; stop ``` ## Required final evidence PR with schema, tests, sample payload. ## Required final response and handoff expectations Brief PR → reviewer.
jcwalker3 added the type:featurestatus:readyworkflow-hardeninganti-stompdashboard labels 2026-07-10 14:39:04 -05:00
Author
Owner

Canonical Issue State

STATE:
ready-for-author

WHO_IS_NEXT:
author

NEXT_ACTION:
Implement inventory API (sessions/leases/locks/namespaces/runtimes/worktrees); link #652 #653

NEXT_PROMPT:

AUTHOR prgs Gitea-Tools. Implement #636. Vision #652 · Roadmap #653 Phase 1 · Umbrella #631. Lock; branches/; PR; stop. Closing ≠ vision complete.

WHAT_HAPPENED:
Linked to #652/#653 Phase 1. Not recreated.

WHY:
Initial batch linkage.

RELATED_ISSUES:
#652 #653 #631 #430 #432 #433 #640 #641

RELATED_PRS:
none

BLOCKERS:
none

VALIDATION:
existing retained

LAST_UPDATED_BY:
jcwalker3 / prgs-author / author / 2026-07-10

## Canonical Issue State STATE: ready-for-author WHO_IS_NEXT: author NEXT_ACTION: Implement inventory API (sessions/leases/locks/namespaces/runtimes/worktrees); link #652 #653 NEXT_PROMPT: ```text AUTHOR prgs Gitea-Tools. Implement #636. Vision #652 · Roadmap #653 Phase 1 · Umbrella #631. Lock; branches/; PR; stop. Closing ≠ vision complete. ``` WHAT_HAPPENED: Linked to #652/#653 Phase 1. Not recreated. WHY: Initial batch linkage. RELATED_ISSUES: #652 #653 #631 #430 #432 #433 #640 #641 RELATED_PRS: none BLOCKERS: none VALIDATION: existing retained LAST_UPDATED_BY: jcwalker3 / prgs-author / author / 2026-07-10
jcwalker3 added status:pr-open and removed status:ready labels 2026-07-22 21:34:38 -05:00
Author
Owner

[CONTROLLER HANDOFF] PR #838 / Issue #636 — tooling blocker

Server-side mutation ledger:

Blockers:

  • environment/tooling blocker: capability resolution authorizes update_pr_branch_by_merge, but the mutation workspace gate requires push_branch

Current target evidence:

  • PR state: open
  • PR head: f7ef719bd63bd164dba0b23ba0f236fcaed97022
  • Base branch/head: master at 36fe4785eccf712b3bc0dec8583c798e8cf1f218
  • Base distance: 35 commits behind
  • Mergeability: no conflicts
  • Review state: approval_at_current_head=true; branch sync will create a new head requiring fresh independent review
  • Worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-636-inventory-api, clean and unchanged

Required action:

  • Operator: repair the preflight task mismatch, then rerun the author update_pr_branch_by_merge task from fresh live state.
  • Do not use direct Git push, direct service API, rebase, force-push, browser mutation, or another client as a fallback.
[CONTROLLER HANDOFF] PR #838 / Issue #636 — tooling blocker Server-side mutation ledger: - gitea_lock_issue → exact expired author lease renewed for issue #636 and PR #838 - gitea_heartbeat_issue_lock → lease generation advanced to 7 - gitea_update_pr_branch_by_merge → branch update not performed; PR head and remote branch unchanged - gitea_create_issue_comment → this durable handoff posted Blockers: - environment/tooling blocker: capability resolution authorizes `update_pr_branch_by_merge`, but the mutation workspace gate requires `push_branch` Current target evidence: - PR state: open - PR head: `f7ef719bd63bd164dba0b23ba0f236fcaed97022` - Base branch/head: `master` at `36fe4785eccf712b3bc0dec8583c798e8cf1f218` - Base distance: 35 commits behind - Mergeability: no conflicts - Review state: `approval_at_current_head=true`; branch sync will create a new head requiring fresh independent review - Worktree: `/Users/jasonwalker/Development/Gitea-Tools/branches/issue-636-inventory-api`, clean and unchanged Required action: - Operator: repair the preflight task mismatch, then rerun the author `update_pr_branch_by_merge` task from fresh live state. - Do not use direct Git push, direct service API, rebase, force-push, browser mutation, or another client as a fallback.
Author
Owner

[CONTROLLER HANDOFF] PR #838 / Issue #636 — canonical tooling-blocker handoff

Server-side mutation ledger:

  • gitea_lock_issue → exact expired author lease renewed for issue #636 and PR feat(webui): unified session/lease/lock/worktree inventory API (Closes #636) (#838)
  • gitea_heartbeat_issue_lock → lease generation advanced to 7
  • gitea_update_pr_branch_by_merge → branch update not performed; PR head and remote branch unchanged
  • gitea_create_issue_comment → diagnostic handoff comment 16027 posted
  • gitea_create_issue_comment → this canonical replacement handoff posted

Blockers:

  • Blocker classification: environment/tooling blocker — capability resolution authorizes update_pr_branch_by_merge, but the mutation workspace gate requires push_branch

Canonical Issue State

STATE:
blocked

WHO_IS_NEXT:
user

NEXT_ACTION:
Route an operator to repair the mutation workspace preflight task mismatch, then start a fresh author update_pr_branch_by_merge iteration.

NEXT_PROMPT:

Operator for Scaled-Tech-Consulting/Gitea-Tools issue #636 and PR #838: repair the gitea_update_pr_branch_by_merge preflight mismatch so the workspace gate accepts the exact resolved task update_pr_branch_by_merge; validate the fix, then leave feature state unchanged for a fresh author lifecycle iteration.

WHAT_HAPPENED:
The exact author lease was recovered and the sanctioned branch-sync mutation was attempted. It failed closed before changing the branch because the resolved task and mutation workspace-gate task differ.

WHY:
PR #838 is 35 commits behind live master and branch protection requires current base, but workflow enforcement currently prevents its exact sanctioned sync task.

RELATED_PRS:
#838

BLOCKERS:
Environment/tooling blocker: update_pr_branch_by_merge resolves successfully while the mutation workspace gate requires push_branch.

VALIDATION:
PR read-back open at f7ef719bd63bd164dba0b23ba0f236fcaed97022; base 36fe4785eccf712b3bc0dec8583c798e8cf1f218; local and remote feature refs equal; worktree clean; branch update performed=false.

LAST_UPDATED_BY:
jcwalker3 / prgs-author / author / 2026-07-24T15:47:27Z

Canonical Handoff

REPOSITORY: Scaled-Tech-Consulting/Gitea-Tools
ISSUE: 636
PR: 838
WORKFLOW_STATE: blocked
HEAD_SHA: f7ef719bd63bd164dba0b23ba0f236fcaed97022
BASE_BRANCH: master
BASE_OR_MERGE_SHA: 36fe4785eccf712b3bc0dec8583c798e8cf1f218
ACTING_ROLE: author
ACTING_IDENTITY: jcwalker3 (prgs-author)
COMPLETED_ACTIONS: Recovered the exact expired author lease, refreshed PR and sync state, and attempted only the sanctioned update_pr_branch_by_merge mutation; it failed closed before changing the branch.
VALIDATION_EVIDENCE: PR read-back open at f7ef719bd63bd164dba0b23ba0f236fcaed97022; sync assessor reports base 36fe4785eccf712b3bc0dec8583c798e8cf1f218, 35 commits behind, mergeable with no conflicts; local and remote feature refs equal f7ef719bd63bd164dba0b23ba0f236fcaed97022; worktree clean.
MUTATION_LEDGER: Author lease renewed; heartbeat generation 7; diagnostic comment 16027 and this canonical handoff posted; branch update performed=false; no file, commit, branch, PR-review, or merge mutation.
BLOCKERS: Environment/tooling blocker: mutation preflight expects push_branch after exact capability resolution selected update_pr_branch_by_merge.
NEXT_ACTOR: operator
NEXT_ACTION: Repair the mutation workspace preflight task mismatch, then start a fresh author update_pr_branch_by_merge iteration.
PROHIBITED_ACTIONS: Do not use direct Git push, direct service API, rebase, force-push, browser mutation, offline helper, direct import, or alternate client as a fallback.
NEXT_PROMPT: Operator for Scaled-Tech-Consulting/Gitea-Tools issue #636 and PR #838: repair the gitea_update_pr_branch_by_merge preflight mismatch so the workspace gate accepts the exact resolved task update_pr_branch_by_merge; validate the fix, then leave the feature state unchanged for a fresh author lifecycle iteration.
WORKFLOW_FAILURE_ISSUES: none
LAST_UPDATED: 2026-07-24T15:47:27Z
[CONTROLLER HANDOFF] PR #838 / Issue #636 — canonical tooling-blocker handoff Server-side mutation ledger: - gitea_lock_issue → exact expired author lease renewed for issue #636 and PR #838 - gitea_heartbeat_issue_lock → lease generation advanced to 7 - gitea_update_pr_branch_by_merge → branch update not performed; PR head and remote branch unchanged - gitea_create_issue_comment → diagnostic handoff comment 16027 posted - gitea_create_issue_comment → this canonical replacement handoff posted Blockers: - Blocker classification: environment/tooling blocker — capability resolution authorizes `update_pr_branch_by_merge`, but the mutation workspace gate requires `push_branch` ## Canonical Issue State STATE: blocked WHO_IS_NEXT: user NEXT_ACTION: Route an operator to repair the mutation workspace preflight task mismatch, then start a fresh author `update_pr_branch_by_merge` iteration. NEXT_PROMPT: ```text Operator for Scaled-Tech-Consulting/Gitea-Tools issue #636 and PR #838: repair the gitea_update_pr_branch_by_merge preflight mismatch so the workspace gate accepts the exact resolved task update_pr_branch_by_merge; validate the fix, then leave feature state unchanged for a fresh author lifecycle iteration. ``` WHAT_HAPPENED: The exact author lease was recovered and the sanctioned branch-sync mutation was attempted. It failed closed before changing the branch because the resolved task and mutation workspace-gate task differ. WHY: PR #838 is 35 commits behind live master and branch protection requires current base, but workflow enforcement currently prevents its exact sanctioned sync task. RELATED_PRS: #838 BLOCKERS: Environment/tooling blocker: `update_pr_branch_by_merge` resolves successfully while the mutation workspace gate requires `push_branch`. VALIDATION: PR read-back open at `f7ef719bd63bd164dba0b23ba0f236fcaed97022`; base `36fe4785eccf712b3bc0dec8583c798e8cf1f218`; local and remote feature refs equal; worktree clean; branch update `performed=false`. LAST_UPDATED_BY: jcwalker3 / prgs-author / author / 2026-07-24T15:47:27Z <!-- sph:v1 --> ## Canonical Handoff ```text REPOSITORY: Scaled-Tech-Consulting/Gitea-Tools ISSUE: 636 PR: 838 WORKFLOW_STATE: blocked HEAD_SHA: f7ef719bd63bd164dba0b23ba0f236fcaed97022 BASE_BRANCH: master BASE_OR_MERGE_SHA: 36fe4785eccf712b3bc0dec8583c798e8cf1f218 ACTING_ROLE: author ACTING_IDENTITY: jcwalker3 (prgs-author) COMPLETED_ACTIONS: Recovered the exact expired author lease, refreshed PR and sync state, and attempted only the sanctioned update_pr_branch_by_merge mutation; it failed closed before changing the branch. VALIDATION_EVIDENCE: PR read-back open at f7ef719bd63bd164dba0b23ba0f236fcaed97022; sync assessor reports base 36fe4785eccf712b3bc0dec8583c798e8cf1f218, 35 commits behind, mergeable with no conflicts; local and remote feature refs equal f7ef719bd63bd164dba0b23ba0f236fcaed97022; worktree clean. MUTATION_LEDGER: Author lease renewed; heartbeat generation 7; diagnostic comment 16027 and this canonical handoff posted; branch update performed=false; no file, commit, branch, PR-review, or merge mutation. BLOCKERS: Environment/tooling blocker: mutation preflight expects push_branch after exact capability resolution selected update_pr_branch_by_merge. NEXT_ACTOR: operator NEXT_ACTION: Repair the mutation workspace preflight task mismatch, then start a fresh author update_pr_branch_by_merge iteration. PROHIBITED_ACTIONS: Do not use direct Git push, direct service API, rebase, force-push, browser mutation, offline helper, direct import, or alternate client as a fallback. NEXT_PROMPT: Operator for Scaled-Tech-Consulting/Gitea-Tools issue #636 and PR #838: repair the gitea_update_pr_branch_by_merge preflight mismatch so the workspace gate accepts the exact resolved task update_pr_branch_by_merge; validate the fix, then leave the feature state unchanged for a fresh author lifecycle iteration. WORKFLOW_FAILURE_ISSUES: none LAST_UPDATED: 2026-07-24T15:47:27Z ```
sysadmin removed the status:pr-open label 2026-07-24 13:54:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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