@@ -29,49 +29,64 @@ pair for `$resume-from-handoff`.
2929 amend workarounds.
3030- Use evidence from the current turn for every status, count, and verification
3131 claim.
32- - If a command fails, halt the current phase and report the exact failure.
32+ - If a command fails, use only the permission fallback or DNS retry declared
33+ below. If that exact fallback also fails, halt the current phase and report
34+ the exact final failure.
3335
34- ## Git Metadata Capability Gate
36+ ## Git And Remote Capability Gate
3537
3638Before Phase 0, resolve the repository's actual Git metadata directory:
3739
3840``` bash
3941git rev-parse --absolute-git-dir
4042```
4143
42- Run ` test -w '<absolute-git-dir>' ` against the exact returned path, shell-quoted.
43- Do not request escalation for this check. The ` game_studios ` permission profile
44- must make Git metadata writable. The same profile preserves normal workspace
45- writes to ` .agents/ ` and ` .codex/ ` so CCGS's own maintenance workflows remain
46- usable; only the declared secret paths stay denied.
47-
48- If the lookup fails or the check reports the Git directory is not writable,
49- halt before Phase 0. Report the exact path and result as a permission-profile
50- configuration mismatch. Direct the user to install the current CCGS permission
51- profile and start a new session so that profile becomes active. Do not begin the
52- review gate, rotate continuity files, run ` chmod ` , delete lock files, or try an
53- indirect command workaround. Do not tell the user to switch ` /permissions `
54- modes: approval routing cannot repair a filesystem rule already resolved for the
55- session.
56-
57- ## Push Approval Capability Gate
58-
59- Before Phase 0, inspect the active session permission instructions. The active
60- approval policy must permit sandbox escalation because the ` game_studios `
61- profile intentionally keeps outbound network access restricted until the
62- authorized handoff push. The installed project config declares
63- ` approval_policy = "on-request" ` ; a session started before that config became
64- active can still report ` approval_policy = "never" ` and explicitly forbid
65- ` sandbox_permissions ` .
66-
67- If the active policy is ` never ` , the permission instructions forbid
68- ` sandbox_permissions ` , or the command tool cannot request escalation, halt
69- before Phase 0. Report a stale-session approval-policy configuration mismatch
70- and direct the user to start one new session with the installed project config.
71- Do not begin the review gate, update continuity files, stage, commit, issue an
72- un-escalated ` git push ` , or ask the user to switch ` /permissions ` modes. A new
73- session is required only to load the corrected project policy; routine handoffs
74- must not require manual permission-mode switching.
44+ Run ` test -w '<absolute-git-dir>' ` against the exact returned path, shell-quoted,
45+ using the user's active session permissions. If it is not writable because of
46+ the sandbox and scoped escalation is available, repeat that exact check once
47+ with ` sandbox_permissions ` set to ` "require_escalated" ` . If the active context
48+ already reports the Git directory as read-only, request that scoped escalation
49+ on the first attempt. This capability check must not run ` chmod ` , create a probe
50+ file, delete lock files, or change command shape.
51+
52+ Also resolve the current branch, configured upstream, and exact push URL before
53+ Phase 0:
54+
55+ ``` bash
56+ git rev-parse --abbrev-ref HEAD
57+ git rev-parse --abbrev-ref --symbolic-full-name ' @{u}'
58+ git remote get-url --push < upstream-remote>
59+ git remote get-url --push origin
60+ ```
61+
62+ Treat a non-zero upstream lookup as the expected no-upstream case. Use the
63+ upstream remote when present; otherwise use ` origin ` . Halt if the required
64+ remote or push URL is missing. Never display embedded credentials; redact them
65+ if the configured URL contains any.
66+
67+ Test the exact destination before review or continuity writes:
68+
69+ ``` bash
70+ git ls-remote --heads ' <verified-push-url>' ' refs/heads/<current-branch>'
71+ ```
72+
73+ An exit code of zero with no matching ref is valid for a new remote branch. Use
74+ the user's active session permissions. If the active context explicitly reports
75+ network access as unavailable, request scoped escalation on the first attempt
76+ with ` prefix_rule ` set to ` ["git", "ls-remote"] ` ; otherwise run normally first.
77+ If that normal attempt fails solely because sandboxed network access is
78+ unavailable, repeat the exact command once with ` sandbox_permissions ` set to
79+ ` "require_escalated" ` .
80+ If the network-capable attempt returns the exact pre-contact DNS error
81+ ` Could not resolve host ` , retry that same command once with the same permission
82+ mode. Do not retry authentication, authorization, transport, or other errors.
83+
84+ If the Git metadata check or remote check still fails, halt before Phase 0 and
85+ report the exact path, destination, command result, and permission fallback
86+ attempted. Do not begin the review gate or rotate continuity files. The shipped
87+ CCGS config selects the complete ` game_studios ` profile but does not override
88+ the user's approval policy. The skill must not instruct the user to switch
89+ ` /permissions ` modes.
7590
7691## Phase 0: Review Gate
7792
@@ -259,45 +274,47 @@ If there are no relevant uncommitted changes, skip the commit and say why.
259274
260275Otherwise stage only the relevant paths by name. Avoid broad staging unless the
261276user explicitly asked for it. ` $handoff ` invocation is commit authorization for
262- the relevant handoff work. Run staging without requesting escalation; the
263- active ` game_studios ` profile grants Git metadata writes. If staging cannot
264- write the Git index, halt Phase 3 and report the exact failure without retrying
265- through a different command shape.
277+ the relevant handoff work. Run staging using the user's active session
278+ permissions. If it fails solely because the sandbox denies Git metadata writes,
279+ repeat the exact ` git add ` command once with ` sandbox_permissions ` set to
280+ ` "require_escalated" ` and ` prefix_rule ` set to ` ["git", "add"] ` . Do not broaden
281+ the path set or use a different staging command.
266282
267283Before committing, verify:
268284
269285``` bash
270286git diff --cached --name-status
271287```
272288
273- Commit with the standard handoff subject without requesting escalation. Include
274- a Codex co-author trailer only if that is normal for this repo. If the commit
275- cannot write Git metadata, halt Phase 3 and report the exact failure without
276- retrying through a different command shape.
289+ Commit with the standard handoff subject using the active session permissions.
290+ If it fails solely because the sandbox denies Git metadata writes, repeat that
291+ exact ` git commit ` command once with ` sandbox_permissions ` set to
292+ ` "require_escalated" ` and ` prefix_rule ` set to ` ["git", "commit"] ` . Include a
293+ Codex co-author trailer only if that is normal for this repo. Halt on any other
294+ failure or if the exact permission fallback fails.
277295
278296Never use ` --no-verify ` . Never amend as a workaround for a failed hook.
279297
280298## Phase 4: Push Handoff
281299
282- Determine the branch and configured upstream:
300+ Recheck the branch and configured upstream:
283301
284302``` bash
285303git rev-parse --abbrev-ref HEAD
286304git rev-parse --abbrev-ref --symbolic-full-name ' @{u}'
287305```
288306
289307Treat a non-zero upstream lookup as the expected no-upstream case, not as a
290- Phase failure. Do not substitute a different branch. If an upstream exists,
291- derive its remote name from the returned ` <remote>/<branch> ` value and verify
292- that remote's push URL. If no upstream exists, verify ` origin ` because it is the
293- only remote authorized for the setup push:
308+ Phase failure. Do not substitute a different branch. Verify that the branch,
309+ upstream state, remote, and push URL still match the destination that passed the
310+ preflight. If any changed, halt instead of pushing to an untested destination:
294311
295312``` bash
296313git remote get-url --push < upstream-remote>
297314git remote get-url --push origin
298315```
299316
300- Run only the command that matches the detected upstream state. Halt if the
317+ Run only the lookup that matches the detected upstream state. Halt if the
301318required push remote is missing.
302319
303320Treat the resolved push URL, current branch/upstream, and explicit ` $handoff `
@@ -318,29 +335,32 @@ one of these command shapes:
318335- Existing upstream: ` git push ` .
319336- No upstream: ` git push -u origin <branch> ` .
320337
321- Request the required escalation with the scoped approval prefix
322- ` ["git", "push"] ` . The justification must state that this is the explicitly
323- authorized, non-force handoff push; name the verified push URL; and identify the
324- current branch/upstream. Do not claim an authenticated account or repository
325- permission unless it was actually verified. Explicit ` $handoff ` invocation is
326- normal push authorization for the standard handoff commit. Never force-push.
327-
328- The first and only push attempt must call the command tool directly with
329- ` sandbox_permissions ` set to ` "require_escalated" ` and ` prefix_rule ` set to
330- ` ["git", "push"] ` . Do not issue ` git push ` without escalation first and do not
331- run an un-escalated probe. If the tool surface rejects or omits the requested
332- escalation, treat that as a policy failure and do not let the command fall back
333- to the network-restricted sandbox.
338+ Use the user's active session permissions. If the active context explicitly
339+ reports network access as unavailable, request scoped escalation on the first
340+ push attempt with ` sandbox_permissions ` set to ` "require_escalated" ` and
341+ ` prefix_rule ` set to ` ["git", "push"] ` ; otherwise run the matching push command
342+ normally first. If that normal attempt fails solely because sandboxed network
343+ access is unavailable, repeat the exact push command once with the same scoped
344+ escalation. The justification must state that this is the explicitly authorized,
345+ non-force handoff push; name the verified push URL; and identify the current
346+ branch/upstream. Do not claim an authenticated account or repository permission
347+ unless it was actually verified. Explicit ` $handoff ` invocation is normal push
348+ authorization for the standard handoff commit. Never force-push.
349+
350+ If the network-capable push attempt returns the exact pre-contact DNS error
351+ ` Could not resolve host ` , retry that exact push command once with the same
352+ permission mode. This retry is safe because name resolution failed before the
353+ remote could be contacted. Do not retry authentication, authorization,
354+ transport, hook, or ambiguous failures, and never change the push command.
334355
335356The actual ` git push ` is the authoritative network and Git-authentication check.
336357If it fails, report Git's exact error and do not reinterpret a preceding GitHub
337358CLI result as proof of the cause.
338359
339360If policy or automatic approval review rejects the push, halt Phase 4. Report
340361the exact rejection and do not retry with another command shape, indirect
341- execution, or workaround. When the current Codex surface supports it, direct
342- the user to ` /approve ` and the denied action for the documented single-action
343- retry; otherwise ask the user to perform the push directly.
362+ execution, or workaround. Do not instruct the user to change the whole session's
363+ permission mode; report the denied scoped action instead.
344364
345365## Phase 5: Report And Stop
346366
0 commit comments