Persist allocator dependency edges as durable control-plane state #784
Closed
opened 2026-07-21 16:53:47 -05:00 by jcwalker3
·
4 comments
No Branch/Tag Specified
master
archive/role-poisoning-dfb5ebd
archive/capability-role-invariants-bc9366c
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-458-queue-fail-closed-copy
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-188-continuation-selection-wall
feat/issue-232-refresh-wiki-proof-heads
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#784
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.
Parent: #628 (Slice A) · Related: #758, #613, #600, #601
Problem
Umbrella #628 scope item 6 requires dependencies to be represented as durable structured state, with each edge carrying source, target, type, blocking condition, completion condition, current state, and evidence. The repository does not have that store.
Today the allocator derives dependency status entirely in-memory, once per allocation run:
allocator_dependencies.parse_dependency_refs()re-parses theDepends:declaration out of each issue body on every call;_allocator_candidates_from_gitea()ingitea_mcp_server.pyresolves each parsed reference against live issue state and collapses the result into two ephemeralWorkCandidatefields,dependency_unmetanddependency_reason;allocator_service.classify_skip()consumes those fields and then discards them.Nothing is written down.
control_plane_db.py(SCHEMA_VERSION 3) has tables forsessions,work_items,leases,assignments,terminal_locks,events, andincident_links— and no table for dependency relationships.Impact
_issue_state) with only a per-run cache. Two roles allocating seconds apart can reach different conclusions with no durable record of either.Scope (this slice)
Persistence and read access only. This slice records the graph; it does not change what the allocator selects.
1. Schema
Add a
dependency_edgestable tocontrol_plane_db.pyunder an additive, idempotent migration to SCHEMA_VERSION 4. Existing databases must migrate in place without data loss and without requiring a rebuild.Columns must cover the #628 edge contract:
edge_id, scope (remote,org,repo);source_kind/source_number(the waiting work unit);target_kind/target_number(the depended-upon unit);edge_type(validated enum);blocking_conditionandcompletion_condition(text);state(validated enum);evidence(structured JSON: observed live state, source of observation, observing session/role);created_at,updated_at,last_observed_at.Uniqueness is on (scope, source, target, edge_type) so re-observation updates one row instead of appending duplicates.
2. Edge vocabulary module
Add
dependency_graph.pyowning theedge_typeandstateenums and their validation. Both fail closed: an unrecognized type or state raises rather than being stored as free text. Edge types cover the seven #628 relationships; states cover at minimumunmet,met, andunavailable— matching the existing three-way outcome ofresolve_dependency_state(), where unavailable evidence is not treated as satisfied.3. ControlPlaneDB API
upsert_dependency_edge(...)— insert or update one edge by its uniqueness key, refreshing state, evidence, andlast_observed_at.list_dependency_edges(...)— filter by scope, source, target, edge type, and/or state. The target filter is what makes reverse lookup ("what waits on #N") a single query.record_dependency_edge_observation(...)— update state plus evidence for an existing edge, appending aneventsrow so the transition is auditable alongside existing control-plane events.4. Allocator ingestion
Where
_allocator_candidates_from_gitea()already resolves declared references against live issue state, additionally persist each resolved reference as an edge:edge_type= issue-blocked-by-issue,statefrom the existing resolution outcome,evidencerecording the observed live state and the observing session. Persistence is best-effort and must never fail an allocation run: a write error is reported inreasonsand allocation continues on the in-memory values exactly as it does today.5. Read-only exposure
Add
gitea_list_dependency_edgesas a read-only MCP tool gated ongitea.read, returning stored edges for a scope with the same filters as the DB API. No mutation tool is added in this slice.Non-goals
classify_skip()keeps consuming the in-memorydependency_unmetfield; the durable store is written alongside it, not read by it.Depends:declaration syntax orallocator_dependencies.pyparsing behavior.Acceptance criteria
control_plane_db.pyreports SCHEMA_VERSION 4 and createsdependency_edgeson a fresh database.sessions,work_items,leases,assignments,terminal_locks,events, andincident_links.dependency_graph.pyexposes edge-type and state enums covering the seven #628 relationship types and the unmet/met/unavailable states.edge_typeorstateis rejected fail-closed at the API boundary and no row is written.upsert_dependency_edgetwice for the same (scope, source, target, edge_type) yields exactly one row with refreshed state, evidence, andlast_observed_at.list_dependency_edgesfiltered by target returns every edge whose target is that work unit, across differing sources and edge types.list_dependency_edgesscopes strictly by remote/org/repo: an edge in one repository is never returned for another.record_dependency_edge_observationwrites a correspondingeventsrow carrying the prior and new state.reasons.gitea_list_dependency_edgesreturns stored edges for a scope, fails closed withoutgitea.read, and performs no mutation.Implementation investigation
control_plane_db.py—SCHEMA_VERSIONat line 32, DDL block from line 49, existing migration helpers_migrate_lease_lifecycle_columnsand_migrate_session_ownership_columnsestablish the additive-migration pattern to follow.allocator_dependencies.py—resolve_dependency_state()already returnsmet/unmet/unavailabletuples; these map directly onto the stored state without new classification logic.gitea_mcp_server.py—_allocator_candidates_from_gitea()is the single ingestion point where references are resolved against live state; it already holds the resolution result needed for the edge write.allocator_service.py—WorkCandidate.dependency_unmet/dependency_reasonandclassify_skip()remain the selection path and are untouched.eventstable for transitions rather than adding a parallel audit table.Safety and architectural constraints
Issue claim heartbeat
[THREAD STATE LEDGER] Issue #784 durable dependency edges — author implementation complete, awaiting independent reviewer
What is true now:
300e8acd13300e8acd(11 failed, 254 passed), so they predate this branchWhat changed:
What is blocked:
Who/what acts next:
0589ec8069, load the review workflow, and record a formal review verdict through the native reviewer namespaceCanonical Issue State
STATE:
implementation-complete-awaiting-review
WHO_IS_NEXT:
reviewer
NEXT_ACTION:
Perform an independent formal review of PR #785 at head
0589ec8069and record the verdict through the reviewer namespace.NEXT_PROMPT:
WHAT_HAPPENED:
Allocator dry-run re-confirmed umbrella #628 as the highest-priority author candidate (candidate_count 67, fingerprint 0f9f5e98cb75cf4acc5807062f0bc898738137769c259fba8ed505cdc01517fe). Rather than claiming the umbrella, Slice A was cut as child issue #784 covering umbrella scope item 6 only. Issue #784 was locked to branch feat/issue-784-durable-dependency-edges with an isolated worktree, implemented, and published as PR #785.
WHY:
Dependency knowledge existed only as a per-run parse of issue-body Depends declarations, collapsed into two in-memory allocator fields and then discarded. Nothing could answer which work units wait on a given target, six of the seven relationship types umbrella #628 enumerates had nowhere to be recorded, and no observation evidence survived a run. Automatic resumption depends on that reverse edge existing as durable state.
RELATED_PRS:
0589ec8069)BLOCKERS:
none
VALIDATION:
300e8acd: 11 failed, 254 passed across the same five files, proving those failures predate this branchLAST_UPDATED_BY:
jcwalker3 / prgs-author / author session / 2026-07-21
[THREAD STATE LEDGER] Issue #784 reconciliation — post-merge cleanup tail finalized
What is true now:
7ecf7bf2d6.7ecf7bf2d6with a clean working tree, in exact parity with prgs/master and with the MCP runtime startup head.What changed:
0589ec8069was deleted through the sanctioned reconciler path; branch-scoped post-delete readback returned verified_absent true.What is blocked:
Who/what acts next:
Canonical Issue State
STATE:
reconciled-complete
WHO_IS_NEXT:
controller
NEXT_ACTION:
Run the canonical allocator to select the next eligible work item; nothing further remains on issue #784.
NEXT_PROMPT:
WHAT_HAPPENED:
Slice A of umbrella #628 shipped as issue #784 and PR #785, landing on master as merge commit
7ecf7bf2d6from head0589ec8069. The reconciler tail of that cycle could not run at the time because the MCP runtime had gone stale against the new master. After the canonical checkout advanced and all four namespaces restarted, this reconciliation completed the outstanding cleanup: the remote source branch was deleted and verified absent, the post-merge lease assessment confirmed nothing remained to neutralise, and terminal-label hygiene was re-verified repository-wide.WHY:
The cycle's post-merge cleanup was deferred, not skipped. Leaving the source branch present and the audit trail unwritten would misrepresent the lifecycle as incomplete and leave a stale remote ref behind.
RELATED_PRS:
PR #785 — source branch feat/issue-784-durable-dependency-edges, head
0589ec8069, merge commit7ecf7bf2d6. Umbrella #628 stays in open state and retains its remaining slices.BLOCKERS:
None. Blocker classification: no blocker.
VALIDATION:
gitea_cleanup_merged_pr_branch returned success true, performed true, verified_absent true with readback status not_found. gitea_cleanup_post_merge_moot_lease in read-only mode returned pr_state closed with no active reviewer lease. gitea_assess_terminal_label_hygiene over 426 issues returned clean true with residual_count 0. gitea_assess_master_parity reports in_parity true at
7ecf7bf2d6.LAST_UPDATED_BY:
prgs-reconciler (sysadmin) via the gitea-reconciler MCP namespace
[THREAD STATE LEDGER] Issue #784 reconciler tail — post-merge cleanup performed
What is true now:
gitea_assess_master_parityreportsin_parityat7ecf7bf2d666;gitea_assess_terminal_label_hygienereportscleanacross 426 issues withopen_pr_count0 andresidual_count0.What changed:
fix/issue-781-mcp-edit-issue-tool(PR #783 heada002864a) deleted throughgitea_cleanup_merged_pr_branch, confirmed by branch-scoped post-delete readback (verified_absent: true).branches/fix-issue-781-mcp-edit-issue-toolremoved — clean tree, heada002864aalready an ancestor of master — to clear theactive_branch_ownership/worktree_bindingguard that fail-closed the delete.feat/issue-784-durable-dependency-edgesconfirmed already absent on the server; the local remote-tracking ref was stale and has been pruned.What is blocked:
Who/what acts next:
Canonical Issue State
STATE:
reconciled-complete
WHO_IS_NEXT:
controller
NEXT_ACTION:
Open the next supervised cycle on the next eligible issue; no reconciliation remains outstanding for #784.
NEXT_PROMPT:
WHAT_HAPPENED:
The #784 / PR #785 cycle stranded its reconciler tail when the MCP daemons went stale at the merge (startup_head
300e8acdagainst current_head7ecf7bf2). After the namespaces restarted at7ecf7bf2d666, the tail ran to completion: the PR #783 source branch was deleted and verified absent, the PR #785 source branch was confirmed already absent server-side, stale local tracking refs were pruned, and terminal label hygiene was re-verified clean.WHY:
The cleanup could not run in the authoring session because both gates named in the cycle notes were live at the time — the stale-runtime gate (#420) fail-closed every mutation, and the branch-ownership guard protected the PR #783 branch while its worktree binding was still active. Both conditions have since cleared.
RELATED_PRS:
PR #785 — merge commit
7ecf7bf2d666e179c2ecca27b60bb93f7092383f. PR #783 — merge commit300e8acd13cca2482d24dc83c4f24341fe3e127e.BLOCKERS:
none
VALIDATION:
gitea_assess_master_parity→in_parity: trueat7ecf7bf2d666.gitea_cleanup_merged_pr_branch(PR #783) →performed: true,verified_absent: true, readbacknot_found.git ls-remote --heads→ neither cycle source branch present.gitea_assess_terminal_label_hygiene→clean: true, 426 issues checked, 0 residual.gitea_list_workflow_leases→ 0 active.LAST_UPDATED_BY:
prgs-reconciler