Files
Gitea-Tools/skills/llm-project-workflow/templates/recover-bad-state.md
T
sysadmin ec9ddb09a7 docs: closed-not-merged PR reconciliation rules (#51)
Documents and enforces rules for closed-not-merged PR reconciliation, direct-master-push prevention, and issue label cleanup.

Rules added:
- Explicit definitions for Merged, Landed, Closed-not-merged, and Reconciled.
- A PR is done only when Gitea reports it merged or reconciliation proves content is present on master.
- Direct push to master is forbidden except as a documented recovery exception.
- PRs closed but not merged trigger the reconciliation process.
- Branch and worktree cleanup is forbidden until merge or reconciliation is confirmed.
- Final reports require PR metadata and Git content verification.

Closes #51.
2026-07-02 04:16:07 -04:00

1.4 KiB

Template: recover from bad state

Copy, fill the <...> fields, paste as the task prompt. Recovery is read-then- act: gather facts first, never discard unmerged work.

Task: recover repo state for <situation>. Do not lose unmerged work.

Rules (llm-project-workflow):
- Fail closed: if state is unclear or a step would delete unmerged work, STOP.
- Never push master. Never discard commits not safely pushed to <remote>.

Diagnose first:
1. git fetch <remote> --prune
2. git status --short; git worktree list
3. git rev-list --left-right --count <remote>/master...master   # ahead/behind
4. For any PR involved: confirm state (open/closed/merged) AND whether
   <remote>/master actually contains its commits ("closed" != "merged").

Act per case:
- Dirty worktree from another issue: leave it; start yours in a new worktree.
- Local master ahead of remote: confirm the extra commits live on a branch
  pushed to <remote>, THEN git reset --hard <remote>/master. Verify with
  `git branch --contains <sha>` first.
- PR closed but not merged (`merged=false`): stop normal flow and use reconcile-closed-not-merged-pr.md instead.
- Branch deleted before merge: recover commits from a local branch/reflog (or
  git fsck --lost-found), re-push, reopen the PR.
- Unauthorized untracked file: do not commit it; leave pre-existing artifacts.

Handoff: what was wrong, evidence, action taken, current state, what remains.