Skip to content

Commit 7a9a424

Browse files
committed
PR_26175_OWNER_048 define PR open closed governance
1 parent a4bd646 commit 7a9a424

11 files changed

Lines changed: 619 additions & 159 deletions

docs_build/dev/PROJECT_INSTRUCTIONS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ You are working in a docs-first repo workflow.
55
Workflow:
66
PLAN_PR → BUILD_PR → APPLY_PR
77

8+
PR lifecycle gate:
9+
PR Open → Building → Validation → Approved → Merged → Main Verified → Closed
10+
11+
The PLAN_PR → BUILD_PR → APPLY_PR workflow remains preserved. PR Open is the first lifecycle status for active work, and Closed is the final repository-state gate.
12+
813
# WORKFLOW & EXECUTION
914

1015
## PR NAMING STANDARD
@@ -44,6 +49,60 @@ Rules:
4449
- Existing PC/LAPTOP, desktop/laptop, workspace, environment, or machine-parity examples are historical only
4550
- Future PR reports, recovery reports, validation reports, and manual validation notes must include TEAM ownership
4651

52+
## PR LIFECYCLE STATE GATE
53+
54+
Required state order:
55+
56+
1. PR Open
57+
2. Building
58+
3. Validation
59+
4. Approved
60+
5. Merged
61+
6. Main Verified
62+
7. Closed
63+
64+
Definitions:
65+
- PR Open is the first active lifecycle state.
66+
- PR Open means the PR or branch has been created and named, and the work has a tracked PR identity before implementation begins.
67+
- No BUILD_PR may proceed without a PR name and active branch/PR identity unless it is explicitly marked `PLAN_ONLY`.
68+
- Building means scoped implementation, audit, report, validation, governance, or cleanup work is in progress for that PR identity.
69+
- Validation means requested checks, required report creation, manual validation notes, and ZIP packaging are being completed.
70+
- Approved means the owner or required reviewer has approved the PR outcome or intentionally approved closure without merge.
71+
- Merged means the PR has merged or has been intentionally closed without merge with the reason recorded.
72+
- Main Verified means Codex is back on `main`, `main` includes the merge commit or recorded final commit, the worktree is clean, local/origin sync is `0/0`, and no untracked files remain.
73+
- Closed means every Closed gate below is PASS.
74+
75+
Closed is valid only when all are PASS:
76+
- PR merged or intentionally closed without merge with reason recorded.
77+
- Changes pushed.
78+
- Current branch is `main`.
79+
- `main` includes the merge commit or recorded final commit.
80+
- Worktree clean.
81+
- Local/origin sync is `0/0`.
82+
- No untracked files.
83+
- Branch disposition recorded as `deleted`, `retained for follow-up`, or `archived`.
84+
- Required reports exist.
85+
- Required repo-structured ZIP under `tmp/` exists.
86+
87+
Hard stop:
88+
- A team must not begin another PR if its previous PR is not Closed.
89+
- Exception is allowed only for explicitly documented stacked PR chains.
90+
91+
Required final closeout output:
92+
93+
```text
94+
FINAL REPOSITORY STATE:
95+
- Branch
96+
- Worktree
97+
- Local/origin sync
98+
- PR number/name
99+
- PR status
100+
- Merge/final commit
101+
- Branch disposition
102+
- ZIP path
103+
- Closeout PASS/FAIL
104+
```
105+
47106
## CHATGPT EXECUTION ROLE
48107

49108
ChatGPT no longer creates PLAN_PR, BUILD_PR, APPLY_PR docs, ZIP bundles, or implementation code.
@@ -1662,6 +1721,8 @@ Before packaging any PR, Codex must:
16621721

16631722
Codex must not package partially completed PRs.
16641723

1724+
PR completion is not the same as Closed. Closed requires the final repository-state gate from `PR LIFECYCLE STATE GATE`.
1725+
16651726
## ERROR HANDLING CONTRACT
16661727

16671728
- No silent fallback.

docs_build/dev/ProjectInstructions/addendums/branch_context_governance.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ At the start of work, report or validate:
1818
- worktree status
1919
- active team
2020
- active assignment
21+
- active PR number/name or explicit `PLAN_ONLY`
22+
- previous PR Closed status unless this is an explicitly documented stacked PR chain
2123

