fix(author): refresh durable linked-issue lock head after update_pr_branch_by_merge; recover merge-sync-drifted dead-session locks #871
Closed
opened 2026-07-24 01:31:52 -05:00 by jcwalker3
·
0 comments
No Branch/Tag Specified
master
fix/issue-860-dirty-orphan-worktree-recovery
feat/issue-657-mcp-restart-path-inventory-guard
feat/issue-658-mcp-restart-coordinator
feat/issue-639-webui-system-health-dashboard
feat/issue-642-sanctioned-restart-controls
fix/issue-850-native-mcp-bootstrap
fix/issue-842-conflict-fix-lease-lifecycle
feat/issue-628-autonomous-handoffs-orchestration
feat/issue-651-usage-cost-analytics
fix/issue-790-slice-a-heartbeat-policy
feat/issue-646-policy-guardrail-visibility
feat/issue-638-webui-app-shell-phase1
feat/issue-634-readonly-system-health-api
feat/issue-822-atomic-install-authority-kernel
feat/issue-636-inventory-api
feat/issue-798-worker-registry-schema
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#871
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.
Summary
gitea_update_pr_branch_by_mergeadvances a PR's remote head (native GiteaPOST /pulls/{n}/update?style=merge) but never advances the linked durable issue lock's recorded head (head_sha). After a subsequent owning-session death, the drifted lock can no longer be recovered bygitea_lock_issue, and no further synchronization is possible — the PR is stranded behind master.This is a control-plane lifecycle defect, not a source defect in any single PR.
Confirmed production reproduction (do NOT mutate as part of this fix)
fix/issue-855-pr-scoped-merged-cleanup.24c52abf6b80e7ed562294371eee9fe8620b686e.499b87c48218cf03a3b1f34a5d8a17549d820564.89657a06c4cc8d73917e4436e326d3755cff0a40.24c52ab…; local author worktree stayed clean at24c52ab….gitea_lock_issuedead-session recovery refuses: the recorded/local head (24c52ab) is an ancestor of the live PR head (499b87c), i.e. the remote moved forward via merge-sync while the recorded head did not. The existing published-owning-PR recovery only proves the reverse relation (local equal to, or a strict descendant of, the remote head, #753/#768). No relation covers "remote advanced past the recorded head via a sanctioned merge-based branch sync."gitea_update_pr_branch_by_mergecorrectly refuses a new sync because no live author issue lock can be proven.Root cause (with file:line)
gitea_mcp_server.pygitea_update_pr_branch_by_merge(~L18875-18928): after the successful remote update andnew_headre-read, it returnssuccess/performed=Trueand invalidates approvals/leases (pr_sync_status.assess_post_update_head_transition) but never refreshes the durable linked-issue lockhead_shafrom the exact former head tonew_head. The lock's recorded head is left stale.issue_lock_recovery.assess_dead_session_lock_recoverypublished-owning-PR path (issue_lock_recovery.pyL454-476) and its ancestry probe in_evaluate_issue_lock_recovery(gitea_mcp_server.pyL2440-2446) only observe remote-is-ancestor-of-local. There is no relation, and no ancestry probe, for local/recorded-is-ancestor-of-remote via merge-sync.Required behavior
A. Write-side durable-lock head refresh (prevents future drift).
B. Read-side sanctioned recovery for an already-drifted dead-session
published_owning_prlock.Recovery may accept an older recorded head ONLY when authoritative evidence proves ALL of:
Unknown, missing, malformed, contradictory, stale, truncated, or unavailable evidence blocks recovery. Arbitrary head mismatch, unrelated commit, rewritten history, rebase, force-push, branch mismatch, dirty worktree, or live foreign session stays protected. Do not weaken exact-head, branch-protection, parity, workspace, identity, role, or mutation-safety gates. Do not authorize manual cache-file editing or out-of-band lock seeding.
Acceptance criteria (regression tests)
recorded=24c52ab…, live PR=499b87c…is recoverable only with proven ancestry + merge-sync provenance.gitea_update_pr_branch_by_mergeretains exact PR-head and base-head pinning.Out of scope / protected
Do not mutate PR #866, Issue #855, their branch, worktree, durable lock, reviews, or leases. Do not manually repair #855's durable lock. Use isolated temporary repositories/fixtures for mutation tests.