fix(workflow): remove status:pr-open when the associated PR reaches a terminal state #780
Closed
opened 2026-07-21 14:04:34 -05:00 by jcwalker3
·
3 comments
No Branch/Tag Specified
master
feat/issue-784-durable-dependency-edges
fix/issue-781-mcp-edit-issue-tool
fix/issue-780-terminal-pr-open-label-cleanup
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#780
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.
Problem
The workflow applies
status:pr-openwhile an issue has an active pull request, but the label is not reliably removed when that PR is merged or otherwise reaches a terminal state.A repository-wide audit found 40 closed issues carrying the stale label:
status:pr-open.This required manual label repair and shows that the normal merge/controller closure path does not enforce terminal label cleanup.
Expected behavior
When the PR associated with an issue is merged, closed, superseded, or otherwise made terminal:
status:pr-openfrom the associated issue.status:pr-openwas the only label.Scope
Review every sanctioned terminal path that can leave an issue associated with a non-open PR, including:
There should be one authoritative cleanup rule or shared helper rather than independent behavior that can drift between paths.
Acceptance criteria
status:pr-openis automatically absent after every applicable terminal transition.status:pr-open.Evidence
The cleanup audit examined all 356 closed issues through complete pagination. Forty stale instances were repaired in total, including #626. Final read-back returned zero closed issues labeled
status:pr-open, with no issue-state or unrelated-label drift.RELATED ISSUE
Related: #513 — defines the issue-label taxonomy and generic workflow transitions. Issue #780 addresses enforcement of
status:pr-opencleanup when a PR becomes terminal.This comment records the relationship because the documented gitea_edit_issue tool is not implemented on the current server.
Issue claim heartbeat
[THREAD STATE LEDGER]
what is true now
ed0e8c82de. Merge result: merge commit8e149e6cfalanded on master.status:pr-open. Its live label set isstatus:pr-open,type:bug,workflow-hardening.what changed
approval_at_current_headtrue at the exact pinned head.what is blocked
pr_open_label_cleanupfield and the terminal label cleanup did not execute. The MCP process that performed this merge was loaded from masterdf3167488c, which predates this change.pr_open_label_cleanupandgitea_assess_terminal_label_hygieneexist only in the code this merge has just landed, so the merge path emitted the legacycleanup_statusfield instead. That legacy field tracksstatus:in-progress, notstatus:pr-open, and its "not present" value for #780 says nothing about the label under audit here.gitea_assess_terminal_label_hygieneis not registered in it.who/what acts next
8e149e6cfaand restarts every gitea MCP namespace so the landed code is the code in memory.status:pr-openfrom issue #780 throughgitea_cleanup_terminal_pr_labels(reasonretry_recovery), preservingtype:bugandworkflow-hardeningverbatim.gitea_assess_terminal_label_hygieneand confirms zero residual violation for #780.gitea_cleanup_post_merge_moot_leasefor PR #782 withapplytrue. Dry-run evidence was recorded this session: session 48296-08f4a3cd6b63, candidate headed0e8c82de, lease marker 13658,lease_moottrue,cleanup_allowedtrue.terminal_pr_label_cleanup.py; do not reopen PR #782; do not touch issue #781.Canonical Issue State
STATE: PR #782 landed on master at the pinned head; terminal
status:pr-opencleanup outstandingWHO_IS_NEXT: user
NEXT_ACTION: Advance the canonical checkout to
8e149e6cfa, restart the gitea MCP namespaces, then hand off to prgs-reconciler to retirestatus:pr-openfrom issue #780 viagitea_cleanup_terminal_pr_labelsand confirm withgitea_assess_terminal_label_hygiene.NEXT_PROMPT:
WHAT_HAPPENED: The merger role verified OS identity, repository binding, namespace health, runtime/master parity, and mutation eligibility, acquired a native merger lease after finding no active reviewer lease to adopt, rechecked the live head and review state immediately before mutation, and merged PR #782 at exactly
ed0e8c82de. Read-after-write confirms PR #782 in closed state with merge commit8e149e6cfa. Read-after-write on issue #780 showsstatus:pr-openstill attached, because the self-applying cleanup this PR introduces was not present in the process that ran the merge.WHY: An MCP process loads its code at startup. This change landed remotely during this session, so the running process continues to execute the pre-change merge path until the canonical checkout advances and the namespaces restart. The residual label is a deployment-ordering artifact, not a defect in the landed rule.
RELATED_PRS: #782
BLOCKERS: environment/tooling blocker — the process that performed the merge predates the cleanup code this merge landed; a namespace restart is required before the cleanup and its hygiene assessor can run.
VALIDATION: merge gates all passed (identity sysadmin/prgs-merger, author jcwalker3, no self-merge, PR mergeable, review 492 undismissed and not stale with approval_at_current_head true, namespace health client-namespace proven, master parity in parity at
df3167488c, lease provenance sanctioned_acquire_merger comment 13658); read-after-write on PR #782 and issue #780 completed; source inspection confirmspr_open_label_cleanupoccurs 11 times andassess_terminal_label_hygienetwice ated0e8c8and zero times atdf31674.LAST_UPDATED_BY: sysadmin / prgs-merger