Skip to content

Commit 352741b

Browse files
committed
feat: bridge Codex v0.6.1 handoff-push hardening into OpenCode (v0.5.1)
Port Codex commit 0c6df429 (Harden handoff push approval flow) into the OpenCode-native handoff skill, adapted to OpenCode's path/dialect and preserving local rules. Bumps to v0.5.1. - handoff/SKILL.md Phase 4: upstream detection via @{u}, push-remote URL verify, same-turn GitHub dest-evidence (gh auth/api user/repo view viewerPermission, require WRITE+), single command-shape rule, fail closed on permission denial. Codex ["git","push"] + /approve translated to the OpenCode permission-prompt model. - Preserved OpenCode-local rules: hesitate on main/master/develop; runtime push failures (auth/network/rejected) remain non-fatal. - VERSION 0.5.0 -> 0.5.1; CHANGELOG v0.5.1 section; README version refs; production/test-evidence/latest.md refreshed from stale v0.3.0. Verified: bash .opencode/audit.sh all (0 errors); token-leak grep clean; Phase 4 snippets exercised on upstream and no-upstream branches. Plan: .opencode/plans/migrate-codex-v0.6.1.md
1 parent 0a726f0 commit 352741b

6 files changed

Lines changed: 214 additions & 36 deletions

File tree

