Skip to content
Closed

Dev #2720

Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
56250fd
fix(release): refuse re-dispatch of published versions + delete dead …
automagik-genie Jul 27, 2026
159bce4
fix(ci): check-action-pins matches quoted uses scalars, anchors SHA (…
automagik-genie Jul 27, 2026
8c4142e
feat(hooks): mechanical git-freeze guard for shared-workspace subagen…
automagik-genie Jul 27, 2026
ec3c0a6
fix(ci): anchor check-action-pins scalar match to the uses: remainder
automagik-genie Jul 27, 2026
7b1fc74
Merge pull request #2715 from automagik-dev/fix/action-pins-quoted-sc…
automagik-genie Jul 27, 2026
79057c7
chore(version): bump to 5.260727.14 [auto-version]
github-actions[bot] Jul 27, 2026
227e90d
fix(hooks): git-freeze guard misread subshells and stopped at the fir…
automagik-genie Jul 27, 2026
b3cd5b1
Merge pull request #2718 from automagik-dev/feat/git-freeze-hook
automagik-genie Jul 27, 2026
f8aca50
chore(version): bump to 5.260727.15 [auto-version]
github-actions[bot] Jul 27, 2026
73007d1
Merge pull request #2717 from automagik-dev/fix/release-publish-harde…
namastex888 Jul 27, 2026
95a1c1b
chore(version): bump to 5.260727.16 [auto-version]
github-actions[bot] Jul 27, 2026
a51c3f0
feat(release)!: remove the homolog channel (stable+dev only)
automagik-genie Jul 27, 2026
9dce641
test(release): verifier LOWs — stale asset comment, no-homolog ratche…
automagik-genie Jul 27, 2026
d8de6dd
Merge pull request #2721 from automagik-dev/feat/remove-homolog-channel
automagik-genie Jul 27, 2026
66397cb
chore(version): bump to 5.260727.17 [auto-version]
github-actions[bot] Jul 27, 2026
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
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"plugins": [
{
"name": "genie",
"version": "5.260727.12",
"version": "5.260727.15",
"source": "./plugins/genie",
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
}
Expand Down
61 changes: 50 additions & 11 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ jobs:
name: Admit trusted release orchestrator
runs-on: ubuntu-latest
timeout-minutes: 2
permissions: {}
permissions:
# Read-only, and only so the replay guard below can ask whether the tag
# already carries a published release. contents:write still starts at the
# publish job: nothing may mutate the repository before the caller is
# proven, and the guard runs after the binding step for the same reason.
contents: read
steps:
- name: Bind caller workflow and control commit
shell: bash
Expand Down Expand Up @@ -138,6 +143,43 @@ jobs:
esac
echo "Trusted release caller admitted at ${CALLER_SHA}"

- name: Refuse re-dispatch of an already published release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RELEASE_REPOSITORY: ${{ github.repository }}
INPUT_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
# A published (non-draft) release is immutable, and this pipeline is
# no longer able to replay one: reconcile-release-assets.sh expects
# the current 20/28/36-asset delivery fanout while every pre-fanout
# release carries 12 that can never be extended, and
# reconcile-channel-manifests.sh now derives a deterministic
# midnight-UTC released_at that no longer cmp-matches the wall-clock
# timestamps already committed to main. Both failures land AFTER the
# release is published and locked, so refuse the run here instead.
# Always allocate a fresh version (version.yml allocates max-plus-one
# and pushes a fresh tag). See automagik-dev/genie#2674.
# Drafts stay admissible on purpose: an interrupted run must still be
# able to finish the release it already opened.
RELEASE_JSON="$(mktemp)"
RELEASE_ERROR="$(mktemp)"
if gh api "repos/${RELEASE_REPOSITORY}/releases/tags/v${INPUT_VERSION}" \
>"$RELEASE_JSON" 2>"$RELEASE_ERROR"; then
if [[ "$(jq -r '.draft' "$RELEASE_JSON")" != true ]]; then
echo "::error ::release-replay.published v${INPUT_VERSION} already has a published GitHub Release — published releases are non-replayable (immutable asset inventory + deterministic released_at); allocate a fresh version instead. See automagik-dev/genie#2674"
exit 1
fi
echo "v${INPUT_VERSION} exists only as a draft release; admitting so the interrupted publish can complete"
elif grep -q 'HTTP 404' "$RELEASE_ERROR"; then
echo "v${INPUT_VERSION} has no GitHub Release yet"
else
cat "$RELEASE_ERROR" >&2
echo "::error ::release-replay.unknown could not determine whether v${INPUT_VERSION} already has a published release; failing closed. See automagik-dev/genie#2674"
exit 1
fi

prepare-delivery-evidence:
name: Build canonical delivery descriptors
needs: admit
Expand Down Expand Up @@ -1012,12 +1054,15 @@ jobs:
name: delivery-candidate-manifests
path: ${{ runner.temp }}/candidate-manifests

- name: Resolve version + channel + asset inventory
# Channel is NOT resolved here: admit already rejects an empty/unknown
# channel, and finalize/manifests read inputs.channel raw. A local
# default would only let publish upload a stable-sized inventory that
# finalize then aborts on, leaving a published-but-unfinalized release.
- name: Resolve version + asset inventory
id: meta
shell: bash
env:
INPUT_VERSION: ${{ inputs.version }}
INPUT_CHANNEL: ${{ inputs.channel }}
run: |
set -euo pipefail
cd dist
Expand All @@ -1041,14 +1086,8 @@ jobs:
echo "::error::workflow_dispatch input version='${INPUT_VERSION}' does not match upstream artifact version='${VERSION}'"
exit 1
fi
# Channel: workflow_dispatch picks; workflow_run defaults to stable.
CHANNEL="${INPUT_CHANNEL:-}"
if [[ -z "${CHANNEL}" ]]; then
CHANNEL="stable"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "channel=${CHANNEL}" >> "$GITHUB_OUTPUT"
echo "Resolved: VERSION=${VERSION} CHANNEL=${CHANNEL}"
echo "Resolved: VERSION=${VERSION}"
echo "Tarballs: ${#TARBALLS[@]}"
echo "=== dist/ exact inventory: 12 release assets plus selected-channel delivery evidence fanout ==="
ls -la
Expand All @@ -1065,7 +1104,7 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.meta.outputs.version }}
CHANNEL: ${{ steps.meta.outputs.channel }}
CHANNEL: ${{ inputs.channel }}
DRAFT: ${{ inputs.draft }}
RELEASE_REPOSITORY: ${{ github.repository }}
CANDIDATE_MANIFEST_DIR: ${{ runner.temp }}/candidate-manifests
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@automagik/genie",

