Pre-flight order gate counts foreign workspace edits and sticks after fresh whoami, blocking legitimate review submissions #252

Closed
opened 2026-07-06 10:54:44 -05:00 by jcwalker3 · 3 comments
Owner

Problem

A reviewer session with clean eligibility (whoami verified at task start, gitea_check_pr_eligibility eligible for review+merge, gitea_mark_final_review_decision accepted) was blocked from submitting its review of PR #250:

Error executing tool gitea_submit_pr_review: Pre-flight order violation:
Workspace file edits occurred before gitea_whoami verification (fail closed)

Facts:

  1. The reviewer session performed no workspace file edits — all validation ran in a scratch clone under the session scratchpad (per #233). The shared dev worktree edits belong to concurrent author sessions.
  2. The violation is sticky: re-running gitea_whoami (fresh verification) and retrying gitea_submit_pr_review — with zero file edits in between — fails identically. The legacy gitea_review_pr wrapper fails the same way.
  3. gitea_get_runtime_context simultaneously reports review_merge_allowed: true, safe_next_action: "None; ready for operations." — inconsistent with the hard block.

Consequences: a fully validated review of the highest-priority PR (#250, the #249 unblocker) could not be submitted; the review/merge queue stalls behind a gate tracking the wrong session's activity.

Same failure family as #238 (sticky reviewer denial blocking author reads): session-scoped guard state records an event, never re-evaluates, and misattributes multi-session activity in the shared workspace.

Required behavior

  1. The pre-flight order tracker must scope "workspace file edits" to the current session's own actions (its declared scratch worktree / its tool calls), not mtime changes in the shared worktree caused by concurrent sessions.
  2. A successful fresh gitea_whoami must re-evaluate (and clear, when clean) the order violation instead of replaying the sticky record.
  3. Gate verdicts and gitea_get_runtime_context.safe_next_action must agree — no "ready for operations" while submissions hard-fail.
  4. Structured error should name the offending files/timestamps so a blocked session can prove or disprove the attribution.

Acceptance criteria

  1. Test: foreign edits in the shared worktree do not block a reviewer whose own workspace/scratch is clean.
  2. Test: violation clears after fresh whoami with no intervening session edits.
  3. Test: runtime context and pre-flight verdicts are consistent.
  4. Regression: genuine order violations (session edits files, then calls whoami, then submits) still fail closed.

Provenance

Reviewer session, 2026-07-06 ~10:5x, reviewing PR #250 (pinned head df1104d, validation fully green). Related: #238 / PR #242 (sticky denial), #244 (PENDING drafts), #249 / PR #250 (lock gate shared-worktree binding — the same misattribution pattern at a different gate).

## Problem A reviewer session with clean eligibility (whoami verified at task start, `gitea_check_pr_eligibility` eligible for review+merge, `gitea_mark_final_review_decision` accepted) was blocked from submitting its review of PR #250: ``` Error executing tool gitea_submit_pr_review: Pre-flight order violation: Workspace file edits occurred before gitea_whoami verification (fail closed) ``` Facts: 1. The reviewer session performed **no workspace file edits** — all validation ran in a scratch clone under the session scratchpad (per #233). The shared dev worktree edits belong to concurrent author sessions. 2. The violation is **sticky**: re-running `gitea_whoami` (fresh verification) and retrying `gitea_submit_pr_review` — with zero file edits in between — fails identically. The legacy `gitea_review_pr` wrapper fails the same way. 3. `gitea_get_runtime_context` simultaneously reports `review_merge_allowed: true`, `safe_next_action: "None; ready for operations."` — inconsistent with the hard block. Consequences: a fully validated review of the highest-priority PR (#250, the #249 unblocker) could not be submitted; the review/merge queue stalls behind a gate tracking the wrong session's activity. Same failure family as #238 (sticky reviewer denial blocking author reads): session-scoped guard state records an event, never re-evaluates, and misattributes multi-session activity in the shared workspace. ## Required behavior 1. The pre-flight order tracker must scope "workspace file edits" to the **current session's own actions** (its declared scratch worktree / its tool calls), not mtime changes in the shared worktree caused by concurrent sessions. 2. A successful fresh `gitea_whoami` must re-evaluate (and clear, when clean) the order violation instead of replaying the sticky record. 3. Gate verdicts and `gitea_get_runtime_context.safe_next_action` must agree — no "ready for operations" while submissions hard-fail. 4. Structured error should name the offending files/timestamps so a blocked session can prove or disprove the attribution. ## Acceptance criteria 1. Test: foreign edits in the shared worktree do not block a reviewer whose own workspace/scratch is clean. 2. Test: violation clears after fresh whoami with no intervening session edits. 3. Test: runtime context and pre-flight verdicts are consistent. 4. Regression: genuine order violations (session edits files, then calls whoami, then submits) still fail closed. ## Provenance Reviewer session, 2026-07-06 ~10:5x, reviewing PR #250 (pinned head `df1104d`, validation fully green). Related: #238 / PR #242 (sticky denial), #244 (PENDING drafts), #249 / PR #250 (lock gate shared-worktree binding — the same misattribution pattern at a different gate).
jcwalker3 added the status:in-progress label 2026-07-06 11:32:45 -05:00
Author
Owner

Started by jcwalker3 (prgs-author).

  • Claimed: status:in-progress
  • Issue lock: fix/issue-252-preflight-order-foreign-edits
  • Scope: session-scoped pre-flight order tracking (#252) — foreign shared-worktree edits must not stick; fresh gitea_whoami must re-evaluate/clear; runtime context must match submission gates.

Next: implement gate fixes + acceptance tests per issue body.

**Started** by `jcwalker3` (prgs-author). - Claimed: `status:in-progress` - Issue lock: `fix/issue-252-preflight-order-foreign-edits` - Scope: session-scoped pre-flight order tracking (#252) — foreign shared-worktree edits must not stick; fresh `gitea_whoami` must re-evaluate/clear; runtime context must match submission gates. Next: implement gate fixes + acceptance tests per issue body.
Author
Owner

Starting work on this issue.

Branch: feat/issue-252-preflight-foreign-edits

Plan:

  • Scope pre-flight workspace checks to session-owned deltas (baseline at process start / whoami / capability) instead of any dirty state in the shared worktree
  • Re-evaluate and clear violation flags on fresh gitea_whoami instead of sticky replay
  • Align gitea_get_runtime_context.safe_next_action with pre-flight verdicts
  • Add structured offending-file detail in pre-flight errors

Refs #252

Starting work on this issue. **Branch:** `feat/issue-252-preflight-foreign-edits` **Plan:** - Scope pre-flight workspace checks to session-owned deltas (baseline at process start / whoami / capability) instead of any dirty state in the shared worktree - Re-evaluate and clear violation flags on fresh `gitea_whoami` instead of sticky replay - Align `gitea_get_runtime_context.safe_next_action` with pre-flight verdicts - Add structured offending-file detail in pre-flight errors Refs #252
Author
Owner

Implementation complete on branch feat/issue-252-preflight-foreign-edits.

PR #254 — mergeable, targets master.

Fix summary

  • Pre-flight compares porcelain deltas (process start → whoami → capability), not absolute shared-worktree dirt
  • Fresh gitea_whoami re-evaluates and clears sticky violations; capability step resets
  • gitea_get_runtime_context exposes preflight_ready / preflight_block_reasons and aligns safe_next_action with hard blocks
  • Errors name offending files

Tests added

  • test_foreign_workspace_edits_do_not_block_clean_reviewer
  • test_fresh_whoami_clears_sticky_violation
  • test_runtime_context_matches_preflight_block
  • Regression coverage retained for genuine violations
Implementation complete on branch `feat/issue-252-preflight-foreign-edits`. **PR #254** — mergeable, targets `master`. ### Fix summary - Pre-flight compares porcelain **deltas** (process start → whoami → capability), not absolute shared-worktree dirt - Fresh `gitea_whoami` re-evaluates and clears sticky violations; capability step resets - `gitea_get_runtime_context` exposes `preflight_ready` / `preflight_block_reasons` and aligns `safe_next_action` with hard blocks - Errors name offending files ### Tests added - `test_foreign_workspace_edits_do_not_block_clean_reviewer` - `test_fresh_whoami_clears_sticky_violation` - `test_runtime_context_matches_preflight_block` - Regression coverage retained for genuine violations
sysadmin removed the status:in-progress label 2026-07-06 12:28:16 -05:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#252