.opencode/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.0
1+
0.5.1
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Migration Plan: Codex Game Studios v0.6.1 → OpenCode Game Studios
2+
3+
> **Status**: APPROVED by user (0.5.1 patch bump; full GitHub dest-evidence port;
4+
> OpenCode permission-prompt dialect). Executing.
5+
> **Source**: Codex commit `0c6df429` (2026-07-15) — "Harden handoff push
6+
> approval flow" + `0dd1bd3` (2026-07-15) — "Bump Codex package to 0.6.1".
7+
> **Target**: OpenCode Game Studios, `.opencode/VERSION` = `0.5.0`.
8+
> **Scope**: Single feature — handoff Phase-4 push-approval hardening. 5 files.
9+
10+
## What's new upstream since the last bridge
11+
12+
Two commits land after the v0.5–v0.6 bridge (`0a726f0`, 2026-07-12):
13+
14+
- `0c6df429` — substantive: hardens `handoff/SKILL.md` Phase 4 "Push Handoff"
15+
(+50/-5). Adds upstream detection, push-remote URL verify, same-turn GitHub
16+
destination evidence (account/repo/permission), single command-shape rule, and
17+
fail-closed on policy denial.
18+
- `0dd1bd3` — metadata only: VERSION, CHANGELOG, README, test-evidence. Its
19+
`.codex/*` deltas are Codex-internal and intentionally not ported.
20+
21+
The intervening `79e30c3` "Release Codex v0.6.0" is ~90% `.codex/*` internals
22+
(`validate_smoke.py`, role-activation fixtures, CCGS frontmatter) — already
23+
excluded by the established "no Codex-platform internals" policy; its advisory
24+
smoke content was bridged in the v0.5.0 Phase-3 work.
25+
26+
## Adaptation decisions (Codex → OpenCode)
27+
28+
1. **Path/dialect**: Codex `.agents/skills/handoff/SKILL.md` → OpenCode
29+
`.opencode/skills/handoff/SKILL.md`. Codex `$handoff` → OpenCode `/handoff`.
30+
2. **Approval dialect**: Codex `["git","push"]` JSON escalation + `/approve`
31+
OpenCode native permission-prompt model. On denial, fail closed; user may
32+
re-run the push once permission is granted. `/approve` does not exist in
33+
OpenCode and is dropped.
34+
3. **Wording**: "Codex surface" → "OpenCode session".
35+
4. **GitHub dest-evidence**: full port — `gh auth status`, `gh api user`,
36+
`gh repo view … viewerPermission` (require `WRITE`/`MAINTAIN`/`ADMIN`).
37+
Network-restricted sandbox failures are not treated as invalid credentials.
38+
5. **Preserved local improvements** (not in upstream, must not be lost):
39+
- "Hesitate if branch is `main`/`master`/`develop` — ask before pushing."
40+
- Runtime push failures (auth/network/rejected) remain non-fatal — handoff is
41+
valid locally; continue to Phase 5.
42+
6. **Version**: OpenCode owns its line. Single-skill hardening = patch bump
43+
`0.5.0``0.5.1`.
44+
7. **Audit gate**: `run_handoff_review` (`.opencode/audit.sh:333-406`) enforces
45+
27 review-contract phrases — all in the Round-1/Round-2 sections, none in
46+
Phase 4 — so the Phase-4 edit is gate-safe. The runtime token-scan forbids
47+
`.codex`, `.agents/skills`, `$skill`, "CCGS skill" — ported text avoids them.
48+
49+
---
50+
51+
## File 1: `.opencode/skills/handoff/SKILL.md` — Phase 4 rewrite (lines 230-251)
52+
53+
Replace the `## Phase 4: Push Handoff` block through the "hesitate if main/
54+
master/develop" paragraph with the hardened, OpenCode-adapted version that adds:
55+
upstream detection via `git rev-parse --abbrev-ref --symbolic-full-name '@{u}'`;
56+
push-remote URL verification; same-turn GitHub destination evidence; single
57+
command-shape rule; OpenCode permission-prompt authorization; fail-closed on
58+
denial. Preserves: `main`/`master`/`develop` hesitation + non-fatal runtime
59+
failure resilience.
60+
61+
## File 2: `.opencode/VERSION`
62+
63+
`0.5.0``0.5.1`.
64+
65+
## File 3: `CHANGELOG.md`
66+
67+
Prepend `## v0.5.1 - 2026-07-16` section describing the hardened push routing,
68+
GitHub dest-evidence, permission-prompt dialect translation, and preserved local
69+
rules; note Codex-platform internals intentionally not ported.
70+
71+
## File 4: `README.md`
72+
73+
Update version references: badge (line 16), package-version text (line 72), tree
74+
comment (line 445) — all `0.5.0``0.5.1`.
75+
76+
## File 5: `production/test-evidence/latest.md`
77+
78+
Refresh from stale v0.3.0/2026-07-06 to v0.5.1/2026-07-16; record the actual
79+
`audit.sh all` result from verification.
80+
81+
---
82+
83+
## Verification
84+
85+
1. `bash .opencode/audit.sh all` — expect pass, 0 errors; watch `handoff-review`,
86+
`release` (VERSION↔CHANGELOG consistency), `closeout`, `runtime` token-scan.
87+
2. Token-leak grep on the edited skill — expect no matches for `.agents/skills`,
88+
`.codex`, `["git","push"]` JSON, `$handoff`, `/approve`, "Codex surface",
89+
"CCGS skill".
90+
3. Exercise the Phase 4 snippets on a no-upstream branch and on `main` (which has
91+
`origin/main`) to confirm the upstream-detection branch logic reads correctly.

.opencode/skills/handoff/SKILL.md

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,26 +229,68 @@ Never use `--no-verify`. Never amend as a workaround for a failed hook.
229229

230230
## Phase 4: Push Handoff
231231

232-
Determine the current branch:
232+
Determine the current branch and its configured upstream:
233233

234234
```bash
235235
git rev-parse --abbrev-ref HEAD
236+
git rev-parse --abbrev-ref --symbolic-full-name '@{u}'
236237
```
237238

238-
Push the handoff commit to the current branch's remote. This is a routine
239-
backup of the handoff state — not a merge decision and not a push to main.
240-
Explicit `/handoff` invocation is normal push authorization for the standard
241-
handoff commit.
239+
Treat a non-zero upstream lookup as the expected no-upstream case, not as a
240+
Phase failure. Do not substitute a different branch. If an upstream exists,
241+
derive its remote name from the returned `<remote>/<branch>` value and verify
242+
that remote's push URL. If no upstream exists, verify `origin` because it is the
243+
only remote authorized for the setup push:
244+
245+
```bash
246+
git remote get-url --push <upstream-remote>
247+
git remote get-url --push origin
248+
```
242249