"version": "5.260727.12",
"version": "5.260727.15",
"description": "Collaborative terminal toolkit for human + AI workflows. NOTE: npm distribution discontinued 2026-05-09 — install via `curl -fsSL https://raw.githubusercontent.com/automagik-dev/genie/main/install.sh | bash` (cosign + SLSA verified). See https://automagik.dev/genie/release-process",

"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie",
"version": "5.260727.12",
"version": "5.260727.15",
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.",
"author": {
"name": "Namastex Labs"
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie",
"version": "5.260727.12",
"version": "5.260727.15",
"description": "Plan, execute, review, and ship software with Genie workflows in Codex.",
"author": {
"name": "Namastex Labs",
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie-plugin",
"version": "5.260727.12",
"version": "5.260727.15",
"private": true,
"description": "Runtime dependencies for genie bundled CLIs",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion plugins/hermes-genie/plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: genie
version: 5.260727.12
version: 5.260727.15
description: "Native Hermes surface for Genie orchestration: read-only status plus work-plan and review-plan gap tools that the MCP board surface does not cover, hooks, commands, and a thin cockpit skill. Board/task truth comes from the genie MCP tools."
provides_tools:
# Default surface: exactly the three gap tools the MCP board surface does not cover.
Expand Down
81 changes: 70 additions & 11 deletions scripts/check-action-pins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,90 @@
# no repository, and it took down three release-publish jobs the first time
# they ever executed.
#
# The matcher reads the scalar that follows the FIRST `uses:` key on the line,
# recognises all three YAML spellings (bare, 'single-quoted', "double-quoted"),
# and requires the ref to span the WHOLE scalar — an action ending in 40 hex
# chars followed by trailing garbage (`@<sha>oops`) is not a pin and must not be
# silently accepted (#2669).
#
# Usage: bash scripts/check-action-pins.sh (needs gh auth; network required)
# bash scripts/check-action-pins.sh --extract < lines (offline; prints
# the `owner/repo@sha` pin for every matching line, nothing for the rest)
set -euo pipefail

# YAML scalar spellings of the `uses:` value, matched against the text AFTER the
# key. Kept in variables because bash 3.2 treats quoted regex fragments as
# literals inside [[ =~ ]]. All three are anchored so a later `uses:` inside a
# trailing comment cannot shadow the real scalar. A bare scalar also ends at `,`
# and `}` so flow mappings (`- { uses: owner/repo@<sha>, name: X }`) extract.
uses_dquoted_re='^"([^"]*)"'
uses_squoted_re="^'([^']*)'"
uses_bare_re='^([^][:space:]#,}]+)'
# Anchored: the pin must be the ENTIRE scalar and end in exactly 40 hex chars.
pin_re='^([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)(/[A-Za-z0-9./_-]+)?@([0-9a-f]{40})$'

# extract_pin <line> — echo `owner/repo@sha` for a SHA-pinned `uses:` line.
# Returns 1 (printing nothing) for local (`./…`), docker://, tag/branch refs and
# for a 40-hex run that does not terminate the scalar.
extract_pin() {
local line="$1" rest scalar
line="${line%$'\r'}"
case $line in *uses:*) rest="${line#*uses:}" ;; *) return 1 ;; esac
rest="${rest#"${rest%%[![:space:]]*}"}"
if [[ $rest =~ $uses_dquoted_re ]]; then
scalar="${BASH_REMATCH[1]}"
elif [[ $rest =~ $uses_squoted_re ]]; then
scalar="${BASH_REMATCH[1]}"
elif [[ $rest =~ $uses_bare_re ]]; then
scalar="${BASH_REMATCH[1]}"
else
return 1
fi
[[ $scalar =~ $pin_re ]] || return 1
# BASH_REMATCH[2] is the optional subpath (`owner/repo/sub@sha`); the commit
# lives in the parent repository, so the API target and the dedupe key drop it.
printf '%s@%s\n' "${BASH_REMATCH[1]}" "${BASH_REMATCH[3]}"
}

