Skip to content

ci: gate releases on CI, and cover the checkpoint CI could not see - #127

Merged
solderzzc merged 1 commit into
mainfrom
claude/gate-release-on-ci
Aug 8, 2026
Merged

solderzzc merged 1 commit into
mainfrom
claude/gate-release-on-ci

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Two changes. The second exists because, while verifying the first, I found that gating alone would not have prevented the last bad release.

1. Releases now wait for CI

release.yml triggered directly on push, so it built and published concurrently with CI Pipeline and did not depend on it — a red pipeline still shipped a binary. Just merging #125 demonstrated it: the release finished and published while main's CI was still queued.

  • Trigger is now workflow_run on CI Pipeline → completed, with the job guarded on conclusion == 'success'.
  • Checkout pins workflow_run.head_sha, so the release builds exactly the commit CI validated rather than a branch tip that may already have moved on.
  • workflow_run carries no path filter, so the old paths: list is reimplemented as an explicit diff against the previous release tag — a docs-only commit no longer publishes. Submodule pointer moves count as source: the Gemma 4 fix reached users through a bump with no .swift diff at all, so omitting that would have silently stopped shipping submodule fixes.
  • Manual workflow_dispatch is unchanged and still bypasses the gate.

One property worth knowing: CI Pipeline concludes success when only the opencode job fails, since that job is continue-on-error. Verified against 32987d8 — opencode failed, workflow concluded success. So the known runner OOM does not block releases.

2. The gate would not have caught b674 — so this adds the coverage that does

I replayed the gate against real history before claiming it worked:

commit CI conclusion would gate have blocked?
32987d8 (built b674) success no
8aad37d failure yes

b674 shipped a Gemma 4 regression while CI was green, because no job loads gemma-4-e2b-it-4bit. That checkpoint ships k_proj/v_proj for its KV-shared layers while e4b omits them, so a change validated against e4b broke e2b entirely and nothing noticed.

So tests/test-server.sh now takes its model from SWIFTLM_TEST_MODEL, and the matrix gains a second server entry running the same 74-assertion smoke test against e2b. Cache keys are per-entry so the two server jobs don't collide.

Verification

  • 74/74 pass against e2b locally with the fix in place.
  • Verified red: reverting the fix makes the job fail immediately with the production error — Unable to set language_model.model.layers.15.self_attn.v_proj … none not compatible with […].
  • Source-change detector dry-run: swift-only → release, submodule-only → release, workflow → release, mixed → release, docs-only → skip, ci-only → skip. Replayed against four real commits.

Caveat on this PR's own CI

Because the trigger changes, this PR's release behaviour cannot be fully exercised until it is on main — workflow_run fires from the version of the workflow on the default branch. The first merge after this lands is the real test, and workflow_dispatch remains as the escape hatch if anything misbehaves.

🤖 Generated with Claude Code

Two changes, because gating alone would not have prevented the last bad
release.

**Gating.** release.yml triggered directly on push, so it built and published
concurrently with CI Pipeline and did not depend on it — a red pipeline still
shipped a binary. It now triggers on workflow_run after CI Pipeline completes,
and the job requires conclusion == success. The checkout pins
workflow_run.head_sha so the release builds exactly the commit CI validated
rather than a branch tip that may have moved.

workflow_run carries no path filter, so the old `paths:` list is reimplemented
as an explicit check against the previous release tag; a docs-only commit no
longer publishes. Submodule pointer moves count as source changes — the
Gemma 4 fix reached users through a bump with no .swift diff at all.

Manual dispatch is unchanged and still bypasses the gate.

**Coverage.** Replaying the gate against real history showed it would NOT have
blocked b674: CI was green on that commit. The Gemma 4 regression escaped
because no job loads gemma-4-e2b-it-4bit, which ships k_proj/v_proj for its
KV-shared layers while e4b omits them. So test-server.sh takes the model from
SWIFTLM_TEST_MODEL, and the matrix gains a second server entry running the
same 74-assertion smoke test against e2b.

Verified: 74/74 pass against e2b with the fix; reverting the fix fails the job
immediately with the production error, "Unable to set
language_model.model.layers.15.self_attn.v_proj". Also dry-ran the
source-change detector against six change shapes and four real commits.

Co-Authored-By: Claude Opus 5 <[email protected]>
@solderzzc
solderzzc merged commit f729ece into main Aug 8, 2026
11 of 12 checks passed
@solderzzc
solderzzc deleted the claude/gate-release-on-ci branch August 8, 2026 00:12
solderzzc added a commit that referenced this pull request Aug 8, 2026
- release.yml's comment asserted the opposite of the new behaviour: it said
  opencode is continue-on-error so its failures do not block releases. This PR
  removed that waiver, and #127 gates releases on CI success, so an opencode
  failure now stops the release. That coupling is intentional but was
  documented nowhere else.
- The simulation omitted stream_options: {include_usage: true}, which
  opencode's networking layer injects into every streaming request. It makes
  SwiftLM append a terminal chunk with an empty `choices` array — exactly the
  shape a strict SSE client can trip on, and previously covered only by
  curl+grep, never by an SDK parser and never alongside tools.
- A run where the model emits no tool call still passes, by design, so the job
  cannot flake. But it could then go quietly vacuous — green forever while the
  reassembly path stops being exercised — so that case now prints a loud
  WARNING.

Local run: 2 passed, 0 failed, 31 chunks, finish_reason=tool_calls,
tool_calls=1 with the usage chunk present.

Co-Authored-By: Claude Opus 5 <[email protected]>
solderzzc added a commit that referenced this pull request Aug 8, 2026
* test: simulate opencode's request instead of running its CLI

The opencode job has been red on every PR for weeks. Its Test 2 installed
opencode-ai from npm and ran `npx opencode run`, which the runner OOM-kills
(`Killed: 9`) — after the server had already answered correctly. The failure
said nothing about SwiftLM, and a permanently red job that nobody can act on
is a job people stop reading.

What is worth testing is the request shape opencode sends, so Test 2 now
issues it directly through the OpenAI SDK: a coding-agent system prompt, a
tool catalogue, streaming on. It then reassembles the response the way a
strict client must — tool-call deltas keyed by index — and asserts the stream
parses, reports a finish_reason, every tool call carries a function name, and
the accumulated arguments are valid JSON. No npm, no CLI, no OOM.

Because the job can now pass, it is no longer continue-on-error: a failure
here means SwiftLM misbehaved and should block the merge.

Local run against the same model CI uses: 2 passed, 0 failed —
28 chunks, finish_reason=tool_calls, tool_calls=1, so the tool-call
reassembly path is genuinely exercised rather than skipped.

Refs #128.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test: address review findings on the opencode simulation

- release.yml's comment asserted the opposite of the new behaviour: it said
  opencode is continue-on-error so its failures do not block releases. This PR
  removed that waiver, and #127 gates releases on CI success, so an opencode
  failure now stops the release. That coupling is intentional but was
  documented nowhere else.
- The simulation omitted stream_options: {include_usage: true}, which
  opencode's networking layer injects into every streaming request. It makes
  SwiftLM append a terminal chunk with an empty `choices` array — exactly the
  shape a strict SSE client can trip on, and previously covered only by
  curl+grep, never by an SDK parser and never alongside tools.
- A run where the model emits no tool call still passes, by design, so the job
  cannot flake. But it could then go quietly vacuous — green forever while the
  reassembly path stops being exercised — so that case now prints a loud
  WARNING.

Local run: 2 passed, 0 failed, 31 chunks, finish_reason=tool_calls,
tool_calls=1 with the usage chunk present.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant