Capability map, resolver, and router can disagree on review-task roles; role-stamp mismatch escapes as unhandled internal_error in submit path #723
Closed
opened 2026-07-16 17:32:11 -05:00 by jcwalker3
·
5 comments
No Branch/Tag Specified
master
fix/issue-987-native-mcp-bootstrap
feat/issue-985-project-scoped-launcher-identity
fix/issue-983-cross-repo-base-ref
feat/issue-980-stale-worker-retirement
fix/issue-975-client-identity-heartbeat
fix/issue-973-cross-repo-canonical-roots
fix/issue-970-safely-resolve-missing-worktrees
fix/issue-969-native-mcp-bootstrap
feat/issue-664-break-glass-restart
feat/issue-708-mcp-namespace-attachment
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
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
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
Something is not working
This issue or pull request already exists
New feature
Need some help
Something is wrong
More information is needed
This won't be fixed
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#723
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.
Product defects exposed by incident #722
Two distinct code defects allowed commit
970e68bto strand formal reviews and to fail with an unactionable error. The break-glass repair for #722 restores the mappings and adds first-line invariant tests; the defects below need their own reviewed fixes.Defect A — no invariant ties the capability map to configured profiles or the router
task_capability_map.pyis documented as "the single source of truth; regression tests assert tool gates cannot drift from it", but nothing asserts:970e68b,review_pr/approve_pr/request_changes_prrequiredrole=mergerwhile every merger profile forbids the review permissions →matching_configured_profile: []and a repository-wide review lockout that no test named directly.role_session_router.REVIEWER_TASKSstill saidreviewerwhile the map saidmerger. Two authorities, no consistency test._build_runtime_task_capabilitiesreports permission-onlyallowed_in_current_session/matching_configured_profiles(no role-exclusive filter), sogitea_get_runtime_contextreportedreview_pras allowed whilegitea_resolve_task_capabilityfail-closed the same task in the same session.Defect B — capability/preflight disagreement surfaces as generic
internal_errorObserved on PR #721 (reviewer session, prgs-reviewer):
gitea_resolve_task_capability("review_pr")stamps_preflight_resolved_roleviarecord_preflight_check(...)before computing/denyingallowed_in_current_session, so a denied resolve still poisons the session role stamp (here:merger).gitea_mark_final_review_decisionhas no role-kind gate in its chain (daemon guard → decision lock → session → workflow load → head → eligibility action "review" is permission-only) → it succeeded and persisted a durable ready-APPROVE decision lock.gitea_submit_pr_review→_evaluate_pr_review_submission→_verify_role_mutation_workspace→_effective_workspace_role()returns the stampedmerger→nwb.assess_namespace_mutation_workspace(role_kind="merger", ...)blocks against the reviewer session →raise RuntimeError(...)escapes the tool uncaught → the client sees a genericinternal_errorinstead of a structured fail-closed result with reasons.Net effect: mark/submit half-completed states with no actionable error. Compare #718 (same generic-
internal_errorpattern in the adopt-lease tool).Suggested acceptance criteria
REVIEWER_TASKShasrequired_role(task) != "reviewer"(and equivalents forMERGER_TASKS).record_preflight_checkmust not stamp a resolved role for a task the resolve denied (or the stamp must carry the denial), so a later mutation preflight fails closed with structured reasons instead of raising._evaluate_pr_review_submissionconverts workspace/role-binding failures intoresult["reasons"](fail closed) rather than propagating exceptions asinternal_error.gitea_get_runtime_contexttask capabilities apply the same role-exclusive filter as the resolver, or explicitly label their view as permission-only.References
970e68bddb510aef1b2c4de58981f03ed570e98e80f59b334e6671b08006725292c08a8e8b6c823f, comments 11891/11893/11895Author claim — issue #723 (comment-based; label tools degraded)
Claiming this issue for implementation.
gitea_mark_issue/gitea_set_issue_labelscurrently returninternal_error(daemon subprocess spawn failure pergitea_diagnose_terminal), so this comment is the durable claim signal; thestatus:in-progresslabel will be reconciled when the label path recovers.Branch:
fix/issue-723-capability-role-invariantsWorktree:
branches/fix-issue-723-capability-role-invariants(fresh from master67e4a2b5e96b680a1dcb90a20c2ebf87357a3b1f, clean)Live corroboration of Defect B this session (2026-07-17 ~04:30Z):
gitea_acquire_reviewer_pr_lease,gitea_mark_issue, andgitea_set_issue_labelsall surfaced genericinternal_errorwhile an underlying subprocess spawn failure was the real cause — the same unactionable-error pattern this issue names in AC4.Canonical Issue State
STATE: claimed for implementation by prgs-author at master
67e4a2b5e9WHO_IS_NEXT: author
NEXT_ACTION: implement AC1-AC5 with tests in branches/fix-issue-723-capability-role-invariants, run full suite, open the implementing PR
NEXT_PROMPT:
WHAT_HAPPENED: author picked up the issue after reproducing the Defect B internal_error pattern live; existing first-line invariant tests from the #722 break-glass repair (tests/test_task_capability_role_invariants.py at
ba79154) will be extended rather than duplicatedWHY: two authorities (capability map, router) plus permission-only runtime reporting can silently disagree, and role-stamp mismatches escape as unactionable internal_error; fail-closed structured reasons are required
RELATED_PRS: implementing PR to follow from branch fix/issue-723-capability-role-invariants
BLOCKERS: none for implementation; label-claim tooling degraded (internal_error) documented above
VALIDATION: pending — focused invariant/resolver/submission suites plus full suite will be recorded in the PR
LAST_UPDATED_BY: prgs-author (jcwalker3), 2026-07-17
[THREAD STATE LEDGER]
what is true now: issue #723 remains open and is claimed by prgs-author via this comment; worktree branches/fix-issue-723-capability-role-invariants exists clean at master
67e4a2b5.what changed: author claim recorded; live Defect B corroboration captured from this session's tool failures.
what is blocked: only the label-based claim signal; classification below. Implementation proceeds now.
who/what acts next: author implements AC1-AC5 in the named worktree.
Server-side decision state: no review or merge decision exists for this issue; implementation not yet delivered
Local verdict/state: fresh clean worktree at master head; no local edits yet
Next actor: author
Required action: implement AC1-AC5 with tests, validate, open PR
Blocker classification: environment/tooling blocker
Do not do: do not modify the #722 break-glass invariant tests' intent; do not self-review or merge the eventual PR; do not touch capability behavior beyond the five acceptance criteria
Implementation delivered — PR creation pending tooling recovery
AC1–AC5 are implemented, tested, committed, and pushed.
gitea_lock_issueandgitea_create_prcurrently returninternal_error(same daemon subprocess spawn failure noted in the claim comment), so the pull request itself is not yet open. No raw-API bypass was used.Branch:
fix/issue-723-capability-role-invariantsHead:
bc9366c(pushed to prgs)Worktree:
branches/fix-issue-723-capability-role-invariantsChanges:
task_capability_map.ROLE_EXCLUSIVE_TASKSshared constant; resolver inline copy removed (AC1/AC5 drift surface gone)_preflight_resolved_role; stale stamps cleared via_clear_resolved_capability_stamp_evaluate_pr_review_submissionreturns structuredreasons+blocker_kind=workspace_role_bindinginstead of letting RuntimeError escape as genericinternal_error_build_runtime_task_capabilitiesapplies the resolver's role-exclusive filter (entries labeledrole_filtered/permission_only);matching_configured_profileshonors declared rolestests/test_issue_723_role_stamp_and_submission.py(new) + extensions totests/test_task_capability_role_invariants.pyTest evidence: focused 22 passed (+48 subtests); adjacent suites 72 passed; full suite 2929 passed / 6 skipped / 221 subtests (single pre-existing Starlette warning, #682).
Observed adjacent drift, documented not fixed:
delete_branchmaps to author but only the reconciler holdsgitea.branch.delete; routerRECONCILER_TASKSlistsreconcile-landed-prwhile the map says author;reconcile_already_landedabsent from the map.Canonical Issue State
STATE: implementation complete on pushed branch fix/issue-723-capability-role-invariants at head bc9366c; pull request not yet open because PR-creation tooling returns internal_error
WHO_IS_NEXT: author
NEXT_ACTION: retry gitea_lock_issue + gitea_create_pr for branch fix/issue-723-capability-role-invariants once the MCP daemon subprocess spawn failure clears (client reconnect or daemon restart), then hand off to an independent reviewer
NEXT_PROMPT:
WHAT_HAPPENED: author implemented AC1-AC5 with new and extended tests, ran the full suite green, committed
bc9366c, and pushed the branch; lock/create-PR tools failed with internal_error so the PR remains to be openedWHY: the shared role-exclusive constant plus stamp/structured-error fixes close both defects; the PR step is mechanically prepared and needs only working tooling
RELATED_PRS: implementing PR to be opened from fix/issue-723-capability-role-invariants
BLOCKERS: gitea_lock_issue and gitea_create_pr return internal_error (daemon subprocess spawn failure); comment path unaffected
VALIDATION: full suite 2929 passed / 6 skipped / 221 subtests in the worktree; focused suites recorded above
LAST_UPDATED_BY: prgs-author (jcwalker3), 2026-07-17
[THREAD STATE LEDGER]
what is true now: branch fix/issue-723-capability-role-invariants carries the complete AC1-AC5 implementation at pushed head
bc9366cwith the full test suite green; no pull request exists yet for it.what changed: implementation, tests, commit, and push completed since the claim comment; lock/create-PR attempts recorded internal_error.
what is blocked: only the lock + PR-creation step; classification below.
who/what acts next: author retries lock + create_pr after tooling recovery, then an independent reviewer takes the PR.
Server-side decision state: no review or merge decision exists; no PR is open for this branch
Local verdict/state: worktree clean at bc9366c; all changes committed and pushed
Next actor: author
Required action: retry gitea_lock_issue then gitea_create_pr for the pushed branch after MCP daemon recovery
Blocker classification: environment/tooling blocker
Do not do: do not open the PR via raw API bypass; do not self-review or merge; do not rework the branch while the PR step is pending
CTH: Author Handoff
Status: implementation_complete_pending_review
Next owner: reviewer
Current blocker: none
Decision: PR #766 is ready for independent review at pinned head
4b8a9219d85bc99b6abeebb4dc9db3e344bc27e5.Proof: native author identity and lock passed; local and remote heads match; required validation completed with two pristine-base-matched unrelated failures.
Next action: independent reviewer reviews PR #766 at the pinned head.
Ready-to-paste prompt: Review PR #766 for issue #723 at head
4b8a9219d85bc99b6abeebb4dc9db3e344bc27e5; validate the role-stamp/runtime/workspace-binding invariants and submit the appropriate independent verdict.Canonical Issue State
STATE: implementation complete pending independent review on PR #766 at head
4b8a9219d8WHO_IS_NEXT: reviewer
NEXT_ACTION: review PR #766 at exactly 4b8a9219d85bc99b6abeebb4dc9db3e344bc27e5; the author must not review, approve, request changes, or merge
NEXT_PROMPT:
WHAT_HAPPENED: reconstructed #723 against current master from archive/capability-role-invariants-bc9366c and archive/role-poisoning-dfb5ebd; committed and pushed the implementation; opened PR #766 with Closes #723
WHY: capability mapping, resolver stamps, runtime reporting, and workspace-role failures must agree and fail closed without poisoning later permitted operations
RELATED_PRS: PR #766
BLOCKERS: none; two unrelated full-suite failures were reproduced with identical signatures on pristine detached base
fcf6981b1bVALIDATION: focused #723/resolver/invariant 47 passed plus 78 subtests; review/lease 270 passed; runtime/profile/workspace/repository/preflight 418 passed plus 119 subtests; expanded focused/lease 81 passed plus 78 subtests; full suite 3711 passed, 6 skipped, 491 subtests with exactly two base-matched failures; diff check and python3 compile passed
LAST_UPDATED_BY: prgs-author (jcwalker3), 2026-07-19
Archive preservation: archive/capability-role-invariants-bc9366c remains bc9366c394b4bc5ab35d90ae5cbaad879ab5e612; archive/role-poisoning-dfb5ebd remains
dfb5ebd0af.[THREAD STATE LEDGER] PR #766 / Issue #723 — reconciliation cleanup completed after merge performed
What is true now:
d12adabeb1d12adabeb1(master; PR head was4b8a9219d8)d12adabe, 0/0 versus prgs/mastergit merge-base --is-ancestor 4b8a9219 prgs/masterreturned true; branch-scoped post-delete readback returned not_foundWhat changed:
status:pr-openlabel removed from this issue; labels now mcp, safety, type:bug, workflow-hardeninggit branch -d4b8a9219, ancestor of master)What is blocked:
Who/what acts next:
bc9366c394) or local branch issue-723-role-poisoning as cleanup targets — neither is an ancestor of master and both were preservedd12adabeb1Canonical Issue State
STATE:
closed
WHO_IS_NEXT:
controller
NEXT_ACTION:
Start a fresh controller iteration and select the next eligible workflow phase from live state.
NEXT_PROMPT:
Run one fresh Gitea-Tools controller iteration at master
d12adabeb1. Do not reuse any state from the PR #766 reconciliation cycle.WHAT_HAPPENED:
Reconciler cycle removed the residual artifacts of PR #766: stale label, remote source branch, author worktree plus its local branch, and merger worktree.
WHY:
PR #766 reached its terminal state with merge performed, and its head SHA is an ancestor of master, so its branch, worktrees, and open-PR label carry no remaining workflow meaning.
RELATED_DISCUSSION:
none
RELATED_PRS:
BRANCH:
none — fix/issue-723-role-stamp-invariants deleted remotely and locally
HEAD_SHA:
d12adabeb1VALIDATION:
Ancestor proof true; post-delete readback not_found; worktree snapshot reconciles 28 to 26 directories and 21 to 19 registered worktrees with exactly two logged removals; control checkout clean and 0/0 versus prgs/master.
BLOCKERS:
none
LAST_UPDATED_BY:
sysadmin / prgs-reconciler / 2026-07-20
Branch disposition — LANDED_EQUIVALENT (supervised reconciler)
Profile: prgs-reconciler / sysadmin
Date: 2026-07-20
Scope: Issue #723 only; no source mutation; no PR create/review/merge.
Candidate
fix/issue-723-capability-role-invariantsbc9366c394b4bc5ab35d90ae5cbaad879ab5e612branches/fix-issue-723-capability-role-invariantsprgs/…[gone]67e4a2b…is on master)fix/issue-723-role-stamp-invariants, lease expired, PID dead)Landed implementation proof (#723)
fix/issue-723-role-stamp-invariants4b8a9219d85bc99b6abeebb4dc9db3e344bc27e5d12adabeb1cf7810b1286ca8871a9b680646021cEquivalence evidence (not “one unique commit ⇒ keep”)
bc9366c…patch-id:70807be553f826cb1c2b76a486cb4cd8c28c1fb64b8a921…patch-id:9a6c7f14dcd74b97afe8ba2ff1a8442f7240fa93_clear_resolved_capability_stamp(AC3)workspace_role_bindingstructured fail-closed (AC4)ROLE_EXCLUSIVE_TASKS+role_filtered/permission_onlyruntime views (AC1/AC5)ROLE_EXCLUSIVE_TASKSis a strict subset of master/landed (16 ⊆ 26); master adds lease/update tasks — not missing exclusive tasks relative to the candidate.tests/test_resolve_task_capability.py(absent from candidate commit).fix-issue-723-role-stamp-invariants@4b8a921…as the reviewed implementation; issue closed after merged12adab…. Candidate branch is a non-PR orphan WIP, not the merged subject.Disposition
LANDED_EQUIVALENT
Strict obsolete subset / superseded rewrite of the final #766 implementation. No author PR should be opened for this candidate. AC behavior required by #723 is on master via #766; the unique commit is not unpublished required work.
Cleanup decision (this iteration)
gitea_cleanup_merged_pr_branchtargets merged PR #766 sourcefix/issue-723-role-stamp-invariants, not this orphan…-capability-role-invariantsref.gitea_reconcile_superseded_by_merged_prrequires a target PR; candidate has no PR.Preservation
branches/fix-issue-723-capability-role-invariantsand branchfix/issue-723-capability-role-invariantsCanonical Issue State
STATE:
closed; implementation landed via PR #766; orphan branch fix/issue-723-capability-role-invariants at
bc9366cdispositioned LANDED_EQUIVALENT and preserved pending sanctioned orphan-equivalent cleanupWHO_IS_NEXT:
controller
NEXT_ACTION:
Stop. No author recovery PR for this candidate. Optional later: reclaim disk only via a sanctioned orphan cleanup that consumes this disposition (subset ROLE_EXCLUSIVE proof + PR #766 merge
d12adab/ head4b8a921).NEXT_PROMPT:
WHAT_HAPPENED:
Supervised reconciler compared clean candidate
bc9366cagainst merged PR #766 (4b8a921/ merged12adab). Candidate is an earlier non-identical rewrite; master fully supersets its ROLE_EXCLUSIVE set and AC production paths; landed tests supersede/rename cand coverage and add more. Disposition LANDED_EQUIVALENT; worktree preserved (no orphan cleanup consumer).WHY:
Git uniqueness alone is not unpublished AC work. Final accepted path is PR #766 branch/head; candidate is a superseded WIP rewrite.
RELATED_PRS:
#766 (landed Closes #723, merge
d12adab, head4b8a921); #767 (open #607 — author WIP; not touched); #722 (incident context for #723)BLOCKERS:
none for #723 completion; orphan worktree cleanup blocked only by lack of a sanctioned orphan-equivalent cleanup consumer
VALIDATION:
LAST_UPDATED_BY:
prgs-reconciler / sysadmin / supervised branch-disposition iteration 2026-07-20