if [[ "${1:-}" == "--extract" ]]; then
while IFS= read -r line || [[ -n "$line" ]]; do
extract_pin "$line" || true
done
exit 0
fi

# Workflows, the repo's own composite actions, and any other action manifest
# tracked anywhere in the tree (#2669). Overlap is harmless — pins are deduped.
scan_targets() {
printf '%s\n' .github/workflows .github/actions
git ls-files -- '*action.yml' '*action.yaml' 2>/dev/null || true
}

targets=()
while IFS= read -r target; do
if [[ -n "$target" ]]; then targets+=("$target"); fi
done < <(scan_targets)

status=0
declare -a seen=()

while IFS= read -r line; do
file="${line%%:*}"
rest="${line#*:}"
[[ "$rest" =~ uses:[[:space:]]*([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)(/[A-Za-z0-9./_-]+)?@([0-9a-f]{40}) ]] || continue
repo="${BASH_REMATCH[1]}"
sha="${BASH_REMATCH[3]}"
key="${repo}@${sha}"
for s in ${seen[@]+"${seen[@]}"}; do [[ "$s" == "$key" ]] && continue 2; done
seen+=("$key")
pin="$(extract_pin "$line" || true)"
[[ -n "$pin" ]] || continue
repo="${pin%@*}"
sha="${pin##*@}"
for s in ${seen[@]+"${seen[@]}"}; do [[ "$s" == "$pin" ]] && continue 2; done
seen+=("$pin")
if gh api "repos/${repo}/commits/${sha}" --jq .sha >/dev/null 2>&1; then
printf ' ok %s\n' "$key"
printf ' ok %s\n' "$pin"
else
printf ' UNRESOLVABLE %s (%s)\n' "$key" "$file" >&2
printf ' UNRESOLVABLE %s (%s)\n' "$pin" "$file" >&2
status=1
fi
done < <(grep -rn "uses:" .github/workflows .github/actions 2>/dev/null || true)
done < <(grep -rn "uses:" ${targets[@]+"${targets[@]}"} 2>/dev/null || true)

if [[ "$status" -ne 0 ]]; then
echo "::error ::one or more actions are pinned to a SHA that does not exist" >&2
fi
exit "$status"

32 changes: 31 additions & 1 deletion scripts/reconcile-release-assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface FakeState {
prerelease?: boolean;
assets: Record<string, string>;
calls?: Array<{ tool: string; args: string[] }>;
attestationBatchSizes?: number[];
failOn?: string;
controlSha?: string;
secondControlSha?: string;
Expand Down Expand Up @@ -168,7 +169,24 @@ if (args[0] === 'attestation' && args[1] === 'verify') {
},
},
};
console.log(JSON.stringify([{ verificationResult: { statement } }]));
// A published tarball carries TWO attestations for the same digest: GitHub's
// own in-toto immutable-release attestation (minted when the release is
// locked) and ours. The attestations API returns both, GitHub's first.
// Production must select by predicate type — never by position or by count.
const immutableRelease = {
verificationResult: {
statement: {
_type: 'https://in-toto.io/Statement/v1',
predicateType: 'https://in-toto.io/attestation/release/v0.2',
subject: [{ name: 'genie-${VERSION}', digest: { sha256: 'e'.repeat(64) } }],
predicate: { purl: 'pkg:github/automagik-dev/genie@v${VERSION}', releaseId: 4242 },
},
},
};
const attestations = [immutableRelease, { verificationResult: { statement } }];
state.attestationBatchSizes ??= [];
state.attestationBatchSizes.push(attestations.length);
console.log(JSON.stringify(attestations));
save(); process.exit(0);
}
save(); process.exit(2);
Expand Down Expand Up @@ -377,6 +395,18 @@ describe('exact GitHub release asset reconciliation', () => {
}
});

