feat: enforce self-propagating canonical handoffs through controller closure (Closes #626) #779
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#779
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.
Closes #626
Summary
#494–#507 defined the ledger, the canonical state comments, and the Canonical
Thread Handoff shape. None of them enforce the chain: that every actor
consumes exactly one canonical handoff, performs exactly one authorized role,
records the result durably in Gitea, and emits the next complete handoff until
the controller records final closure. This PR owns that systemic enforcement gap.
New module
self_propagating_handoff.py(pure assessment — no network calls,no mutation), wired into
final_report_validator.pyas ruleshared.self_propagating_handoff, plus the canonical schema documentskills/llm-project-workflow/schemas/self-propagating-handoff.md.What it enforces
REPOSITORY,ISSUE,PR,WORKFLOW_STATE,HEAD_SHA,BASE_BRANCH,BASE_OR_MERGE_SHA,ACTING_ROLE,ACTING_IDENTITY,COMPLETED_ACTIONS,VALIDATION_EVIDENCE,MUTATION_LEDGER,BLOCKERS,NEXT_ACTOR,NEXT_ACTION,PROHIBITED_ACTIONS,NEXT_PROMPT,WORKFLOW_FAILURE_ISSUES,LAST_UPDATED). Only a named subset may carrynone, andPR/HEAD_SHAonly in
needs-authororblocked.assess_handoff_live_statefails closed on allfourteen detection kinds:
changed_pr_head,stale_approval,issue_closed,issue_reopened,pr_merged,pr_closed_unmerged,stale_lease,foreign_lease,missing_worktree,dirty_worktree,namespace_mismatch,stale_runtime,changed_base,conflicting_canonical_comments. A changed head invalidates an inheritedreview or merge handoff and recovers the chain to
needs-review.assess_role_continuationpermits only theactions the declared
WORKFLOW_STATEauthorizes for the receiving role.assess_durable_state_updaterejects achat-only report; the canonical state must reach the Gitea thread.
NEXT_ACTIONand a ready-to-runNEXT_PROMPTthat names the repository andissue and does not lean on outside chat history.
assess_merge_completion_transitionmoves a merged PR to
merged-awaiting-controller, not to accepted work.assess_controller_decisionhonorsacceptonly with all four closureproofs recorded, and routes
request_tests/request_proof/request_corrections/reopen/return_to_actor.assess_workflow_failure_escalationrequires
classification,linked_issue,temporary_impact,next_valid_actor, andrecovery_promptper distinct defect, reuses anexisting durable issue for a known signature instead of filing a duplicate,
and keeps tooling defects out of the active feature issue.
actionable reasons and a
safe_next_action.review_pr,merge_pr,reconcile_already_landed,author_issue,work_issue,issue_filing,inventory,issue_selection, andcontroller_close, sothe handoff is not an optional prose section.
Terminal
completemust carry noNEXT_ACTIONand noNEXT_PROMPT: afinished workflow terminates instead of manufacturing more work.
Applicability gating
Enforcement is applicability-gated exactly like the #495 canonical-state gate:
the full schema binds once a report carries the
sph:v1marker, theCanonical Handoffheading, or aWORKFLOW_STATE:line. Reports writtenbefore the protocol existed are untouched.
Non-goals honored
No Issue #601 or PR #625 behavior is hard-coded (they appear in the issue as an
illustration of the gap). No project-specific acceptance criteria leak into
generic workflow prompts. No capability, role, or controller gate is bypassed.
The foundational schema/docs work closed under #494–#507 is not reopened.
Files changed
self_propagating_handoff.pytests/test_self_propagating_handoff.pyskills/llm-project-workflow/schemas/self-propagating-handoff.mdfinal_report_validator.pyshared.self_propagating_handoffregistered across nine task kindsskills/llm-project-workflow/SKILL.mdskills/llm-project-workflow/schemas/{create-issue,pr-queue-cleanup,reconcile-landed,review-merge,work-issue}-final-report.mdValidation
pytest tests/test_self_propagating_handoff.py -q→ 53 passed.Coverage includes author→reviewer, reviewer→merger, merger→controller,
controller→author, stale-head rejection, blocked infrastructure path, final
successful closure, incomplete-handoff rejection, and duplicate
workflow-failure issue handling.
passed (672s).
exact base SHA
1d11cbab0fdc529859bdace2bd01e20da22ff449(worktree
branches/baseline-master-issue-626, 12 failed / 28 passed). Theyare pre-existing on master and are not caused by this branch:
tests/test_commit_payloads.py(6),tests/test_issue_702_review_findings_f1_f6.py(2),tests/test_mcp_server.py::TestPreflightVerification::test_declared_clean_task_worktree_ignores_control_checkout_violation,tests/test_post_merge_moot_lease.py::TestAcquireToolRefusesMergedPR::test_acquire_tool_fails_closed_on_merged_pr_without_posting,tests/test_reconciler_supersession_close.py::TestReconcilerSupersessionMcpTool::test_tool_posts_comment_and_closes_superseded_pr_issue,tests/test_webui_ci_gate.py::TestCiRunnerScript::test_test_webui_smoke.git diff --check 1d11cbab b2977a35→ clean.Publication provenance
The implementation was committed locally as
b2977a35by an earlier authorsession that exited before publishing. This fire recovered ownership through
canonical dead-session recovery (
recovery_mode: unpublished_claim,recovered: true, prior pid 2100 dead, ancestry proven against recorded base1d11cbab) and published through native MCPgitea_commit_filesasddc9b97d401a3102f4088abc27cbe1be1795f3a0. The published tree4df467f5746be4f6c86a9d229250b7eefd5354d0is byte-identical to the localcommit's tree, and the published parent is
1d11cbab.Reviewer notes
Author profile
prgs-author/jcwalker3. This PR needs an independentreviewer; the author neither reviews nor merges it.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #779
issue: #626
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34450-27cb9909e8c3
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418
phase: claimed
candidate_head:
ddc9b97d40target_branch: master
target_branch_sha:
1d11cbab0flast_activity: 2026-07-21T17:34:36Z
expires_at: 2026-07-21T17:44:36Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #779
issue: #626
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34450-27cb9909e8c3
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418
phase: validating
candidate_head:
ddc9b97d40target_branch: master
target_branch_sha:
1d11cbab0flast_activity: 2026-07-21T17:35:52Z
expires_at: 2026-07-21T17:45:52Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #779
issue: #626
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34450-27cb9909e8c3
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418
phase: reviewing
candidate_head:
ddc9b97d40target_branch: master
target_branch_sha:
1d11cbab0flast_activity: 2026-07-21T17:38:09Z
expires_at: 2026-07-21T17:48:09Z
blocker: none
Independent review: APPROVE
Reviewer: sysadmin / prgs-reviewer (not author jcwalker3)
Reviewed head:
ddc9b97d40Base:
1d11cbab0fWorktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418 (clean)
Lease session: 34450-27cb9909e8c3
Findings
No correctness, security, regression, or workflow-compliance defects that block merge.
Issue #626 acceptance areas are implemented in pure assessment module
self_propagating_handoff.py(907 lines), wired asshared.self_propagating_handoffacross nine final-report task kinds, with schemaskills/llm-project-workflow/schemas/self-propagating-handoff.mdand 53 focused tests covering author→reviewer, reviewer→merger, merger→controller, controller→author, stale-head, blocked path, final closure, incomplete rejection, and failure-escalation dedupe.Applicability gating matches #495. No hard-coded #601/#625. Published tree
4df467fmatches local b2977a35.Validation
Baseline failures (independently verified)
11 failures identical on PR head and clean master
1d11cbab:webui smoke passed on both; not currently a baseline failure.
Workflow-load helper result
workflow_source: skills/llm-project-workflow/workflows/review-merge-pr.md
workflow_hash: 263d0a6cb8a6
final_report_schema_hash: a7634e7b8689
boundary_status: clean
Canonical PR State
STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Verify approval still applies to live head
ddc9b97d40, then merge PR #779 through sanctioned merger workflow onlyNEXT_PROMPT:
WHAT_HAPPENED: Independent reviewer sysadmin approved PR #779 at exact head
ddc9b97after full suite and baseline verificationWHY: Implementation matches issue #626 acceptance criteria; focused and full validation pass aside from 11 pre-existing master failures; no blocking review findings
ISSUE: #626
BASE: master
HEAD: feat/issue-626-self-propagating-handoffs
HEAD_SHA:
ddc9b97d40REVIEW_STATUS: approved / approval_at_current_head by sysadmin via native MCP gitea_submit_pr_review
MERGE_READY: true if live head remains
ddc9b97d40and merger re-verifies approval_at_current_headBLOCKERS: none
VALIDATION: focused 53 passed; full suite 4010 passed / 11 failed identical on master 1d11cbab; git diff --check clean
NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=mcp_server; namespace=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; tool=gitea_submit_pr_review; head=ddc9b97d401a3102f4088abc27cbe1be1795f3a0; lease_session=34450-27cb9909e8c3
LAST_UPDATED_BY: sysadmin / prgs-reviewer / 2026-07-21
Canonical Handoff
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #779
issue: #626
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 52026-ab9774c6eb54
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-779-ddc9b97
phase: claimed
candidate_head:
ddc9b97d40target_branch: master
target_branch_sha:
1d11cbab0flast_activity: 2026-07-21T17:53:38Z
expires_at: 2026-07-21T18:03:38Z
blocker: none
Stale #332 review-decision lock cleanup (#594)
Status: APPLIED
sysadminprgs-merger2026-07-21T17:53:52.071404+00:00approveon PR feat: enforce self-propagating canonical handoffs through controller closure (Closes #626) (#779)closed(merged=True)df3167488c5451f802549b40463ad59cbaad61091prgs-reviewerManual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.