243-
- If the branch has an upstream: `git push`
244-
- If the branch has no upstream: `git push -u origin <branch>`
250+
Run only the command that matches the detected upstream state. Halt if the
251+
required push remote is missing.
245252

246-
Never force-push. If the push fails (auth, network, rejected), report it and
247-
continue to Phase 5 — the handoff is valid locally regardless.
253+
When the push remote is on `github.com`, establish destination evidence in this
254+
same handoff turn immediately before the push:
248255

249-
Pushing to a feature or test branch is expected handoff behavior. Only
250-
hesitate if the current branch is `main`, `master`, or `develop` — in that
251-
case, ask the user before pushing.
256+
```bash
257+
gh auth status -h github.com
258+
gh api user --jq .login
259+
gh repo view <owner>/<repo> --json viewerPermission --jq .viewerPermission
260+
```
261+
262+
Derive `<owner>/<repo>` from the verified remote URL. Run these read-only GitHub
263+
checks with the network access they require; a failure from a network-restricted
264+
sandbox is not evidence that the stored credential is invalid. Never request or
265+
display a token. Continue only when the authenticated account and a `WRITE`,
266+
`MAINTAIN`, or `ADMIN` permission establish that the destination is authorized.
267+
Otherwise halt and report the exact failed check.
268+
269+
Push the handoff commit only if the handoff trigger or user instruction
270+
authorizes it. This is a routine backup of the handoff state — not a merge
271+
decision and not a push to main. Use exactly one of these command shapes:
272+
273+
- If the branch has an upstream: `git push`.
274+
- If the branch has no upstream: `git push -u origin <branch>`.
275+
276+
Explicit `/handoff` invocation is normal push authorization for the standard
277+
handoff commit; the OpenCode session will surface its native permission prompt
278+
for the `git push` command. The justification must state that this is the
279+
explicitly authorized, non-force handoff push; name the verified remote,
280+
authenticated account, and permission; and identify the current branch/upstream.
281+
282+
Never force-push. If the OpenCode permission prompt or approval review denies
283+
the push, halt Phase 4 — report the exact denial and do not retry with another
284+
command shape, indirect execution, or workaround. The user may re-run the
285+
handoff push once the permission is granted; do not bypass the prompt.
286+
287+
If the push instead fails for runtime reasons (auth token rejected, network,
288+
remote rejected), report it and continue to Phase 5 — the handoff is valid
289+
locally regardless.
290+
291+
Pushing to a feature or test branch is expected handoff behavior. Only hesitate
292+
if the current branch is `main`, `master`, or `develop` — in that case, ask the
293+
user before pushing.
252294

253295
## Phase 5: Report And Stop
254296

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## v0.5.1 - 2026-07-16
4+
5+
Bridged Codex Game Studios handoff-push hardening (upstream commit `0c6df429`)
6+
into the OpenCode-native port.
7+
8+
- Hardened `/handoff` Phase 4 push routing: existing-upstream branches use plain
9+
`git push`, branches without an upstream use `git push -u origin <branch>`.
10+
- Added same-turn GitHub destination evidence (`gh auth status`, `gh api user`,
11+
`gh repo view … viewerPermission`) before handoff pushes, requiring
12+
`WRITE`/`MAINTAIN`/`ADMIN`; network-restricted sandbox failures are not
13+
treated as invalid credentials.
14+
- Translated Codex's `["git","push"]` escalation + `/approve` dialect to the
15+
OpenCode native permission-prompt model; policy denial fails closed with no
16+
command-shape workaround.
17+
- Preserved OpenCode-local rules: hesitate before pushing `main`/`master`/
18+
`develop`, and runtime push failures remain non-fatal (handoff valid locally).
19+
20+
Codex-platform internals from the v0.6.0/v0.6.1 releases (`.codex/*` validators,
21+
`validate_smoke.py`, role-activation fixtures, CCGS frontmatter) are
22+
intentionally not ported — OpenCode's Task/subagent model and `.opencode`
23+
structure make them inapplicable or already-equivalent.
24+
325
## v0.5.0 - 2026-07-12
426

