Open
opened 2026-07-22 03:27:19 -05:00 by jcwalker3
·
0 comments
No Branch/Tag Specified
master
feat/issue-798-worker-registry-schema
feat/issue-610-live-remote-parity
docs/issue-632-web-console-architecture
feat/issue-628-autonomous-handoffs-orchestration
fix/issue-790-slice-a-heartbeat-policy
fix/issue-760-exact-owner-renewal
fix/issue-787-kill-segment-separators
chore/issue-681-preserve-review-session-wip
v1.1.0
Labels
Clear labels
allocator
anti-stomp
architecture
bug
chore
codex
concurrency
contamination
control-plane
dashboard
database
design
documentation
enhancement
gitea
glitchtip
important
incident
incident-bridge
integration
jenkins
labels
leases
mcp
mcp-health
mcp-menu
multi-project
mutating
nice-to-have
observability
portability
preflight
protected-branch
queue
read-only
reconnect
recovery
refactor
release
reliability
resumable-review
reviewer
roadmap
safety
security
self-hosted
sentry
stale-runtime
status:blocked
status:in-progress
status:pr-open
status:ready
terminal-lock
testing
tracker
type:bug
type:feature
type:feature
type:guardrail
visibility
workflow
workflow-hardening
workflow-hardening
Controller-owned work allocator
Prevent concurrent LLM session stomping
Architecture / structural design
OpenAI Codex client / workflow session surface
Concurrent session safety
Workflow or session contamination incident
MCP control-plane coordination and allocation authority
MCP operational dashboard/queue view
Internal coordination storage (SQLite/Postgres)
Design / investigation, no implementation
Docs / runbooks
New feature or improvement
Gitea MCP workflow
GlitchTip integration
Operational or process incident requiring durable audit trail
Sentry-to-Gitea incident bridging
Integration testing
Jenkins integration
Label taxonomy management
Lease adopt/release/expire lifecycle
MCP server / tooling
MCP namespace and runtime health
MCP menu surface
Work spanning multiple monitoring projects or Gitea repos
Mutating action; requires gating
Observability, metrics, traces, error reporting
Cross-platform / portability
Shared preflight gates before mutation
Protected branch / stable-branch policy concern
Work queue visibility and allocation
Read-only, no mutation
MCP client reconnect/reload recovery path
Recovery paths for stale/foreign leases
Code refactor / restructure
Release / versioning
Reliability / failure handling
Persist and resume prepared review verdicts across sessions
Reviewer workflow tooling
Roadmap / umbrella issue
Safety rails and fail-closed mutation guards
Security / trust boundary
Self-hosted infrastructure integration
Sentry error monitoring integration
Stale backend daemon / runtime-vs-master parity failures
Issue is blocked
Issue is being worked on
Issue has an open pull request
Issue is ready for work
Terminal review lock (#332) path
Tests / test coverage
Issue tracker hygiene / meta
Bug or defect
Feature or enhancement
Feature or enhancement
Safety gate or guardrail
Workflow state visibility for LLMs/operators
Cross-tool workflow
LLM workflow coordination hardening
LLM workflow coordination hardening
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#792
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Scope transfer
Slice B of Issue #790, transferred to its own issue so that closing #790 through the Slice A pull request does not imply this work is done. Issue #790 tracks and is completed by Slice A only. The acceptance criteria below are carried verbatim from the controller reassessment recorded in Issue #790 comment 13958.
Slice A delivered the shared lease policy, the load-bearing task heartbeat, per-task session identity, and legacy-lock compatibility. This issue delivers terminal retirement on top of it.
Problem
Work that has reached its terminal state still holds its author claim. When a pull request has completed integration and its issue is closed, the durable author lock keeps protecting the branch and worktree until the lease lapses on its own. Reconciliation is blocked for no safety benefit: the artifacts are already proven safe.
Two production instances are on record. Issue #787 / PR #789 stalled on a four-hour lease whose owner processes were dead. Issue #760 / PR #791 stalled for more than five hours after its merge commit
620ed6e9a9550b8da2ceb82d9ab8744e8920490flanded, with the lease still unexpired and its recorded pid alive as a long-running MCP daemon.Slice A shortens the window for an abandoned lease to at most one ten-minute grace, but it does not make terminal work retire promptly, and it deliberately did not: retirement is this issue.
The correction, and the trap to avoid
The original #790 text conjoined "owner process is dead or its heartbeat exceeded the allowed grace period" with the terminality and artifact proofs. That is wrong, and the controller struck it. Terminal work is terminal regardless of whether a session is still heartbeating on it: a session heartbeating on integrated work is a leaked session, not protected work. Implemented as originally written, the PR #791 cleanup would still have stalled.
Owner heartbeat freshness and recorded pid liveness are recorded as audit evidence and are never retirement preconditions.
Two distinct steps with two distinct gates
Step 1 — record terminal status. Once every server-side proof below passes, the reconciler may atomically record terminal status immediately, through the
lock_generationcompare-and-swap. There is no waiting period on this step.git merge-base --is-ancestor.parse_dirty_tracked_files, and sits on the locked branch.lock_generation, no competing live lock, no competing branch carrying the issue marker, and no other owning pull request.Step 2 — destructive branch and worktree cleanup. Permitted only after the configurable two-minute race-drain interval has elapsed, and only after re-reading and re-proving all of:
lock_generation, terminal state, worktree cleanliness, branch containment in the target branch, and absence of competing ownership. Any drift observed on the re-read fails closed and cancels the cleanup.Acceptance criteria
AC-B1. Terminal retirement has no owner-liveness precondition of any kind. When the terminality, artifact-safety, and generation proofs pass, retirement proceeds whether or not the recorded pid is alive and whether or not the heartbeat is fresh. Both are recorded as audit evidence. This is #790 AC-N3.
AC-B2. A pure terminal-state assessor gathers evidence and returns a disposition without mutation or caller-trusted input, mirroring the
issue_lock_renewalandissue_lock_recoverypattern. It reuses the Issue #760 evidence gatherer rather than duplicating it.AC-B3. A sanctioned reconciler-only operation records terminal status atomically through the
lock_generationcompare-and-swap. Author, reviewer, and merger roles fail closed.AC-B4. The recorded terminal status is consumed by the existing
branch_cleanup_guard._TERMINAL_OWNERSHIP_STATUSESpath without modifying that module's classification logic. Slice A already confirmed that set containsreleased,terminal, andclosed, and thatassess_ownership_record_activityreturns a non-blocking verdict for them, so this issue supplies a status producer rather than a new guard.AC-B5. The race-drain interval comes from
lease_policy.terminal_race_drain_minutes, which Slice A already declares at two minutes. No duration is hardcoded at a call site.AC-B6. Destructive branch or worktree cleanup is refused until the race-drain interval has elapsed and every proof in step 1 has been independently re-established on a fresh read. Drift fails closed and names the element that changed.
AC-B7. Retirement is never caller-declarable. No parameter, boolean, or flag lets a caller assert terminality or eligibility; every proof is computed server-side from durable state plus live git and Gitea observation.
AC-B8. A durable retirement record captures the prior status, the retiring identity and profile, the prior and replacement generations, the terminal reason, the full proof set, and the pid and heartbeat evidence that did not gate the decision.
AC-B9. Native MCP integration tests cover every downstream gate the retirement path touches, driving the real tools against a real repository and a real durable lock. Assessor-only coverage is explicitly insufficient: it did not catch either of the two sanction discard points found in review #499 on PR #791. This is #790 AC-N6 applied to this slice.
AC-B10. Existing behavior is preserved: Issue #753 dead-session recovery, Issue #755 owning-pull-request evidence, Issue #772 generation compare-and-swap, Issue #747 reviewer sliding TTL, and the Slice A heartbeat lifecycle and legacy-lock protection.
Required tests
Dependencies
Depends on Issue #790 Slice A landing first, for
lease_policy, the lifecycle marker, and the heartbeat semantics this builds on. Also depends on the landed behavior of Issue #772, Issue #755, Issue #760, and Issue #601. Slice C is independent of this issue and may proceed in either order.Non-goals
Do not implement Slice C. Do not weaken worktree cleanliness, ancestry, publication, or binding checks. Do not permit arbitrary lock deletion. Do not make pid liveness an ownership authority in either direction. Do not delete Issue #787, Issue #760, or PR #791 artifacts as part of this work.
Canonical issue state