Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .claude/skills/product-owner/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ like this:
`dos-rate-services-services-antigravity-po-checkin.md` for Rate Services),
outside the repository (in that PO's own notes or `po-state` folder), never
committed, and never writes another PO's or line's file.
- **One promoter.** Only the Claude Code PO runs `promote.mjs` and the
`verify-live.mjs` check after it. The Qwen and Antigravity POs ask the
Claude Code PO (or JOY, if they cannot reach it) when their merged work
- **Authorized promoters.** Normally the Claude Code PO runs `promote.mjs` and
the `verify-live.mjs` check after it; on Claude Code quota failover or JOY's
assignment, the Antigravity PO runs them instead (DOS/Rate#1849). The Qwen PO
(and the Antigravity PO when neither on quota failover nor assigned by JOY)
asks the active promoting PO (or JOY, if it cannot reach it) when merged work
needs a promotion. `promote.mjs` refuses to run when the session's claimant
(resolved as `board.mjs` does) is not `claude:` or cannot be resolved: a
guard against mistakes, not access control.
(resolved as `board.mjs` does) is not `claude:` or `antigravity:`, or cannot
be resolved: a guard against mistakes, not access control.
- The claim lock (see "Claims") keeps their sub-sessions off each other's
issues even when two take the same issue at the same moment.

Expand Down Expand Up @@ -504,7 +506,9 @@ secrets and credentials (GitHub, Vercel, Supabase, `AI_API_KEY`,

The normal `dev` -> `main` promotion is not one of these steps: it stays
batched as `AGENTS.md` 0.2 and `Docs/Resources/RELEASE.md` say, needs no
per-release question, and is run by the Claude Code PO only (`node scripts/ops/promote.mjs`,
per-release question, and is run by the Claude Code PO (or the Antigravity PO
on quota failover / JOY's assignment, passing
`--claimant antigravity:<conversation id>`: `node scripts/ops/promote.mjs`,
then `node scripts/ops/verify-live.mjs --wait 900`) at the first checkpoint:
no ready backlog left, 10 or more PRs waiting on `dev`, the oldest
unpromoted change older than 24 hours, or the end of a long working session.
Expand Down
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TΓ i liệu nΓ y tα»•ng hợp Δ‘αΊ§y Δ‘α»§ **User-Level Hard Rules (`~/AGENTS.md
- KhΓ΄ng bao giờ Δ‘Ζ°a lệnh terminal, shell snippet hay code bαΊ£o JOY tα»± chαΊ‘y hoαΊ·c tα»± dΓ‘n. Agent phαΊ£i tα»± chαΊ‘y tαΊ₯t cαΊ£.
- KhΓ΄ng bao giờ bαΊ£o JOY tα»± review code diff hay bαΊ₯m nΓΊt Merge PR ("chờ mΓ y merge"). Agent phαΊ£i chαΊ‘y code review (`superpowers:code-reviewer` / subagent fresh-context review), sα»­a hαΊΏt lα»—i, đợi CI xanh vΓ  **tα»± Δ‘α»™ng merge PR** (`gh pr merge`).
- Chỉ hỏi Γ½ kiαΊΏn JOY cho: quyαΊΏt Δ‘α»‹nh sαΊ£n phαΊ©m/kiαΊΏn trΓΊc, thao tΓ‘c rα»§i ro cao (xΓ³a dα»― liệu, thay Δ‘α»•i prod, tiΓͺu tiền, sα»­a khΓ‘c repo `cross-repo writes`), hoαΊ·c bΖ°α»›c bαΊ―t buα»™c cαΊ§n người thαΊ­t (2FA, CAPTCHA, OAuth device code).
- **PR promote `dev` -> `main` (deploy production) cΕ©ng do agent tα»± merge.** JOY khΓ΄ng phαΊ£i coder, khΓ΄ng biαΊΏt merge vΓ  khΓ΄ng bαΊ₯m nΓΊt Merge cho bαΊ₯t kα»³ PR nΓ o, kể cαΊ£ PR promote. **Promote theo đợt, khΓ΄ng hỏi JOY mα»—i lαΊ§n:** agent cα»© lΓ m task liΓͺn tα»₯c, khΓ΄ng kαΊΏt thΓΊc task bαΊ±ng cΓ’u hỏi "deploy lΓͺn production nhΓ©?". Agent tα»± mở vΓ  merge PR promote khi gαΊ·p mα»™t trong cΓ‘c mα»‘c (khi cΓ³ PO thΓ¬ chỉ PO Claude Code promote, xem Mα»₯c 6): hαΊΏt backlog; `dev` dα»“n tα»« 10 PR chΖ°a promote trở lΓͺn; thay Δ‘α»•i cΕ© nhαΊ₯t chΖ°a promote Δ‘Γ£ quΓ‘ 24 giờ; hoαΊ·c agent kαΊΏt thΓΊc mα»™t phiΓͺn lΓ m việc dΓ i. Chỉ promote khi CI cα»§a `dev` head xanh vΓ  khΓ΄ng cΓ³ PR nΓ o Δ‘ang sα»­a dở mα»™t lα»—i Δ‘Γ£ lΓͺn production. Merge bαΊ±ng merge commit (`gh pr merge <N> --merge`, khΓ΄ng squash/rebase), rα»“i tα»± kiểm tra bαΊ£n live theo `Docs/Resources/RELEASE.md`. KhΓ΄ng bao giờ viαΊΏt "chờ JOY merge", "JOY duyệt merge" hay "JOY merge bαΊ±ng merge commit". VαΊ«n phαΊ£i hỏi JOY trΖ°α»›c nhα»―ng việc ngoΓ i mα»™t lαΊ§n promote thΓ΄ng thường (migration DOS-Me, sα»­a dα»― liệu production, Δ‘α»•i credential).
- **PR promote `dev` -> `main` (deploy production) cΕ©ng do agent tα»± merge.** JOY khΓ΄ng phαΊ£i coder, khΓ΄ng biαΊΏt merge vΓ  khΓ΄ng bαΊ₯m nΓΊt Merge cho bαΊ₯t kα»³ PR nΓ o, kể cαΊ£ PR promote. **Promote theo đợt, khΓ΄ng hỏi JOY mα»—i lαΊ§n:** agent cα»© lΓ m task liΓͺn tα»₯c, khΓ΄ng kαΊΏt thΓΊc task bαΊ±ng cΓ’u hỏi "deploy lΓͺn production nhΓ©?". Agent tα»± mở vΓ  merge PR promote khi gαΊ·p mα»™t trong cΓ‘c mα»‘c (khi cΓ³ PO thΓ¬ chỉ PO Claude Code hoαΊ·c PO Antigravity khi failover quota / JOY giao mα»›i promote, xem Mα»₯c 6): hαΊΏt backlog; `dev` dα»“n tα»« 10 PR chΖ°a promote trở lΓͺn; thay Δ‘α»•i cΕ© nhαΊ₯t chΖ°a promote Δ‘Γ£ quΓ‘ 24 giờ; hoαΊ·c agent kαΊΏt thΓΊc mα»™t phiΓͺn lΓ m việc dΓ i. Chỉ promote khi CI cα»§a `dev` head xanh vΓ  khΓ΄ng cΓ³ PR nΓ o Δ‘ang sα»­a dở mα»™t lα»—i Δ‘Γ£ lΓͺn production. Merge bαΊ±ng merge commit (`gh pr merge <N> --merge`, khΓ΄ng squash/rebase), rα»“i tα»± kiểm tra bαΊ£n live theo `Docs/Resources/RELEASE.md`. KhΓ΄ng bao giờ viαΊΏt "chờ JOY merge", "JOY duyệt merge" hay "JOY merge bαΊ±ng merge commit". VαΊ«n phαΊ£i hỏi JOY trΖ°α»›c nhα»―ng việc ngoΓ i mα»™t lαΊ§n promote thΓ΄ng thường (migration DOS-Me, sα»­a dα»― liệu production, Δ‘α»•i credential).

3. **NgΓ΄n ngα»― & Định dαΊ‘ng Giao tiαΊΏp:**
- **TrαΊ£ lời trα»±c tiαΊΏp JOY (Private / Direct Chat):** LuΓ΄n dΓΉng **TiαΊΏng Việt cΓ³ dαΊ₯u Δ‘αΊ§y Δ‘α»§ 100%** trΓͺn bề mαΊ·t giao tiαΊΏp trα»±c tiαΊΏp vα»›i JOY (chat, cΓ’u hỏi `ask_question`, nhΓ£n lα»±a chọn). Giα»― nguyΓͺn thuαΊ­t ngα»― kα»Ή thuαΊ­t thΓ΄ng dα»₯ng bαΊ±ng tiαΊΏng Anh (`API`, `commit`, `branch`, `PR`, `CI`, `build`, `deploy`, `repo`, `merge`, `push`, `workflow`, `token`, `key`, `env`, `prod`, `staging`).
Expand All @@ -43,7 +43,7 @@ TΓ i liệu nΓ y tα»•ng hợp Δ‘αΊ§y Δ‘α»§ **User-Level Hard Rules (`~/AGENTS.md
- NgoαΊ‘i lệ duy nhαΊ₯t: **rollback** về mα»™t bαΊ£n production cΕ© Δ‘Γ£ build tα»« Git (`vercel rollback`), vΓ¬ khΓ΄ng build lαΊ‘i. Sau Δ‘Γ³ sα»­a tiαΊΏp qua PR hotfix.
- **Script vαΊ­n hΓ nh cΓ³ sαΊ΅n trong repo (`scripts/ops/`, dΓΉng thay cho lệnh gΓ΅ tay):**
- `node scripts/ops/merge-when-green.mjs <pr>`: chờ commit head xanh rα»“i merge, ghim theo SHA head. Xanh nghΔ©a lΓ  mọi check run vΓ  mọi commit status (Vercel) đều Δ‘αΊ‘t, vΓ  cΓ‘c check mΓ  ruleset bαΊ―t buα»™c Δ‘Γ£ bΓ‘o kαΊΏt quαΊ£. PR vΓ o `main` luΓ΄n dΓΉng merge commit, PR khΓ‘c mαΊ·c Δ‘α»‹nh squash. `--ignore "<check>"` chỉ dΓΉng khi mα»™t check khΓ΄ng bαΊ―t buα»™c Δ‘ang hỏng cΓ³ lΓ½ do Δ‘Γ£ ghi trong PR.
- `node scripts/ops/promote.mjs`: mở hoαΊ·c dΓΉng lαΊ‘i PR promote `dev` -> `main`, liệt kΓͺ cΓ‘c PR được phΓ‘t hΓ nh, merge bαΊ±ng merge commit khi CI xanh. Script tα»« chα»‘i chαΊ‘y khi claimant cα»§a session (tΓ­nh nhΖ° `board.mjs`) khΓ΄ng phαΊ£i `claude:<session id>` (#1675, xem Mα»₯c 6).
- `node scripts/ops/promote.mjs [--claimant <tool>:<session id>]`: mở hoαΊ·c dΓΉng lαΊ‘i PR promote `dev` -> `main`, liệt kΓͺ cΓ‘c PR được phΓ‘t hΓ nh, merge bαΊ±ng merge commit khi CI xanh. Script tα»« chα»‘i chαΊ‘y khi claimant cα»§a session (tΓ­nh nhΖ° `board.mjs`) khΓ΄ng thuα»™c `claude:<session id>` hoαΊ·c `antigravity:<conversation id>` (#1675, #1849, xem Mα»₯c 6).
- `node scripts/ops/verify-live.mjs --wait 900`: kiểm tra rate.vn chαΊ‘y Δ‘ΓΊng commit cα»§a `main` (`/api/health` trαΊ£ `commit`), database đọc được vΓ  cΓ‘c route chΓ­nh trαΊ£ 200. Script đọc lαΊ‘i `main` mα»—i vΓ²ng chờ. Chỉ khi bαΊ£n live chαΊ­m hΖ‘n `main`, nΓ³ mα»›i in lệnh `vercel promote <deployment cα»§a main> --scope metados`; nαΊΏu bαΊ£n live Δ‘i trΖ°α»›c hoαΊ·c lệch nhΓ‘nh so vα»›i `main`, nΓ³ dαΊ·n khΓ΄ng lΓ m gΓ¬. KhΓ΄ng bao giờ redeploy hay promote mα»™t deployment build tα»« commit khΓ‘c (`promote` khΓ΄ng build lαΊ‘i, vΓ  bαΊ­t lαΊ‘i tα»± gΓ‘n domain sau mα»™t lαΊ§n `vercel rollback`).
- `node scripts/ops/board.mjs <issue> --status in-progress|in-review|ready|backlog|done --agent <Nick> [--claimant <tool>:<session id>]`: lαΊ₯y, giα»― hoαΊ·c nhαΊ£ khΓ³a claim `refs/claims/<n>` cα»§a session, rα»“i cαΊ­p nhαΊ­t nhΓ£n vΓ  Project #9 (xem mα»₯c 1). Script tα»« chα»‘i issue Δ‘ang bα»‹ session khΓ‘c giα»― khΓ³a, Δ‘ang mang nhΓ£n `agent:*` cα»§a agent khΓ‘c hoαΊ·c nhΓ£n `po:*` cα»§a PO khΓ‘c; `--take-over` chỉ dΓΉng khi agent Δ‘Γ³ Δ‘Γ£ bΓ n giao hoαΊ·c JOY chỉ Δ‘α»‹nh, `--adopt` chỉ cho claim cΕ© (trΖ°α»›c khΓ³a) cα»§a chΓ­nh session nΓ y. `--force-release --agent PO --reason "..."` gα»‘ khΓ³a mα»“ cΓ΄i (PO).

Expand Down Expand Up @@ -240,7 +240,7 @@ Quy tαΊ―c cho chΓ­nh cΓ‘c PO:

- **Nhiều PO song song trΓͺn cΓΉng repo (#1673, #1805):** JOY cΓ³ thể chαΊ‘y cΓ‘c PO song song trΓͺn cΓΉng repo trong Claude Code (`po:claude`), Qwen Code Desktop (`po:qwen`), vΓ  Antigravity (`po:antigravity`). NhΓ£n `po:claude`, `po:qwen`, vΓ  `po:antigravity` cho biαΊΏt PO nΓ o Δ‘iều phα»‘i issue. Mα»—i PO chỉ giao issue mang nhΓ£n cα»§a mΓ¬nh hoαΊ·c chΖ°a cΓ³ nhΓ£n `po:*`, vΓ  gαΊ―n nhΓ£n cα»§a mΓ¬nh khi giao (vΓ­ dα»₯ `gh issue edit <n> -R DOS/Rate --add-label po:claude`). `board.mjs` tα»± thΓͺm nhΓ£n line theo claimant khi claim, vΓ  tα»« chα»‘i issue mang nhΓ£n `po:*` cα»§a PO khΓ‘c nαΊΏu khΓ΄ng cΓ³ `--take-over` (chỉ khi JOY giao). Claimant cα»§a cΓ΄ng cα»₯ khΓ΄ng chαΊ‘y PO (vΓ­ dα»₯ `codex:...`) khΓ΄ng được thΓͺm nhΓ£n `po:*` vΓ  khΓ΄ng bα»‹ chαΊ·n theo line; agent Δ‘Γ³ vαΊ«n phαΊ£i tΓ΄n trọng nhΓ£n `po:*` theo quy tαΊ―c nΓ y. Session con cα»§a PO Claude Code dΓΉng claimant `claude:<session id>`, cα»§a PO Qwen dΓΉng `qwen:<session id>`, cα»§a PO Antigravity dΓΉng `antigravity:<conversation id>`.
- **TrαΊ‘ng thΓ‘i PO tΓ‘ch riΓͺng:** mα»—i PO cΓ³ file trαΊ‘ng thΓ‘i vΓ  check-in riΓͺng theo cΓ΄ng cα»₯ vΓ  theo line (`po-state.claude.md`, `po-state.qwen.md`, hoαΊ·c file `*-antigravity-po-checkin.md` theo tα»«ng line trong `~/.claude/po-state/` cho PO Antigravity: `dos-rate-core-antigravity-po-checkin.md` cho Rate Core, `dos-rate-services-services-antigravity-po-checkin.md` cho Rate Services), Δ‘αΊ·t **ngoΓ i repo** (trong thΖ° mα»₯c ghi chΓΊ hoαΊ·c `po-state` riΓͺng cα»§a chΓ­nh PO Δ‘Γ³), khΓ΄ng bao giờ commit, vΓ  khΓ΄ng bao giờ ghi vΓ o file cα»§a PO khΓ‘c hay line khΓ‘c.
- **Chỉ mα»™t PO promote:** `promote.mjs` (`dev` -> `main`) vΓ  `verify-live.mjs` sau Δ‘Γ³ chỉ do PO Claude Code chαΊ‘y. PO Qwen hoαΊ·c PO Antigravity cαΊ§n promote thΓ¬ nhαΊ―n PO Claude Code (qua JOY nαΊΏu khΓ΄ng nhαΊ―n trα»±c tiαΊΏp được), khΓ΄ng tα»± chαΊ‘y. `promote.mjs` tα»« chα»‘i chαΊ‘y khi claimant cα»§a session khΓ΄ng phαΊ£i `claude:` hoαΊ·c khΓ΄ng xΓ‘c Δ‘α»‹nh được (#1675). ĐÒy lΓ  rΓ o chαΊ―n chα»‘ng nhαΊ§m, khΓ΄ng phαΊ£i phΓ’n quyền: claimant cΓ³ thể truyền tay bαΊ±ng `--claimant`.
- **Chỉ PO được phΓ©p promote:** `promote.mjs` (`dev` -> `main`) vΓ  `verify-live.mjs` sau Δ‘Γ³ do PO Claude Code chαΊ‘y (hoαΊ·c PO Antigravity khi PO Claude hαΊΏt quota / được JOY giao, truyền `--claimant antigravity:<conversation id>`, #1849). PO Qwen (hoαΊ·c PO Antigravity khi chΖ°a failover vΓ  chΖ°a được JOY giao) cαΊ§n promote thΓ¬ nhαΊ―n PO Δ‘ang giα»― quyền promote (qua JOY nαΊΏu khΓ΄ng nhαΊ―n trα»±c tiαΊΏp được), khΓ΄ng tα»± chαΊ‘y. `promote.mjs` tα»« chα»‘i chαΊ‘y khi claimant cα»§a session khΓ΄ng phαΊ£i `claude:` hay `antigravity:`, hoαΊ·c khΓ΄ng xΓ‘c Δ‘α»‹nh được (#1675, #1849). ĐÒy lΓ  rΓ o chαΊ―n chα»‘ng nhαΊ§m, khΓ΄ng phαΊ£i phΓ’n quyền: claimant cΓ³ thể truyền qua `--claimant`.

Khi mα»™t session do PO mở (session con), cΓ‘c quy tαΊ―c sau thay Δ‘α»•i so vα»›i Mα»₯c 0 vΓ  Mα»₯c 1:

Expand All @@ -252,5 +252,5 @@ Khi mα»™t session do PO mở (session con), cΓ‘c quy tαΊ―c sau thay Δ‘α»•i so v
- **`merge-when-green.mjs` cα»§a chΓ­nh PO cΕ©ng cΓ³ thể bα»‹ tα»« chα»‘i** (bΓ i học 2026-10-27, lΓ½ do "Merge Without Review") cho tα»›i khi JOY duyệt Δ‘ΓΊng PR Δ‘Γ³ trong chat cα»§a PO. Mα»™t cΓ’u chung nhΖ° "chα»§ Δ‘α»™ng lΓͺn" khΓ΄ng phαΊ£i lΓ  lời duyệt merge. Khi Δ‘Γ³, thay cho cΓ’u "agent tα»± merge" cα»§a Mα»₯c 0.2, PO khΓ΄ng thα»­ lαΊ‘i mΓ  **gom mọi PR Δ‘Γ£ qua cα»•ng chαΊ₯p nhαΊ­n nhΖ°ng chΖ°a merge được (session con hoαΊ·c chΓ­nh PO bα»‹ tα»« chα»‘i) vΓ o MỘT cΓ’u hỏi ngαΊ―n** gα»­i JOY ("PR #a, #b, #c: merge?") thay vΓ¬ hỏi tα»«ng PR, rα»“i tα»± chαΊ‘y script cho Δ‘ΓΊng cΓ‘c PR JOY duyệt. KhΓ΄ng bao giờ bαΊ£o JOY tα»± bαΊ₯m Merge.
- **NhαΊ£ issue (release) lΓ  mα»™t lαΊ§n bΓ n giao:** session con nhαΊ£ issue thΓ¬ comment lΓ½ do vΓ  chα»— dα»«ng rα»“i chαΊ‘y `board.mjs <n> --status ready --agent <Nick>`; session sau được dΓΉng `--take-over` vΓ  dαΊ«n link comment Δ‘Γ³. Claim khΓ΄ng cΓ³ bΓ n giao nhΖ°ng trΓ΄ng nhΖ° bα»‹ bỏ rΖ‘i (vΓ­ dα»₯ sau khi Δ‘α»•i mΓ‘y) chỉ được lαΊ₯y lαΊ‘i khi JOY Δ‘α»“ng Γ½ (Mα»₯c 0.6); khi Δ‘Γ³ session mα»›i claim vα»›i `--take-over` (thay khΓ³a cΕ©), hoαΊ·c nαΊΏu chΖ°a cΓ³ ai nhαΊ­n thΓ¬ PO gα»‘ khΓ³a bαΊ±ng `--force-release` nhΖ° Mα»₯c 1.
- **Done cα»§a thay Δ‘α»•i runtime:** issue tα»± Δ‘Γ³ng khi PR merge vΓ o `dev`; vα»›i thay Δ‘α»•i runtime, PO chuyển sang `done` sau khi promote vΓ  `verify-live.mjs` Δ‘αΊ‘t. Thay Δ‘α»•i docs, CI, tooling thΓ¬ `done` ngay khi merge.
- PR promote `dev` -> `main` vαΊ«n theo đợt nhΖ° Mα»₯c 0.2, do PO Claude Code chαΊ‘y (xem "Chỉ mα»™t PO promote" ở trΓͺn), khΓ΄ng do session con.
- PR promote `dev` -> `main` vαΊ«n theo đợt nhΖ° Mα»₯c 0.2, do PO Claude Code (hoαΊ·c PO Antigravity khi failover quota / JOY giao) chαΊ‘y (xem "Chỉ PO được phΓ©p promote" ở trΓͺn), khΓ΄ng do session con.
- **Rate Services khΓ‘c Rate Core:** `DOS/Rate-Services` khΓ΄ng cΓ³ nhΓ‘nh `dev`, khΓ΄ng cΓ³ check `task-claim` vΓ  khΓ΄ng cΓ³ `scripts/ops/`; PR vΓ o `main`, vΓ  `board.mjs`/`merge-when-green.mjs` chαΊ‘y tα»« checkout `DOS/Rate` vα»›i `--repo DOS/Rate-Services`. Chi tiαΊΏt trong skill.
14 changes: 11 additions & 3 deletions docs/product-owner-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ side as "Triage" in that skill says.
- test_environment: Vercel builds `dev` as a Preview deployment; check it there
before a promotion (`Docs/Resources/RELEASE.md`). Previews have no database
env.
- promotion_notes: `Docs/Resources/RELEASE.md`; promotions run
`node scripts/ops/promote.mjs`, then `node scripts/ops/verify-live.mjs`.
- promotion_notes: `Docs/Resources/RELEASE.md`; promotions are batched at
checkpoints without per-release owner approval (`AGENTS.md` 0.2) and need no
`main` -> `dev` back-merge (`promote.mjs` merges `dev` -> `main` with
`--merge`). Run `node scripts/ops/promote.mjs` (Antigravity PO passes
`--claimant antigravity:<conversation id>`), then
`node scripts/ops/verify-live.mjs --wait 900`. `promote.mjs` accepts
`claude:` or `antigravity:` claimants (Claude Code PO normally, or
Antigravity PO on Claude quota failover / JOY assignment; Qwen remains
blocked).

## Checks and review

Expand All @@ -102,6 +109,7 @@ side as "Triage" in that skill says.
says: a fresh-context subagent review of the diff (`AGENTS.md` sections 0.2
and 5), then a Codex review where Codex is available; a PR without one
says so
- promotion_reviews: none
- agent_model: sonnet (Antigravity: inherit on Orchestrator (Neon), Orchestrator (Carbon), Gemini 4 Neon, or Gemini 4 Carbon)

## Claim lock and parallel POs
Expand All @@ -112,7 +120,7 @@ side as "Triage" in that skill says.
environment other sessions (sub-sessions included) inherit.
- pr_issue_keyword: Closes
- po_labels: claude: po:claude, qwen: po:qwen, antigravity: po:antigravity
- promotion_po: claude
- promotion_po: claude (or antigravity on Claude quota failover / JOY assignment)

## Sessions

Expand Down
28 changes: 19 additions & 9 deletions scripts/ops/promote.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,40 @@
//
// Then check the release: node scripts/ops/verify-live.mjs --wait 900
//
// Only the Claude Code PO promotes (AGENTS.md section 6): the script refuses
// to run unless the session's claimant, resolved like board.mjs does, is a
// `claude:` one (DOS/Rate#1675). A guard against a Qwen or other session
// promoting by mistake, not access control: a claimant can be passed by hand.
// Only the Claude Code PO (or the Antigravity PO on quota failover / JOY's
// assignment) promotes (AGENTS.md section 6): the script refuses to run unless
// the session's claimant, resolved like board.mjs does, uses a tool prefix in
// PROMOTER_TOOLS (`claude:` or `antigravity:`, DOS/Rate#1675, DOS/Rate#1849).
// A guard against a Qwen or other session promoting by mistake, not access
// control: a claimant can be passed by hand.

import { parseArgs } from 'node:util';
import { resolveClaimant } from '../claim-lock.mjs';
import { DEFAULT_REPO, fail, gh, ghJson, isMain } from './lib.mjs';
import { mergeWhenGreen } from './merge-when-green.mjs';

/** The only tool whose sessions promote dev to main. */
const ALLOWED_PROMOTER_TOOLS = new Set(['claude', 'antigravity']);

/** Primary promoter runtime (kept for backward compatibility). */
export const PROMOTER_TOOL = 'claude';

/** Tools whose PO sessions may promote dev to main (Claude, or Antigravity on quota failover). */
export const PROMOTER_TOOLS = new Set(ALLOWED_PROMOTER_TOOLS);

/**
* The claimant of the session running the promotion, or an error when it
* cannot be resolved or is not a Claude Code session.
* cannot be resolved or its tool prefix is not in PROMOTER_TOOLS.
*/
export function promoterClaimant({ flag, env = {} } = {}) {
if (flag !== undefined && !String(flag).trim()) {
throw new Error('no claimant: --claimant cannot be empty');
}
const claimant = resolveClaimant({ flag, env });
const tool = claimant.split(':')[0];
if (tool !== PROMOTER_TOOL) {
if (!ALLOWED_PROMOTER_TOOLS.has(tool)) {
throw new Error(
`only the Claude Code PO promotes dev to main (AGENTS.md section 6), ` +
`and this session's claimant is a ${tool}: one; ask the Claude Code PO ` +
`only the Claude Code or Antigravity PO promotes dev to main (AGENTS.md section 6), ` +
`and this session's claimant is a ${tool}: one; ask the Claude Code or Antigravity PO ` +
'(through JOY if it cannot be reached) to promote'
);
}
Expand Down
Loading
Loading