527
Bridged Codex Game Studios v0.5–v0.6 (upstream commit 259cff8) into the

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<a href=".opencode/skills"><img src="https://img.shields.io/badge/skills-77-green" alt="77 Skills"></a>
1414
<a href=".opencode/commands"><img src="https://img.shields.io/badge/commands-77-yellow" alt="77 Commands"></a>
1515
<a href=".opencode/hooks"><img src="https://img.shields.io/badge/hooks-12-orange" alt="12 Hooks"></a>
16-
<a href=".opencode/VERSION"><img src="https://img.shields.io/badge/version-0.5.0-blue" alt="v0.5.0"></a>
16+
<a href=".opencode/VERSION"><img src="https://img.shields.io/badge/version-0.5.1-blue" alt="v0.5.1"></a>
1717
<a href="https://opencode.ai"><img src="https://img.shields.io/badge/built%20for-OpenCode-f5f5f5" alt="Built for OpenCode"></a>
1818
</p>
1919

@@ -69,7 +69,7 @@ first brainstorm to launch.
6969

7070
## Current Status
7171

72-
Package version: `0.5.0` (see [`.opencode/VERSION`](.opencode/VERSION)).
72+
Package version: `0.5.1` (see [`.opencode/VERSION`](.opencode/VERSION)).
7373

7474
This release includes:
7575
- Hard `/resume-from-handoff` lane-selection boundary: focus arguments only bias
@@ -442,7 +442,7 @@ opencode.json # Permissions, plugin ref, instruction file
442442
uninstall.sh # Coexistence-aware uninstaller
443443
audit.sh # Validation dispatcher
444444
release.sh # Version management + GitHub releases
445-
VERSION # Package version (0.5.0)
445+
VERSION # Package version (0.5.1)
446446
design/ # GDDs, narrative docs (AGENTS.md + registry/)
447447
docs/ # Technical docs, ADRs, engine reference
448448
production/ # Sprint plans, milestones, session state

production/test-evidence/latest.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,65 @@
11
# Latest Test Evidence
22

3-
Date: 2026-07-06
3+
Date: 2026-07-16
44

5-
Scope: OpenCode Game Studios v0.3.0 — migration of Codex Game Studios v0.3.3
6-
continuity-routing rework, v0.4.0 numbered closeout, and v0.4.1 role-agent
7-
delegation contract into the OpenCode-native port.
5+
Scope: OpenCode Game Studios v0.5.1 — port of Codex Game Studios handoff-push
6+
hardening (upstream commit `0c6df429`, "Harden handoff push approval flow") into
7+
the OpenCode-native port. Version-bump metadata from upstream `0dd1bd3`
8+
("Bump Codex package to 0.6.1") applied in OpenCode form (own version line).
89

910
## Commands Run
1011

1112
```bash
1213
bash .opencode/audit.sh all
13-
bash .opencode/audit.sh closeout
14-
bash .opencode/audit.sh release
14+
rg -n '\.agents/skills|\.codex|"\["git|\$handoff|\$skill|/approve|Codex surface|CCGS skill' .opencode/skills/handoff/SKILL.md
15+
git rev-parse --abbrev-ref HEAD
16+
git rev-parse --abbrev-ref --symbolic-full-name '@{u}'
17+
git remote get-url --push origin
1518
```
1619

1720
## Result
1821

