fix(author): prevent bootstrap lock-provenance dead ends before PR creation #953
Closed
opened 2026-07-27 22:48:51 -05:00 by jcwalker3
·
2 comments
No Branch/Tag Specified
master
feat/issue-708-mcp-namespace-attachment
feat/issue-664-break-glass-restart
feat/issue-665-restart-audit
fix/issue-700-durable-walls
fix/issue-704-prevent-env-workspace-bindings
feat/issue-707-cross-project-boundaries
fix/issue-690-review-profile-switch-guard
fix/issue-953-bootstrap-lock-provenance
feat/issue-949-native-fleet-inventory
fix/issue-943-runtime-context-helpers
fix/issue-945-owning-pr-renewal-evidence
fix/issue-941-scope-guard-bootstrap-wiring
docs/issue-930-remote-mcp-coupling-inventory
fix/issue-892-author-bootstrap-deadlock
fix/issue-686-detect-reject-manual-mcp
fix/issue-672-mcp-config-drift
fix/issue-689-deterministic-mcp-namespace
feat/issue-666-concurrent-mcp-restart-tests
feat/issue-659-maintenance-drain-mode
feat/issue-648-notifications-console
fix/issue-670-direct-master-incident
feat/issue-644-console-recovery
feat/issue-650-providers-insights
feat/issue-669-scoped-component-recovery
docs/issue-668-mcp-ha-rolling-restart
feat/issue-667-console-restart-controls
feat/issue-645-linkage-console
feat/issue-643-request-preview-initiate
fix/issue-897-permission-stale-runtime-classification
feat/issue-641-runtime-session-view
feat/issue-663-restart-classes
feat/issue-661-drain-proof-hard-gate
fix/issue-854-semantic-container-exclusion
issue-640
fix/issue-682-starlette-httpx2
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#953
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.
Related: #850, #887, #890, #891, #892, #442, #447, #760, #790, #947
Problem
gitea_bootstrap_author_issue_worktreecreates an issue lock whose schema no downstream author operation accepts, and the shape cannot be upgraded once the author follows the tool's own reported next action. A sanctioned author cycle that starts with bootstrap therefore reaches a state where the pull request can never be created and no sanctioned recovery path is eligible.Only
gitea_lock_issuewrites the canonical lock fields. Bootstrap writes a different, thinner record and then directs the author straight to implementation.Trigger
Observed during the sanctioned implementation of issue #949:
gitea_bootstrap_author_issue_worktreecreated the issue branch, the registered worktree, and the lock, reportingbranch_created: true,worktree_registered: true,lock_created: true.claimantat the top level (username,profile)lease_id: nullwork_leaselock_provenanceexpires_atexact_next_actiondirected the author to callgitea_whoami, thengitea_resolve_task_capability(task='work_issue'), and "proceed with author implementation in the bootstrapped worktree". It did not direct the author to callgitea_lock_issue.gitea_create_prthen rejected the lock:Unrecoverable state
Every sanctioned recovery path was then simultaneously unavailable. Each gate is individually correct; the combination is the defect.
gitea_heartbeat_issue_locklock does not record both a claimant username and profilework_lease.claimant; bootstrap wrote it at the lock top levelgitea_lock_issueissue lock worktree must be base-equivalent to one of dev/main/master before implementation workis_lease_expiredreturnsFalsewhen noexpires_atis recorded, so a bootstrap lock is treated as never expiring and therefore never renewablegitea_create_prlock_provenanceandwork_leaseNet effect: the lock cannot be heartbeated, renewed, re-locked, upgraded, or accepted by
create_pr.No workaround was applied. The lock file was not hand-edited, the branch pointer was not moved or rewound to satisfy base-equivalence, and no fallback transport was used.
Current reproduction
feat/issue-949-native-fleet-inventory(published)branches/issue-949-fleet-inventory92615f474bf6652d4e9ea59af7fd0dba03b56544masterat82d71b77028a7abd4f8ab4a4e4d89658a187f73dauthor_issue_work-9713b9c3ed2c4a481jcwalker3/prgs-authornullgitea_create_prfail-closed on the issue-lock provenance guardThe #949 implementation itself is complete and published; only the pull request is blocked. Treat source line numbers observed during diagnosis as provisional and re-verify them during implementation.
Required behavior
Bootstrap and ordinary lock acquisition must produce one compatible canonical lock contract.
A successful bootstrap must either:
create_pr; orIt must never direct an author to make commits when following that direction will make every sanctioned recovery path ineligible.
The fix must also provide a safe, sanctioned recovery path for existing incomplete bootstrap locks whose branches already contain legitimate pushed commits.
Acceptance criteria
work_lease, provenance, generation, and expiration schema required by downstream operations.create_praccepts valid bootstrap provenance after sanctioned commit and push operations.exact_next_actionis executable under the state bootstrap actually returned.lease_id=nullwhen the canonical workflow requires a workflow lease.create_prconsume compatible claimant and provenance shapes.Safety requirements
Non-goals
Duplicate verdict
NOT a duplicate. Searched all 400 open and closed issue titles for lock, lease, bootstrap, provenance, claimant, worktree, author, renew, heartbeat, adopt, recover, expire, and create-PR terms, yielding 169 title candidates, and read the bodies of the closest.
gitea_lock_issuecall. It does not specify the lock record bootstrap itself writes, and nothing in it addresses the downstream provenance, heartbeat, or renewal contracts.recover_author_ownershipentry point. Here the stores do not disagree; a single lock is well-formed for its writer and malformed for every reader. Does not namelock_provenance,work_lease, or thecreate_prguard.gitea_lock_issue. It neither corrects the bootstrap lock schema nor recovers already-created incomplete bootstrap locks.gitea_rebind_dirty_same_claimant_author_sessionand dirty-worktree owning-PR continuation. Its non-goals explicitly preserve the clean-worktree requirements of renewal and dead-session recovery. Never mentions bootstrap, provenance, or the create-PR guard.No single existing issue covers both future bootstrap correctness and recovery of already-created incomplete bootstrap locks.
Canonical issue state
[THREAD STATE LEDGER] Issue #953 — author implementation plan published; lock finalized before divergence
What is true now:
fix/issue-953-bootstrap-lock-provenancebranches/issue-953-bootstrap-lock-provenance82d71b7702What changed:
gitea_lock_issuefinalized that same lock to the canonical contract before any implementation byte was writtengitea_heartbeat_issue_locksucceeded against that exact lock with no ownership change and no second lockWhat is blocked:
Who/what acts next:
Author implementation plan
Ownership was established without reproducing the dead end. Bootstrap ran, then the lock was finalized by
gitea_lock_issuebefore any implementation bytes were written, which is the ordering this issue's own NEXT_PROMPT step 1 prescribes.fix/issue-953-bootstrap-lock-provenancebranches/issue-953-bootstrap-lock-provenance82d71b7702gitea_lock_issue, then 3 at heartbeatauthor_issue_work-af66d20143e04ee5Defect verified against the pinned base rather than the issue's line numbers
author_issue_bootstrap.py:1203-1220writesclaimantat the lock top level withlease_idnull and nowork_lease,lock_provenance, orexpires_at.gitea_mcp_server.py:4683-4701is the only canonical writer:work_leasevia_build_author_issue_work_leasepluslock_provenanceviabuild_sanctioned_lock_provenance.issue_lock_store.py:302-308, the ownership check used by heartbeat and legacy rebind, reads the claimant only fromwork_lease.claimant, so a bootstrap lock is refused for not recording both a claimant username and profile.issue_lock_store.py:1115,issue_lock_renewal.py:68, andissue_lock_recovery.py:118already tolerate both shapes, so three readers disagree.issue_lock_store.py:690-703reads expiry only fromwork_lease.expires_at, so a bootstrap lock yields none, is never expired, and #760 exact-owner renewal never engages.issue_lock_store.py:858-879classifies a lock with nowork_leaseas legacy with no recorded expiry, and for the #949 shape no pid, so freshness returns live permanently.issue_lock_provenance.py:128-160, the #447 guard, requires bothlock_provenanceandwork_lease. It is correct and is preserved unchanged.author_issue_bootstrap.py:1265directs the author to implement rather than to finalize the lock.Acceptance-criterion map
author_lock_contract.py,author_issue_bootstrap.py,gitea_mcp_server.pywork_lease, provenance, generation, and expiration, consumed by both writerstest_issue_953_bootstrap_lock_contract.pygitea_lock_issueissue_lock_storeownership checkgitea_heartbeat_issue_lockissue_lock_renewalgitea_lock_issueissue_lock_provenanceunchangedgitea_create_prauthor_issue_bootstrapissue_lock_storefreshnessPreserved state
Issue #949 is untouched and stays deferred. Branch
feat/issue-949-native-fleet-inventoryremains at92615f474b, its worktree and malformed lock are not modified, and its pull request is not retried. The #949-shaped regression uses isolated fixtures only. Issues #950 through #952 and the PR #906 lease are out of scope and unmodified.Canonical Issue State
STATE: in-progress
WHO_IS_NEXT: author
NEXT_ACTION: Implement the canonical bootstrap and lock contract, add the target-specific recovery and read-only inspection surfaces, add the #949-shaped regression against isolated fixtures, update the author workflow documentation, then open exactly one pull request and hand off to an independent reviewer.
NEXT_PROMPT:
WHAT_HAPPENED: Native preflight verified profile prgs-author, identity jcwalker3, role author, repository binding Scaled-Tech-Consulting/Gitea-Tools, and full parity at
82d71b7702with in_parity true, live_stale false, restart_required false, and mutation_safe true. Every required capability resolved before invocation. The existing-work search found no pull request, branch, worktree, lease, assignee, or comment for this issue. Bootstrap created the branch and registered worktree and wrote the incomplete lock exactly as reported, so gitea_lock_issue finalized it to the canonical contract before any implementation byte was written, and the pre-edit heartbeat then succeeded against that exact lock.WHY: Bootstrap and ordinary lock acquisition write two different lock shapes, so heartbeat, renewal, and the create-PR provenance guard all refuse a lock that bootstrap reported as created. Finalizing the lock before divergence avoids the unrecoverable state while the fix is implemented.
RELATED_PRS: none yet for this issue; exactly one pull request will be opened from branch fix/issue-953-bootstrap-lock-provenance.
BLOCKERS: None. The lock is canonical and heartbeatable at generation 3, so implementation may proceed.
VALIDATION: The bootstrap lock read back with a top-level claimant, lease_id null, and no work_lease, lock_provenance, or expires_at. After gitea_lock_issue the same lock file records work_lease with claimant, created_at, expires_at, task_session_id, and lifecycle_version heartbeat-v1, plus lock_provenance with source gitea_lock_issue, at lock_generation 2. gitea_heartbeat_issue_lock then succeeded and advanced to generation 3 with no ownership change and no second lock. Full test evidence will accompany the pull request.
LAST_UPDATED_BY: prgs-author / jcwalker3
[THREAD STATE LEDGER] Issue #953 — PR #954 published at cdf0dae; author handoff to independent reviewer
What is true now:
status:pr-openmaster, head branchfix/issue-953-bootstrap-lock-provenancecdf0daefa9(local head, remote head, and PRhead_shaall agree)masterat82d71b7702What changed:
author_lock_contract.pyas the single canonical lock definition, consumed by bothgitea_lock_issueandgitea_bootstrap_author_issue_worktreeissue_lock_store.lock_claimantto the one shared claimant reader and used it in the ownership checkgitea_recover_incomplete_bootstrap_lockand the read-onlygitea_inspect_issue_lock_contractdocs/author-issue-lock-contract.mdand 61 new test casescdf0daeand opened pull request #954What is blocked:
Who/what acts next:
cdf0daefa9Canonical Issue State
STATE: in-review
WHO_IS_NEXT: reviewer
NEXT_ACTION: Perform an independent formal review of pull request #954 at head
cdf0daefa9against the twenty acceptance criteria and the safety requirements of this issue, then record a formal verdict.NEXT_PROMPT:
WHAT_HAPPENED: Bootstrap created the branch, the registered worktree, and an incomplete lock exactly as this issue reports. The lock was finalized by gitea_lock_issue to the canonical contract before any implementation byte was written, and heartbeated throughout, ending at generation 10 with no ownership change and no second lock. The implementation unified the bootstrap and lock acquisition contracts, added the target-specific recovery and read-only inspection surfaces, added sixty-one test cases including the full bootstrap to implement to commit to push to create pull request regression against isolated fixtures, and documented the required ordering. The branch was published natively at
cdf0daeand pull request #954 was created and read back.WHY: Bootstrap and ordinary lock acquisition wrote two different lock shapes, so heartbeat, renewal, re-lock, and the create-PR provenance guard all refused a lock that bootstrap reported as created, leaving no eligible recovery path once the branch carried commits. One shared contract removes the disagreement, and the new recovery operation repairs locks already written by the old code without rewinding their committed work.
RELATED_PRS: #954 is the only pull request for this issue.
BLOCKERS: None. Pull request #954 is open and mergeable, and awaits an independent reviewer verdict.
VALIDATION: New suite
tests/test_issue_953_bootstrap_lock_contract.py61 passed, exit 0. Adjacent lock, bootstrap, lease, renewal, recovery, heartbeat, and capability suites 283 passed with 92 subtests, exit 0. Full suite at headcdf0dae28 failed, 5753 passed, 6 skipped, 1042 subtests. Full suite at base82d71b7728 failed, 5692 passed, 6 skipped, 1042 subtests. The failing test-ID sets are identical, so zero regressions; the plus sixty-one passes are this issue's new suite. All twenty-eight failures were reproduced at the pinned base, and four that looked like plausible candidates for being caused by this change were re-run individually at base and also fail there. The live create-PR provenance guard accepted the canonical lock, which is an end-to-end proof of the fix.LAST_UPDATED_BY: prgs-author / jcwalker3
Preserved state
Issue #949 remains open and unmodified. Branch
feat/issue-949-native-fleet-inventoryis still at92615f474bon both the remote and its worktree, its worktree and malformed lock were not modified, and its pull request was not retried. Issues #950 through #952 and the PR #906 lease were not modified. The control checkout remained clean and onmasterthroughout.