fix(mcp): make recovered author remediation publishable after a dead session #768
Closed
opened 2026-07-20 02:08:47 -05:00 by jcwalker3
·
1 comment
No Branch/Tag Specified
master
fix/issue-617-mutation-budget-classifier
fix/issue-772-unpublished-claim-recovery
archive/role-poisoning-dfb5ebd
archive/capability-role-invariants-bc9366c
docs/mcp-stable-control-runtime-policy
fix/issue-695-native-quarantine-v2
chore/issue-681-preserve-review-session-wip
fix/issue-673-remediate-regressions-part2
feat/issue-610-live-remote-parity
feat/issue-503-reviewer-active-worktree
feat/issue-470-preflight-contract
feat/issue-440-lock-recovery
feat/issue-440-branch-recovery
feat/issue-458-queue-fail-closed-copy
feat/issue-400-early-duplicate-work-gate
feat/issue-308-reconcile-inventory-pagination
feat/issue-308-reconcile-pagination-proof
docs/issue-261-agent-temp-artifact-cleanup
feat/issue-262-map-commit-files
fix/infra-stop-conflict-marker-false-positive
feat/issue-139-role-aware-task-routing
feat/issue-188-continuation-selection-wall
feat/issue-189-continuation-mode-proofs
feat/issue-232-refresh-wiki-proof-heads
feat/issue-210-block-workspace-edits
feat/issue-204-exact-issue-lock
docs/issue-80-label-taxonomy
docs/issue-79-safety-boundary-updates
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#768
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
After a dead author session, a preserved and fully valid local remediation commit cannot be published through any sanctioned path. Recovery is gated on the local head being equivalent to the head recorded in the issue lock, but producing a clean worktree — the precondition for recovery itself — requires committing, which advances the head past that recorded value. The two requirements are mutually exclusive, so correct author work becomes permanently unpublishable.
Observed live on issue #607 / PR #767 at master
d12adabeb1cf7810b1286ca8871a9b680646021c.Observed state
master, mergeable truefeat/issue-607-sentry-incident-bridgecb6ae0ca50ea3fea3beae9c9544c257bf6c9949ba487f9fdc94388252b9a234976ca0c9c9ea7f706branches/issue-607-sentry-incident-bridge, cleanREQUEST_CHANGESbysysadminatcb6ae0ca, undismissed, not stalejcwalker3/prgs-author, unchanged across the dead sessiona487f9fdis a strict descendant ofcb6ae0ca— verified bygit merge-base --is-ancestor cb6ae0ca a487f9fd(exit 0), withcb6ae0caas its immediate parent. No history was rewritten; the recorded recovery head remains reachable and unmodified.a487f9fdis the remediation the reviewer's ownNEXT_PROMPTon review 479 requested: the AC4 recurrence-comment path for issue #607.The deadlock
The four gates form a closed cycle. Each is individually correct; the combination admits no exit.
gitea_lock_issuerequires a clean registered worktree. While the remediation exists only as uncommitted changes, recovery is refused — correctly, because dirty state is unverifiable.cb6ae0catoa487f9fd.a487f9fd != cb6ae0ca, so the base-equivalence condition fails and recovery is refused a second time — for the opposite reason. Satisfying gate 1 guarantees failing gate 3, and vice versa. There is no ordering of sanctioned operations that satisfies both.recovered_owning_prdoes not reach them, so an owning PR that the recovery path already proved belongs to this exact author reappears at the duplicate gate as a competing PR and blocks publication independently.Net effect: a
REQUEST_CHANGESverdict cannot be remediated after a session death. The author holds proven ownership, a clean worktree, an unrewritten descendant commit, and an open PR that is theirs — and still has no sanctioned route to publish.Why the tempting workarounds are wrong
Each apparent escape launders false evidence through a guard and must stay blocked:
cb6ae0ca— discards valid remediation work;The fix must make the legitimate path reachable, not weaken the gates that block these.
Root cause
Base-equivalence is enforced as strict head equality against the head recorded at lock time. Equality is the right invariant for detecting rewritten or foreign history, but it is too strong for the only clean-worktree state a recovering author can actually reach. A commit that is a strict descendant of the recorded head, on the same branch, in the same registered worktree, by the same claimant, against the same issue and PR, preserves every property equality was protecting: the recorded head is still reachable, still an ancestor, and still unmodified.
Separately, recovery evidence is computed server-side and then discarded at the boundary. The commit, push, create-PR, and duplicate-assessment gates re-derive ownership from scratch with no knowledge that recovery already proved it, so they re-block work the server has already sanctioned.
Acceptance criteria
AC1. Permit fail-closed recovery when the clean local head is a strict descendant of the recorded PR head, and repository, issue, PR, author, branch, worktree, and prior-lock ownership all match. Every one of these is required; any missing or contradictory element fails closed.
AC2. Propagate server-derived recovery evidence through the commit, push, create-PR, and duplicate-assessment gates, so an owning PR already proven to belong to this author is not re-blocked downstream as a competing PR.
AC3. Continue blocking foreign, mismatched, rewritten, dirty, fabricated, and competing recovery attempts. Specifically: a local head that is not a descendant of the recorded head; a rewritten or force-moved recorded head; a dirty worktree; a different branch, worktree, claimant, profile, issue, or PR; a competing live lock or competing owning PR; and caller-supplied assertions of recovery eligibility.
AC4. Add regression tests reproducing the #607/#767
REQUEST_CHANGESremediation sequence end to end: dead session, dirty worktree refused, commit produces a clean descendant head, recovery permitted, and publication succeeding through commit, push, and PR update.AC5. Preserve all existing identity, WIP, duplicate-work, containment, and reviewer-separation protections. Author, reviewer, and merger separation is unchanged; no recovery path may grant review, approval, or merge capability.
AC6. Recovery evidence must be server-derived. Do not introduce a caller-controlled boolean or any other parameter by which a session can declare its own recovery eligibility, descendant status, or ownership.
AC7. Successful recovery atomically records provenance: prior session identity, replacement session identity, recorded head, accepted descendant head, the ancestry proof, and the claimant.
AC8. Do not special-case issue #607, PR #767, commit
a487f9fd, or any repository-specific identifier. The evidence above is reproduction material, not a fixture.Validation expectations
gitea_lock_issueand the downstream publication tools, not only against the assessor functions.Linkage and ownership boundary
a487f9fd, and both #607 worktrees (branches/issue-607-sentry-incident-bridgeandbranches/baseline-master-issue-607) — evidence only. Do not modify, remediate, review, merge, reset, or delete any of them as part of this work.Verify current line numbers and call sites during implementation rather than treating any reported location as immutable.
Canonical issue state
Canonical Issue State
STATE:
pr_open_awaiting_independent_review
WHO_IS_NEXT:
reviewer
NEXT_ACTION:
Independent prgs-reviewer acquires a reviewer PR lease on PR #769, validates at pinned head
5547399037, and posts a native review verdict.NEXT_PROMPT:
WHAT_HAPPENED:
Author implemented AC1–AC8 on branch fix/issue-768-descendant-recovery, published commit
5547399037via gitea_commit_files, opened PR #769 against master. Issue labels transitioned to status:pr-open.WHY:
Exact head equality made post-dead-session remediation unpublishable; strict-descendant recovery with server-side ancestry proof is the minimal fix that preserves fail-closed ownership gates.
RELATED_PRS:
#769
BLOCKERS:
none
VALIDATION:
Focused recovery suites: 90 passed (+2 subtests). Broader lock/workspace suites: 171 passed. Full suite: 3737 passed, 6 skipped, 2 failed (pre-existing #737 drift only). Head
5547399037. Preserved evidence untouched: #607, PR #767, review #479, a487f9fd.LAST_UPDATED_BY:
jcwalker3 / prgs-author