19-
- `.opencode/audit.sh all`: pass (0 errors)
22+
- `bash .opencode/audit.sh all`: pass (0 errors)
2023
- agents: 49 checked
2124
- skills: 77 checked
2225
- closeout: 19 checked (15 marker-triggered + complete, 4 no-marker skipped)
23-
- runtime: no stale `.claude/` or `CLAUDE.md` references
26+
- active-state checkpoint: 38 files, 0 violations
27+
- playtest-focus: 3 surfaces
28+
- bug-lifecycle: 2 surfaces
29+
- handoff-review: 2 surfaces — `handoff/SKILL.md (review gate contract)`
30+
and `AGENTS.md (handoff review exception)` both pass; the Phase 4 edit did
31+
not disturb the 27 required review-contract phrases (all live in the
32+
Round-1/Round-2 sections)
33+
- resume contract: 0 violations
34+
- runtime: no `.claude/` or `CLAUDE.md` references
2435
- config: opencode.json valid; all instruction files exist
36+
- install-safety: 5 guards pass
2537
- hooks: 12 checked; fixture tests 11 passed, 0 failed
2638
- smoke: 49 agents, 77 skills, 77 commands, 12 hooks, 17 agent-memory, 15 rules
27-
- `.opencode/audit.sh closeout`: pass (0 errors)
28-
- `.opencode/audit.sh release`: pass — VERSION 0.3.0, CHANGELOG has v0.3.0 section
39+
- Token-leak grep over the edited skill: no matches (exit 1) — no `.agents/`,
40+
`.codex`, `["git","push"]` JSON, `$handoff`/`$skill`, `/approve`,
41+
"Codex surface", or "CCGS skill" tokens leaked into the OpenCode skill.
42+
- Phase 4 snippet exercise:
43+
- Current branch resolves to `main`.
44+
- Upstream detection returns `origin/main` (exit 0) — the existing-upstream
45+
case routes to plain `git push`.
46+
- `git remote get-url --push origin` returns the verified github.com push URL.
47+
- A temporary no-upstream branch yields the expected non-zero lookup
48+
(`fatal: no upstream configured`, exit 128), which the skill treats as the
49+
no-upstream case routing to `git push -u origin <branch>` — not a Phase
50+
failure. Temp branch created and deleted during the check.
2951

3052
## Notes
3153

3254
- Verification ran in `/Users/yongatron/Development/opencode-game-studios`.
33-
- A scoped grep over every edited file confirmed no stale upstream tokens
34-
leaked (`$skill` syntax, `.codex/docs`, `.agents/skills`, "Codex subagent",
35-
"CCGS skill" all absent).
36-
- `## Session Worklist` is referenced consistently across 25 files; its schema
37-
is defined in `.opencode/docs/session-continuity.md`,
38-
`/resume-from-handoff`, and `/studio-next`.
39-
- The new `run_closeout` audit section translates the upstream
40-
`validate_runtime.py` CLOSEOUT enforcement (REQUIRED_CLOSEOUT_ROUTING_SKILLS,
41-
CLOSEOUT_MARKERS, CLOSEOUT_REQUIRED_PHRASES, CLOSEOUT_FORBIDDEN_PHRASES) into
42-
an rg-based shell check, since this port has no Python runtime validator.
55+
- Files changed this session: `.opencode/skills/handoff/SKILL.md` (Phase 4
56+
rewrite), `.opencode/VERSION` (`0.5.0``0.5.1`), `CHANGELOG.md`
57+
(v0.5.1 section), `README.md` (version badge + two text refs),
58+
`production/test-evidence/latest.md` (this file), and the migration plan at
59+
`.opencode/plans/migrate-codex-v0.6.1.md`.
60+
- OpenCode-local rules preserved through the port: hesitate before pushing
61+
`main`/`master`/`develop`; runtime push failures (auth/network/rejected)
62+
remain non-fatal.
63+
- Codex-platform internals from the v0.6.0/v0.6.1 releases (`.codex/*`
64+
validators, `validate_smoke.py`, role-activation fixtures, CCGS frontmatter)
65+
intentionally not ported — out of scope per the established bridging policy.

0 commit comments

Comments
 (0)