feat: make master-parity live-remote aware so a stale daemon fails closed (Closes #610) #788
Open
jcwalker3
wants to merge 2 commits from
feat/issue-610-live-remote-parity into master
pull from: feat/issue-610-live-remote-parity
merge into: :master
:master
:feat/issue-610-live-remote-parity
:fix/issue-787-kill-segment-separators
:chore/issue-681-preserve-review-session-wip
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#788
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 #610
Head
324b4b3e9312840b44d1587d8b9142a76ca5ef74Publication recovery only: existing commits on
feat/issue-610-live-remote-paritywere already present onprgsand matched local HEAD. No amend, squash, rebase, or force was performed. This PR opens the missing review surface.Problem
gitea_assess_master_paritycompared only the daemon startup commit against the local on-disk HEAD. When the checkout was not updated, parity reported green even though live remote master had advanced, so a stale daemon could claim a mutation-safe result while running outdated capability gates (observed during PR #592 recovery, where the resolver correctly required restart but parity saidin_parity=true).Implementation summary
master_parity_gate.assess_master_parity()accepts optionallive_remote_headand reports three commits distinctly (daemon_start_head,local_head,live_remote_head) pluslive_known/live_stale/mutation_safe.parity_block_reasons()blocks mutations on live-staleness; read-only diagnostics stay unblocked when remote is unknown.parity_resolver_disagreement()provides a typed fail-closed blocker naming the capability resolver as authoritative when it requires restart while parity looks locally green.read_remote_master_head()best-effort live remote tip with 60s TTL; tests can pin viaGITEA_TEST_LIVE_REMOTE_HEAD.gitea_assess_master_parity/ runtime context.Files
master_parity_gate.pygitea_mcp_server.pytests/test_master_parity_gate.pyTest evidence (from authoring commit message; not re-run in this publisher)
test_configAuthIntegration /test_credentialsGetCredentials were baseline-proven keychain/env failures identical on the unmodified base (not branch-caused).Known integration note for reviewer
Branch head is from 2026-07-09 and is behind current master. Merge may need author
update_branch_by_mergeafter review; this publisher does not rewrite history or resolve conflicts.Publisher execution identity
grok-pr-publisher-prod-v1grok-pr-publisher-prod-v1-20260721T232804Z-pid18507-7b750edafeat/issue-610-live-remote-parity@324b4b3e9312840b44d1587d8b9142a76ca5ef74CTH: Author Handoff
Status: published_awaiting_independent_review
Next owner: reviewer (prgs-reviewer / sysadmin)
Current blocker: none for publication; branch is behind master and may need author update_branch_by_merge after review if conflicts appear
Decision: PR #788 created for completed committed work on issue #610; no code rewritten
Proof: gitea_create_pr → #788; head_sha
324b4b3e93matches local and prgs remote branch; base master; Closes #610; exactly one open PRNext action: independent formal review at exact head
324b4b3e93Ready-to-paste prompt: see NEXT_PROMPT below
Canonical Issue State
STATE: pr_open_awaiting_review
WHO_IS_NEXT: reviewer
NEXT_ACTION: formal independent review of PR #788 at head
324b4b3e93NEXT_PROMPT:
WHAT_HAPPENED: Publication recovery run adopted existing remote branch feat/issue-610-live-remote-parity @
324b4b3e93(already published; no push), locked issue #610 via own-branch adoption, and created PR #788 targeting master with Closes #610. Applied status:pr-open. No implementation, amend, rebase, or force-push.WHY: Completed committed work for open issue #610 was ahead of prgs/master with no PR; publisher recovers missing review surface only.
RELATED_PRS: #788 (this PR); #592 (historical incident context only, already merged)
BLOCKERS: none for review handoff; branch is 192 commits behind master so merge may later need author update_branch_by_merge
VALIDATION: Authoring-commit evidence: 13 new tests; full suite 2423 passed; 8 baseline keychain/env failures identical on unmodified base (not branch-caused). Publisher did not re-run the suite.
LAST_UPDATED_BY: jcwalker3 (prgs-author)
LLM_LOCK_ID: grok-pr-publisher-prod-v1
LLM_EXECUTION_ID: grok-pr-publisher-prod-v1-20260721T232804Z-pid18507-7b750eda
REPOSITORY: Scaled-Tech-Consulting/Gitea-Tools
ISSUE: #610
PR: #788
HEAD_SHA:
324b4b3e93BASE_BRANCH: master
BASE_OR_MERGE_SHA:
35e94e107cACTING_ROLE: author
ACTING_IDENTITY: jcwalker3
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #788
issue: #610
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 21098-3d496ddf679b
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-788
phase: claimed
candidate_head:
324b4b3e93target_branch: master
target_branch_sha:
35e94e107clast_activity: 2026-07-22T00:30:18Z
expires_at: 2026-07-22T00:40:18Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #788
issue: #610
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 21098-f5dd578979ec
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-788
phase: claimed
candidate_head:
324b4b3e93target_branch: master
target_branch_sha:
35e94e107clast_activity: 2026-07-22T00:42:18Z
expires_at: 2026-07-22T00:52:18Z
blocker: none
Verdict: REQUEST_CHANGES — PR #788 @
324b4b3e9312840b44d1587d8b9142a76ca5ef74Reviewed independently by
sysadmin/prgs-reviewer(authorjcwalker3; no self-review). Lease21098-f5dd578979ec, worktreebranches/review-pr-788, targetmaster@35e94e1.The #610 design (distinguish daemon-start / local / live-remote heads; fail closed on live-stale; resolver authoritative) is sound and well-scoped, and the 37 new
test_master_parity_gate.pycases pass. One blocking defect:F1 (blocking) — live-remote parity read is not hermetic; 107 pre-existing tests broken
read_remote_master_head()performs a realgit ls-remotewheneverGITEA_TEST_LIVE_REMOTE_HEADis unset, and nothing pins that variable suite-wide (notests/conftest.pyentry; grep shows the only references are the new module/tests). Whenever the checkout HEAD differs from live remote master — i.e. every canonicalbranches/feature worktree, the exact environment this workflow requires all test runs to use —gitea_get_runtime_context/gitea_assess_master_parityreportlive_staleand flipsafe_next_action, breaking legacy suites that assert runtime-context content.Proof (venv python,
pytest -q):324b4b3full suite: 115 failed, 2316 passed.5201379(detached baseline worktree) full suite, identical command: 8 failed, 2404 passed — the 8 are the declared keychain/env baseline set (test_configAuthIntegration /test_credentialsGetCredentials).test_mcp_server.py test_runtime_clarity.py test_resolve_task_capability.py): branch 54 failed / 190 passed vs baseline 244 passed / 0 failed.test_get_runtime_context_reviewer: got"Daemon is stale relative to LIVE remote master (started 324b4b3e9312, live master 35e94e107c32); …"where the test asserts"None; ready for operations.".GITEA_TEST_LIVE_REMOTE_HEADoutside the tests does not rescue them: the failing tests usepatch.dict(os.environ, …, clear=True), which wipes the pin, so the code falls through to a real networkls-remoteinside unit tests.Required remediation: make the live-remote read hermetic for the test suite — e.g. a
conftest.pypin ofGITEA_TEST_LIVE_REMOTE_HEAD, or disabling the live probe under pytest unless explicitly opted in — and update the affected legacy expectations for the new runtime-context fields/safe_next_actionso the full suite is green (minus the 8 baseline failures) when run from abranches/worktree whose HEAD differs from live master.F2 (non-blocking) — unit tests gain a network dependency
With F1 unfixed, every cold-cache test run performs
git ls-remote(5s timeout) against the real remote; offline runs silently change behavior (live_known=False→mutation_safe=Falseyet unblocked). The hermetic fix for F1 should remove this too.Note (non-blocking) — semantics of unknown live state
mutation_safe=Falsewhen the live head is unknown, butparity_block_reasons()does not block on unknown — documented and defensible (resolver stays authoritative); calling it out so the choice is deliberate.Integration note
The branch is ~12 days behind master (
mergeable: truetoday). After F1/F2 remediation, expect an authorupdate_branch_by_mergesync before merge; the reviewer handoff in the PR body already anticipates this.Validation ledger
master_parity_gate.py(+188/−26 net),gitea_mcp_server.py(+73),tests/test_master_parity_gate.py(+198). Scoped, no secrets, no gate weakening found.tests/test_master_parity_gate.py: 37 passed.gitea_load_review_workflowhash263d0a6cb8a6, boundary clean; head pinned324b4b3; verdict recorded viagitea_mark_final_review_decision.Canonical PR State
STATE: changes-requested
WHO_IS_NEXT: author
NEXT_ACTION: Remediate F1 (hermetic live-remote read / conftest pin + updated legacy expectations) and F2 on the PR branch, re-run the full suite from a branches/ worktree, then request re-review.
NEXT_PROMPT:
WHAT_HAPPENED: Independent review of PR #788 @
324b4b3found the #610 live-remote parity design sound but non-hermetic: 107 pre-existing tests break whenever the checkout HEAD differs from live remote master (115 failed vs 8 baseline-identical failures at merge-base5201379).WHY: The live-remote
git ls-remoteprobe is unpinned in the test suite; canonical branches/ worktree test runs always differ from live master, so runtime-context/parity outputs flip to live_stale and break legacy assertions.ISSUE: #610
HEAD_SHA:
324b4b3e93REVIEW_STATUS: changes-requested
MERGE_READY: no
BLOCKERS: F1 (blocking) non-hermetic live-remote parity read breaking 107 tests; F2 (non-blocking) unit-test network dependency; branch ~12 days behind master (author update_branch_by_merge after fixes).
VALIDATION: Focused test_master_parity_gate.py 37 passed; focused 3-suite compare branch 54 failed/190 passed vs baseline 244 passed; full suite branch 115 failed/2316 passed vs pristine merge-base 8 failed/2404 passed (8 = declared keychain/env baseline set); diff inspected, scoped, no secrets.
LAST_UPDATED_BY: sysadmin / prgs-reviewer (independent reviewer; lease 21098-f5dd578979ec)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.