fix: preserve capability preflight across safe reads (Closes #469) #502
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
No labels
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#502
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
Closes #469.
Preserves resolved capability preflight state across interleaved read-only
whoamicalls when the identity/workspace state remains clean, while still consuming capability proof after a mutation and failing closed on missing or mismatched capability proof.Changes
gitea_mcp_server.py— tracks the resolved task, preserves capability proof through safewhoamireads, adds explicit task mismatch checks, and passes mutation task names into preflight verification paths.tests/test_preflight_read_survival.py— regression tests for resolve -> safe read -> mutation, missing capability, task mismatch, proof consumption, and dirty whoami recovery.Validation
Full suite:
The failure is pre-existing on clean
prgs/master:Temporary baseline worktree was removed after proof.
Branch / lock
fix/issue-469-preflight-read-survival3bce0a55fb53456f5b946785c1f8711f254967b0/Users/jasonwalker/Development/Gitea-Tools/branches/issue-469-preflight-read-survival/Users/jasonwalker/Development/Gitea-Tools/branches/issue-469-lock-base-20260708LLM Handoff Metadata
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #502
issue: #469
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 51615-7dddf5865aec
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr502-issue-469
phase: claimed
candidate_head:
3bce0a55fbtarget_branch: master
target_branch_sha:
b3edd53last_activity: 2026-07-08T07:50:05Z
expires_at: 2026-07-08T09:50:05Z
blocker: none
APPROVE — PR #502 @
3bce0a55fb53456f5b946785c1f8711f254967b0Reviewer: sysadmin / prgs-reviewer (not author
jcwalker3; self-review check passed,self_author:false).Scope
Preserves resolved capability preflight across interleaved read-only
whoamicalls without weakening mutation authorization. Closes #469.Verified in code
gitea_mcp_server.py(+122/−30) andtests/test_preflight_read_survival.py(+106). No unrelated files; secret/artifact scan clean.whoamionly when whoami has no violation and no new tracked dirty delta; otherwise_clear_preflight_capability_state()runs. Fail-closed behavior intact.verify_preflight_purity) → proof cannot replay across mutations (#469 AC3).resolve_task_capability(task A)→ mutation for task B raisesPre-flight task mismatch.resolved_taskis threaded fromgitea_resolve_task_capabilityinto all gated mutations (AC5).Validation (isolated reviewer worktree
branches/review-pr502-issue-469@3bce0a5)test_preflight_read_survival.py+test_resolve_task_capability.py+TestPreflightVerification→ 35 passed.TestMergePR::test_merge_blocked_on_stale_approval_head) is pre-existing on cleanprgs/master(b3edd53) — reproduced on a baseline worktree; not introduced by #502 (which touches no merge-stale-approval code).git diff --checkclean;py_compileok.Duplicate / supersession note
PR #490 (Closes #470) contains #502's two #469 commits plus a #470 contract/docs layer and is currently
mergeable:false(conflicts with master). #502 is the canonical landing vehicle for the core #469 fix. Recommend superseding #490 (reconciler close) after this lands, and salvaging #470's explicit-message/runbook layer as a small follow-up on merged #502 if still wanted.Handoff
Do not merge in this reviewer session. Hand to a merger-capable session pinned to reviewed head
3bce0a55fb53456f5b946785c1f8711f254967b0.repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #502
issue: #469
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 51615-7dddf5865aec
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr502-issue-469
phase: claimed
candidate_head:
3bce0a55fbtarget_branch: master
target_branch_sha:
b3edd53last_activity: 2026-07-08T08:01:21Z
expires_at: 2026-07-08T10:01:21Z
blocker: none