fix(author): harden dirty-session rebind inventory and journal identity (#868) #869
Merged
sysadmin
merged 1 commits from 2026-07-24 01:00:54 -05:00
fix/issue-868-dirty-rebind-inventory-journal into master
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#869
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 #868.
Follow-up correction for two medium-severity defects discovered after PR #865 was approved and merged. PR #865 remains closed and unchanged — these findings were not submitted as a late blocking review on that PR.
Context
ef14622…)Finding 1 — Complete dirty-inventory revalidation
Defect: apply verified fingerprints for expected paths only; it did not recollect and compare the complete tracked+untracked dirty inventory immediately before and after
bind_session_lock.Fix:
revalidate_complete_dirty_inventory()collects full inventory viagit status --porcelain -uallbind_session_lock(no newly authoritative live session)Finding 2 — Complete recovery-journal identity
Defect:
JOURNAL_PHASE_ASSESSEDomitted remote, org, repo, claimant identity, and claimant profile.Fix:
validate_journal_operation_identity()rejects missing, mismatched, cross-repository, cross-claimant, or incomplete legacy journalsalready_reboundNon-weakening
Ordinary dirty-worktree refusal, same-claimant verification, dead-PID proof, registration/canonical-root checks, competing ownership, journal/CAS crash safety, author/reconciler boundaries, reviewer/merger refusal, and head pins are unchanged.
Files
dirty_same_claimant_session_rebind.py— inventory revalidation + journal identitytests/test_dirty_same_claimant_session_rebind.py— focused regression + reconciler success pathTests
Reconciler execution-test disposition
Added
test_reconciler_success_path_tightly_pinnedwithauthorize_reconciler_execute=True, complete pin set, successful rebind, and proof that no commit/push/publication/review/merge capability is stamped on provenance.Non-mutation confirmation
ef14622…branches/baseline-master-issue-850untouchedCommit
ba3ea3012c36db888d6189fee577c9f3a9805c1bNext role
gitea-reviewer for this follow-up PR at the authoritative head above.
Author handoff — post-merge remediation for PR #865 medium findings
Preflight proof (author)
jcwalker3prgs-authorauthorprgs/Scaled-Tech-Consulting/Gitea-Toolsef14622ba0badd0cd7d654c05af13aca7d81bc05in_paritytruelive_stalefalserestart_requiredfalsemutation_safetruestop_requiredfalseDuplicate-search result
No open or closed issue owned the complete remediation (full dirty-inventory revalidation and complete recovery-journal identity for post-merge #865 defects). Adjacent: #864 closed via #865; #860/#861 distinct orphan-recovery path. Created #868.
Identifiers
fix/issue-868-dirty-rebind-inventory-journalbranches/fix-issue-868-dirty-rebind-inventory-journalba3ea3012c36db888d6189fee577c9f3a9805c1bba3ea3012c36db888d6189fee577c9f3a9805c1b(equals commit)Disposition of both medium findings
Finding 1 — Complete dirty-inventory revalidation:
revalidate_complete_dirty_inventory()immediately before and afterbind_session_lock. Exact path-set equality + fingerprints; fail closed for add/remove/rename/fingerprint drift; pre-bind failure never establishes a live session.Finding 2 — Complete recovery-journal identity:
JOURNAL_PHASE_ASSESSEDpersists remote, org, repo, claimant_identity, claimant_profile. Validated on execute, resume, retry, andalready_rebound. Incomplete legacy / cross-repo / cross-claimant / replay refused.Inventory revalidation design
git status --porcelain -uall).bind_session_lock.Journal identity / replay-protection design
validate_journal_operation_identity()fail-closed for missing/mismatched fields.already_reboundrequires complete matching identity + full inventory revalidation.Exact test commands and results
Reconciler execution-test disposition
test_reconciler_success_path_tightly_pinnedadded:authorize_reconciler_execute=True, complete pins, successful rebind, no commit/push/publication/review/merge capability stamped.Blocked production state not mutated
ef14622…); no late review submittedbranches/baseline-master-issue-850untouchedCanonical Issue State
STATE: awaiting-review
WHO_IS_NEXT: reviewer
NEXT_ACTION: Independent review of PR #869 at authoritative head
ba3ea3012cagainst #868 acceptance criteria for both medium findings; submit verdict; stopNEXT_PROMPT:
WHAT_HAPPENED: Author delivered follow-up PR #869 for post-merge medium defects from PR #865 (complete inventory revalidation + journal identity).
WHY: PR #865 merged before two medium findings could be submitted as blocking review; remediation must land via new issue/PR without amending closed #865.
RELATED_PRS: #869 (this PR, Closes #868); #865 (closed/merged, not amended); #861 (blocked downstream, not mutated)
BLOCKERS: none
VALIDATION: 142 passed focused suite; 72 passed role/capability suite; remote branch head equals ba3ea3012c36db888d6189fee577c9f3a9805c1b; only one PR for #868
LAST_UPDATED_BY: jcwalker3 / prgs-author
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #869
issue: #868
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 76701-8e8d0ae1c148
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/fix-issue-868-dirty-rebind-inventory-journal
phase: claimed
candidate_head:
ba3ea3012ctarget_branch: master
target_branch_sha:
ef14622ba0last_activity: 2026-07-24T05:23:21Z
expires_at: 2026-07-24T05:33:21Z
blocker: none
Canonical PR State
STATE: reviewed-approved
WHO_IS_NEXT: merger
NEXT_ACTION: gitea-merger acquires a merger PR lease and merges PR #869 into master at head
ba3ea3012con explicit approval. Approval is head-scoped and becomes invalid if the head moves.NEXT_PROMPT:
WHAT_HAPPENED: Independent gitea-reviewer review of follow-up remediation PR #869 for post-merge medium defects from #865. Read the inventory-revalidation and journal-identity changes line by line; independently reproduced focused suite (142 passed) and role/capability suite (72 passed, 80 subtests). Verdict APPROVE.
WHY: Both #868 medium findings are completely remediated. Finding 1: revalidate_complete_dirty_inventory() recollects full tracked+untracked inventory and requires exact path-set + fingerprint equality immediately before and after bind_session_lock; pre-bind failure never binds; post-bind failure returns fail-closed with durable journal phase. Finding 2: assessed journals persist remote/org/repo/claimant_identity/claimant_profile; validated on execute, mid-flight resume, retry, and already_rebound; incomplete legacy and cross-repo/claimant replay refused. Ordinary dirty-worktree refusal, role boundaries, and #860-class fixture remain intact. Scope is clean (only the two remediation files vs master).
ISSUE: 868
HEAD_SHA:
ba3ea3012cREVIEW_STATUS: APPROVE
MERGE_READY: yes — 0 behind base, no conflicts, mergeable, checks not required; approval head-scoped to
ba3ea3012cBLOCKERS: none
Preflight proof (reviewer)
ef14622ba0Scope / duplicate assessment
ef14622.ef14622: exactly two paths — dirty_same_claimant_session_rebind.py and tests/test_dirty_same_claimant_session_rebind.py.Finding 1 — Complete dirty-inventory revalidation
Verified revalidate_complete_dirty_inventory(): collects complete dirty inventory via git status --porcelain -uall; runs immediately before bind_session_lock and again immediately after; requires exact equality with pinned expected path set; detects added/removed/renamed (path-set) and fingerprint drift; pre-bind failure never calls bind_session_lock (tests assert old PID retained); post-bind failure returns success=false with journal phase post_bind_inventory_failed (fail closed; does not claim success or invent second owner); successful path preserves every tracked/untracked byte and leaves issue/branch/worktree/heads unchanged.
Finding 2 — Complete recovery-journal identity
Verified assessed journals persist remote, org, repo, claimant_identity, claimant_profile. Validated on initial execute, mid-flight resume, retry, and already_rebound. Fail-closed for missing identity fields, incomplete legacy journals, remote/org/repo mismatch, claimant identity/profile mismatch, cross-repository/cross-claimant replay. Mismatched already_rebound journal cannot grant ownership or false success.
Crash / retry / CAS / already_rebound
Journal durable before mutation; identity complete and immutable; generation CAS retained from #865 path; exact completed retry returns already_rebound; malformed/replayed journals refuse authority; ordinary dirty preflights not weakened.
Role and filesystem boundaries
Reviewer/merger refused; reconciler requires authorize_reconciler_execute=True with complete pins and grants no commit/push/publication/review/merge capability (test_reconciler_success_path_tightly_pinned). Registered/canonical worktree and ordinary dirty refusal preserved. No MCP capability-map or server-registration delta in this PR.
Validation (independent)
Additional focused #868 scenarios (inventory drift, journal mismatch/replay, already_rebound, reconciler success, ordinary dirty refusal): 19 passed.
Protected state
Did not invoke rebind against real #860 worktree; did not mutate #850/#853/#855/#860/#861 or lock/session/journal production records; no merge from reviewer role.
VALIDATION: 142 + 72/80 subtests green at ba3ea3012c36; head re-pinned before lease and before submit.
LAST_UPDATED_BY: gitea-reviewer sysadmin/prgs-reviewer
NATIVE_REVIEW_PROOF: workflow=review-merge-pr hash=263d0a6cb8a6 schema=b6c65affc336; reviewer=sysadmin/prgs-reviewer; head=ba3ea3012c36db888d6189fee577c9f3a9805c1b; lease_comment=15418; verdict=APPROVE.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #869
issue: #868
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 44127-a5801a455e17
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/fix-issue-868-dirty-rebind-inventory-journal
phase: claimed
candidate_head:
ba3ea3012ctarget_branch: master
target_branch_sha:
ef14622ba0last_activity: 2026-07-24T06:00:25Z
expires_at: 2026-07-24T06:10:25Z
blocker: none