test('selects our release predicate when GitHub also attests the immutable release', () => {
const publishedAssets = localAssets('published');
const { result, state } = run({ draft: false, assets: publishedAssets });
expect(result.exitCode).toBe(0);
expect(state.assets).toEqual(publishedAssets);
expect(calls(state, 'gh', 'release upload')).toHaveLength(0);
// 4 platforms x 2 passes (unfiltered, then certificate-filtered), each
// answered with GitHub's immutable-release attestation ahead of ours.
expect(state.attestationBatchSizes).toHaveLength(8);
expect(state.attestationBatchSizes?.every((size) => size === 2)).toBe(true);
});

test('never repairs a partial published release or accepts remote extras', () => {
const partial = run({ draft: false, prerelease: false, assets: { [NAMES[0]]: localAssets()[NAMES[0]] } });
expect(partial.result.exitCode).toBe(3);
Expand Down
60 changes: 59 additions & 1 deletion scripts/release-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ describe('Group E release and documentation contracts', () => {
test('privileged reusable workflows admit only the exact channel-specific main caller', () => {
for (const path of ['.github/workflows/sign-attest.yml', '.github/workflows/release-publish.yml']) {
const workflow = read(path);
expect(workflow).toContain('permissions: {}');
expect(workflow).toContain(
'EXPECTED_STABLE_CALLER: automagik-dev/genie/.github/workflows/release.yml@refs/heads/main',
);
Expand All @@ -96,6 +95,65 @@ describe('Group E release and documentation contracts', () => {
expect(workflow).toContain('"$CALLER_WORKFLOW_SHA" != "$CALLER_SHA"');
expect(workflow).toContain('needs: admit');
}

// sign-attest's admit needs no token at all. release-publish's admit holds
// exactly contents:read — the least that lets the replay guard ask whether
// the tag already carries a published release — and never write, so an
// unproven caller still cannot mutate anything.
expect(read('.github/workflows/sign-attest.yml')).toContain('permissions: {}');
const publishAdmit =
read('.github/workflows/release-publish.yml')
.split('\n admit:')[1]
?.split('\n prepare-delivery-evidence:')[0] ?? '';
expect(publishAdmit).toContain('permissions:\n # Read-only');
expect(publishAdmit).toContain('contents: read');
expect(publishAdmit).not.toContain('contents: write');
expect(publishAdmit).not.toContain('id-token:');
});

// A published release is immutable and this pipeline can no longer replay
// one (asset fanout grew past the 12 assets pre-fanout releases carry, and
// released_at became deterministic), so re-dispatching a published version
// fails only AFTER the release is locked. Admit must refuse it up front,
// while still admitting a draft so an interrupted run can finish. #2674.
test('admit refuses re-dispatch of a version that already has a published release', () => {
const admit =
read('.github/workflows/release-publish.yml')
.split('\n admit:')[1]
?.split('\n prepare-delivery-evidence:')[0] ?? '';
expect(admit).toContain('name: Refuse re-dispatch of an already published release');
expect(admit).toContain('GH_TOKEN: ${{ github.token }}');
expect(admit).toContain('gh api "repos/${RELEASE_REPOSITORY}/releases/tags/v${INPUT_VERSION}"');
// non-draft is the refusal, and the refusal cites the rule + issue
expect(admit).toContain(`jq -r '.draft'`);
expect(admit).toContain('release-replay.published');
expect(admit).toContain('allocate a fresh version');
expect(admit).toContain('automagik-dev/genie#2674');
// ambiguous API failures fail closed rather than silently admitting
expect(admit).toContain('release-replay.unknown');
expect(admit).toContain(`grep -q 'HTTP 404'`);
// the guard runs only after the caller is proven
expect(admit.indexOf('name: Refuse re-dispatch of an already published release')).toBeGreaterThan(
admit.indexOf('name: Bind caller workflow and control commit'),
);
});

// The publish job used to keep its own CHANNEL="${INPUT_CHANNEL:-}" default
// to stable. admit already rejects an empty/unknown channel, so it was dead;
// had it ever fired, publish would have uploaded a 36-asset stable inventory
// that finalize aborts on, leaving a published-but-unfinalized release. #2675
test('publish reads the channel input directly instead of defaulting it', () => {
const workflow = read('.github/workflows/release-publish.yml');
const publishJob = workflow.split('\n publish:')[1]?.split('\n manifests:')[0] ?? '';
expect(publishJob).not.toContain('INPUT_CHANNEL');
expect(publishJob).not.toContain('CHANNEL="stable"');
expect(publishJob).not.toContain('steps.meta.outputs.channel');
expect(publishJob).toContain('CHANNEL: ${{ inputs.channel }}');
expect(workflow).not.toContain('channel=${CHANNEL}');
const manifestsJob = workflow.split('\n manifests:')[1]?.split('\n finalize:')[0] ?? '';
const finalizeJob = workflow.split('\n finalize:')[1] ?? '';
expect(manifestsJob).toContain('CHANNEL: ${{ inputs.channel }}');
expect(finalizeJob).toContain('CHANNEL: ${{ inputs.channel }}');
});

test('release stages consume only artifacts from their current orchestrator run', () => {
Expand Down
Loading
Loading