2224
## Stop Conditions
2325

@@ -28,6 +30,8 @@ Stop and report before changing files when:
2830
- worktree has unrelated changes
2931
- active assignment is missing or unclear
3032
- active team does not match the branch or OWNER instruction
33+
- BUILD_PR work has no PR name and active branch/PR identity, unless explicitly marked `PLAN_ONLY`
34+
- the team's previous PR is not Closed and no stacked PR chain is documented
3135
- the requested work would modify files outside the approved scope
3236

3337
## Continuation Rule
@@ -45,6 +49,16 @@ Do not automatically return to `main` after:
4549

4650
Return to `main` only after the PR is merged, the branch is retired, or OWNER explicitly says to return to `main`.
4751

52+
Returning to `main` is required before Closed can be recorded.
53+
54+
Closed branch context requires:
55+
- current branch is `main`
56+
- `main` includes the merge commit or recorded final commit
57+
- worktree clean
58+
- local/origin sync is `0/0`
59+
- no untracked files
60+
- branch disposition recorded as `deleted`, `retained for follow-up`, or `archived`
61+
4862
## GitHub Authority
4963

5064
GitHub is authoritative for open PR state, merged PR state, review state, and remote branch state.

docs_build/dev/ProjectInstructions/addendums/branch_lock_governance.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
1313
- An assigned work item keeps its owner of record until complete or OWNER reassignment.
1414
- Work must not move to another team, branch, or PR without OWNER approval.
1515
- A team with no active assignment, active branch, or active PR is inactive.
16+
- A team with a previous PR that is not Closed must not begin another PR unless OWNER documented an explicit stacked PR chain.
17+
- PR Open begins only after the branch and PR identity are named.
18+
- Closed ends only after the final main-return, clean-worktree, local/origin `0/0`, no-untracked-files, required-report, required-ZIP, and branch-disposition gates pass.
1619
- Project Instructions must not assume a permanent team roster.
1720

1821
## Branch Rules
@@ -22,6 +25,7 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
2225
- Keep work on the active branch until the PR is merged, the branch is retired, or OWNER says to return to `main`.
2326
- Do not commit directly to `main` unless OWNER explicitly approves.
2427
- Do not merge stale historical branches directly unless they are current, clean, still needed, and OWNER-approved.
28+
- Record branch disposition before Closed as one of: `deleted`, `retained for follow-up`, or `archived`.
2529

2630
## OWNER Override
2731

docs_build/dev/ProjectInstructions/addendums/multi_team.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ Required gate:
122122
- next review queue
123123
- final branch/worktree/local-origin sync
124124
- repo-structured ZIP path under `tmp/`
125+
- final repository state block
125126

126127
OWNER_049 lesson:
127128
- PRs #129, #132, and #134 were merge-approved and still required merge execution.
@@ -150,6 +151,8 @@ Required steps:
150151
5. Record final main commit.
151152
6. Report final repository state.
152153
7. Produce a repo-structured ZIP under `tmp/` that includes the EOD report and all changed or preserved repo files from the closeout.
154+
8. Record branch disposition as `deleted`, `retained for follow-up`, or `archived`.
155+
9. Mark the PR Closed only when every Closed gate passes.
153156

154157
Required final state:
155158

@@ -167,11 +170,27 @@ Rules:
167170
- A workstream is not considered closed until the repository is returned to main.
168171
- A PI is not considered complete until main is current and synchronized.
169172
- Do not leave Codex on a feature, team, workstream, recovery, governance, or owner branch after successful merge.
173+
- A PR is not Closed until the PR merged or an intentional no-merge close reason is recorded, changes are pushed, the repository is on `main`, `main` includes the merge or final commit, the worktree is clean, local/origin sync is `0/0`, no untracked files exist, branch disposition is recorded, required reports exist, and the required repo-structured ZIP exists under `tmp/`.
170174
- A completed EOD closeout must produce the required ZIP even when the closeout changed no repo files; in that case, the ZIP must contain the EOD report proving the no-change result.
171175
- The EOD ZIP does not replace the EOD report or other required reports under `docs_build/dev/reports/`.
172176
- If merge succeeds but repository is not returned to main:
173177
closeout status = FAIL.
174178

179+
Required final closeout output:
180+
181+
```text
182+
FINAL REPOSITORY STATE:
183+
- Branch
184+
- Worktree
185+
- Local/origin sync
186+
- PR number/name
187+
- PR status
188+
- Merge/final commit
189+
- Branch disposition
190+
- ZIP path
191+
- Closeout PASS/FAIL
192+
```
193+
175194
## Workstream Hygiene Governance
176195

177196
At workstream closeout, Codex must review repository collaboration state before reporting the workstream closed.

docs_build/dev/ProjectInstructions/addendums/pr_workflow.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,53 @@ Define the standard pull request workflow for Game Foundry Studio.
1212
1. Start from main.
1313
2. Pull latest origin/main.
1414
3. Verify clean worktree.
15-
4. Create a PR branch.
16-
5. Make scoped changes only.
17-
6. Validate the change.
18-
7. Commit with a clear OWNER/team message.
19-
8. Push the branch.
20-
9. Open a draft PR.
21-
10. Review the PR.
22-
11. OWNER approves merge.
23-
12. Merge to main.
24-
13. Pull latest main before starting the next PR.
15+
4. Create a PR branch and PR identity.
16+
5. Mark lifecycle state as PR Open.
17+
6. Make scoped changes only.
18+
7. Validate the change.
19+
8. Commit with a clear OWNER/team message.
20+
9. Push the branch.
21+
10. Open or update the draft PR.
22+
11. Review the PR.
23+
12. OWNER approves merge or intentional close without merge.
24+
13. Merge to main or record the approved no-merge close reason.
25+
14. Pull latest main before starting the next PR.
26+
15. Verify Main Verified and Closed gates.
27+
28+
## PR Lifecycle States
29+
30+
Required state order:
31+
32+
1. PR Open
33+
2. Building
34+
3. Validation
35+
4. Approved
36+
5. Merged
37+
6. Main Verified
38+
7. Closed
39+
40+
Definitions:
41+
- PR Open is the first active lifecycle state.
42+
- PR Open means the branch and PR identity are created and named before implementation begins.
43+
- No BUILD_PR may proceed without a PR name and active branch/PR identity unless explicitly marked `PLAN_ONLY`.
44+
- Building means scoped work is in progress.
45+
- Validation means requested checks, required reports, manual validation notes, and ZIP packaging are underway.
46+
- Approved means OWNER or required reviewer approval exists for merge or intentional close without merge.
47+
- Merged means the PR merged, or the approved no-merge close reason is recorded.
48+
- Main Verified means current branch is `main`, `main` includes the merge or final commit, worktree is clean, local/origin sync is `0/0`, and no untracked files remain.
49+
- Closed is valid only after every Closed gate passes.
50+
51+
Closed gates:
52+
- PR merged or intentionally closed without merge with reason recorded.
53+
- Changes pushed.
54+
- Current branch is `main`.
55+
- `main` includes the merge commit or recorded final commit.
56+
- Worktree clean.
57+
- Local/origin sync is `0/0`.
58+
- No untracked files.
59+
- Branch disposition is recorded as `deleted`, `retained for follow-up`, or `archived`.
60+
- Required reports exist.
61+
- Required repo-structured ZIP under `tmp/` exists.
2562

2663
## Rules
2764

@@ -31,6 +68,8 @@ Define the standard pull request workflow for Game Foundry Studio.
3168
- Do not mix unrelated scopes.
3269
- Do not start dependent PRs until the required base PR is merged.
3370
- Always return to main before starting the next PR.
71+
- A team must not begin another PR if its previous PR is not Closed.
72+
- Exception is allowed only for explicitly documented stacked PR chains.
3473
- If validation fails, stop and report.
3574
- If conflict occurs, stop and report.
3675
- If OWNER decision is required, stop and report.

docs_build/dev/ProjectInstructions/addendums/team_release_readiness.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Teams may start only when all of the following are true:
2020
- No-direct-main rule exists.
2121
- Out-of-scope stop rule exists.
2222
- Build Path sync rule exists.
23+
- PR lifecycle states exist in order: PR Open, Building, Validation, Approved, Merged, Main Verified, Closed.
24+
- Previous-PR Closed gate exists before a team starts another PR, except explicitly documented stacked PR chains.
25+
- Final closeout output includes branch, worktree, local/origin sync, PR number/name, PR status, merge/final commit, branch disposition, ZIP path, and Closeout PASS/FAIL.
2326

2427
## Gate Outcome
2528

docs_build/dev/ProjectInstructions/addendums/team_start_and_release.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Before a team starts, validate:
1919
- active assignment is selected or confirmed by OWNER
2020
- assigned team uses NATO phonetic naming
2121
- work remains with the assigned team until complete or OWNER reassignment
22+
- the team's previous PR is Closed, unless OWNER documented an explicit stacked PR chain
2223

2324
## Current Four-Team Start Set
2425

@@ -60,10 +61,12 @@ For backlog-driven work:
6061
1. Read `docs_build/dev/ProjectInstructions/backlog/BACKLOG_MASTER.md`.
6162
2. Select only the OWNER-approved backlog item.
6263
3. Use the approved status model from `status_model.md`.
63-
4. Create or use the approved team branch.
64-
5. Record active work in the active team registry when required.
65-
6. Open a draft PR after validation.
66-
7. Merge only through OWNER-approved PR workflow.
64+
4. Confirm the previous PR for the team is Closed, unless this is an explicitly documented stacked PR chain.
65+
5. Create or use the approved team branch and PR identity.
66+
6. Mark lifecycle state as PR Open before BUILD_PR work begins.
67+
7. Record active work in the active team registry when required.
68+
8. Open or update a draft PR during active work.
69+
9. Merge only through OWNER-approved PR workflow.
6770

6871
## Team Command Examples
6972

@@ -87,6 +90,19 @@ A team or OWNER PR is release-ready when:
8790
- branch context is correct
8891
- active assignment or OWNER ownership is clear
8992
- PR summary states the validation result
93+
- lifecycle state is at least Validation
94+
- required reports and repo-structured ZIP under `tmp/` exist before Closed
95+
96+
Closed readiness requires:
97+
- PR merged or intentionally closed without merge with reason recorded
98+
- current branch is `main`
99+
- worktree clean
100+
- local/origin sync is `0/0`
101+
- no untracked files
102+
- merge or final commit recorded
103+
- branch disposition recorded as `deleted`, `retained for follow-up`, or `archived`
104+
- required reports exist
105+
- required repo-structured ZIP under `tmp/` exists
90106

91107
## Gate Behavior
92108

docs_build/dev/ProjectInstructions/team_assignments/TEAM_ASSIGNMENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Rules:
1717
- Registry must be updated when assignments change.
1818
- Registry must be updated when branches are retired.
1919
- Registry must be updated when PRs merge.
20+
- Registry must record when a team PR reaches Closed before that team begins another PR, unless OWNER documented an explicit stacked PR chain.
2021
- Teams with no active work are omitted.
2122

2223
A team is Active when:
@@ -138,6 +139,9 @@ Rules:
138139
- Each PR must still have one clear purpose.
139140
- Each PR must create its own branch.
140141
- Each PR must be committed, pushed, and opened as a draft PR.
142+
- Each PR starts at PR Open after the branch and PR identity are named.
143+
- Each PR reaches Closed only after main-return, clean-worktree, local/origin `0/0`, no-untracked-files, required-report, required-ZIP, and branch-disposition gates pass.
144+
- A team must not begin another PR until its previous PR is Closed unless OWNER documented an explicit stacked PR chain.
141145
- Do not commit directly to main.
142146
- Do not merge without explicit owner approval.
143147
- If later PRs depend on earlier unmerged PRs, Codex must either:
@@ -164,6 +168,8 @@ Rules:
164168
- Each PR must create or use its own approved branch.
165169
- Each PR may be committed and pushed during active work.
166170
- Each PR may be opened as a draft PR during active work.
171+
- Each PR must move through PR Open, Building, Validation, Approved, Merged, Main Verified, and Closed in order.
172+
- A team must not begin another PR until its previous PR is Closed unless OWNER documented an explicit stacked PR chain.
167173
- Do not commit directly to main.
168174
- Do not merge to main during active work unless the owner explicitly says: "Merge this PR now."
169175
- If later PRs depend on earlier unmerged PRs, Codex must either:

0 commit comments

Comments
 (0)