Skip to content

cicd: manual semantic versioning of agent - #12

Merged
mosteligible merged 3 commits into
mainfrom
cicd
Apr 10, 2026
Merged

mosteligible merged 3 commits into
mainfrom
cicd

Conversation

@mosteligible

@mosteligible mosteligible commented Apr 10, 2026 •

Copy link
Copy Markdown
Owner

Open with Devin

Summary by CodeRabbit

  • Refactor

    • Consolidated agent release steps into the Go module release flow with distinct prepare, build, and publish stages.
    • Added pipeline outputs summarizing planned release metadata and introduced conditional artifact handling per module.
  • Chores

    • Made version input optional with an override mechanism and added concurrency control for release runs.
    • Removed the previous standalone agent release workflow.

@coderabbitai

coderabbitai Bot commented Apr 10, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b81fe6c1-d33d-431c-af67-c568859ec217

📥 Commits

Reviewing files that changed from the base of the PR and between 4063541 and 1cd62a9.

📒 Files selected for processing (1)
  • .github/workflows/tag-go-module.yml

📝 Walkthrough

Walkthrough

Deletes the standalone release-agent.yml workflow and consolidates agent release logic into an expanded tag-go-module.yml that computes release metadata, optionally builds agent artifacts, and creates/publishes annotated git tags and GitHub Releases in a multi-job flow.

Changes

Cohort / File(s) Summary
Removed workflow
\.github/workflows/release-agent.yml
Deleted the dedicated agent release workflow that previously built linux/amd64 and linux/arm64 agent binaries, packaged them, and published GitHub Releases.
Consolidated workflow
\.github/workflows/tag-go-module.yml
Restructured into prepare → build_agent → publish jobs; changed workflow_dispatch input version → optional version_override; added concurrency keyed by inputs.module; prepare computes TARGET_SHA, finds previous module tags, and infers semantic bump; build_agent conditionally builds/uploads agent artifacts when module == agent; publish creates annotated git tag at TARGET_SHA and conditionally downloads artifacts and publishes a GitHub Release for the agent module.
Auth/trigger/flow adjustments
\.github/workflows/tag-go-module.yml (steps)
Removed dependency on separate release-agent.yml and prior RELEASE_TAG_TOKEN flow; tag creation is anchored to TARGET_SHA and release publishing is conditional on module == agent.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant GH_Actions as "GitHub Actions\n(tag-go-module.yml)"
  participant Git as "Git Repo"
  participant Runner as "Build Runner"
  participant Artifacts as "Artifacts Storage"
  participant GH_Release as "GitHub Releases API"

  User->>GH_Actions: trigger (push/tag or workflow_dispatch)
  GH_Actions->>Git: determine TARGET_SHA / previous tag / semver bump
  GH_Actions->>Runner: start build_agent (only if module == agent)
  Runner->>Artifacts: upload tar.gz artifacts
  GH_Actions->>Git: create annotated tag at TARGET_SHA
  GH_Actions->>Artifacts: download artifacts (if agent)
  GH_Actions->>GH_Release: publish release and attach artifacts (conditional)
  GH_Release-->>User: release published
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I stitched two flows into one neat route,
Prepare, build, and publish — hop and tout.
No stray workflow left to roam,
Agent and module share a home.
Carrots and tarballs — release hops out! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: consolidating release workflows and enabling manual semantic versioning control for the agent module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cicd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines +281 to +282
git tag -a "$RELEASE_TAG" "$TARGET_SHA" -m "Release $RELEASE_TAG"
git push origin "refs/tags/$RELEASE_TAG"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Removal of RELEASE_TAG_TOKEN changes tag-push authentication behavior

The old workflow used secrets.RELEASE_TAG_TOKEN to push tags (.github/workflows/tag-go-module.yml:73-78 in the old version), which allowed the tag push to trigger other workflows (like release-agent.yml via the on: push: tags trigger). The new workflow pushes tags using only the default GITHUB_TOKEN (line 282). Since release-agent.yml is deleted and agent builds are now inline, this is intentional. However, if any other workflows or external integrations relied on tag-push events from this workflow, they would no longer be triggered because the default GITHUB_TOKEN does not trigger downstream on: push workflows. Worth confirming no other consumers exist.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +95 to +120
while IFS= read -r -d '' subject && IFS= read -r -d '' body; do
if [[ -z "$subject" && -z "$body" ]]; then
continue
fi

if [[ "$subject" =~ ^([a-z]+)(\([^)]+\))?(!)?:[[:space:]].+ ]]; then
commit_type="${BASH_REMATCH[1]}"
breaking_marker="${BASH_REMATCH[3]}"

if [[ -n "$breaking_marker" ]] || grep -Eq '(^|[[:space:]])BREAKING CHANGE:' <<<"$body"; then
major_bump=1
continue
fi

case "$commit_type" in
feat)
minor_bump=1
;;
fix|chore|refactor|perf|build|ci|docs|test|style)
patch_bump=1
;;
esac
elif grep -Eq '(^|[[:space:]])BREAKING CHANGE:' <<<"$body"; then
major_bump=1
fi
done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Commit-based version inference is module-agnostic

The conventional commit scanning (lines 95-120) examines all commits in the range regardless of which files they touch. This means a feat: commit that only changes pkg/ code would still bump the version when releasing the agent module. This is a design choice — the workflow doesn't filter commits by module path. For a monorepo with independent modules, this could lead to unnecessary version bumps. The version_override input provides a manual escape, but operators should be aware that inferred versions reflect all repo activity, not just module-specific changes.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/tag-go-module.yml:
- Around line 86-120: The commit-scan is currently repo-wide and must be limited
to the released module's path(s): introduce or use a variable holding the target
module path(s) (e.g., module_paths or RELEASE_MODULE_PATH) and pass those paths
to the git log invocation so the scan only considers commits that touch the
module; keep the rest of the logic (range_spec, previous_tag, bump flags,
subject/body parsing, BREAKING CHANGE detection) intact but change the git log
call in the while read loop to include the module paths (git log ...
"$range_spec" -- $module_paths) so unrelated commits in other modules do not
influence major/minor/patch bump decisions.
- Around line 95-120: The workflow currently parses git commit subjects via the
git log invocation (git log --first-parent --format='%s%x00%b%x00'
"$range_spec") and sets major_bump/minor_bump/patch_bump based on those
subjects, but the docs and error text incorrectly claim it infers from PR
titles; either (A) switch to fetching merged PR metadata (e.g., use gh pr
list/gh api to enumerate merged PRs and read PR titles/bodies instead of the git
log subject) so release inference uses PR titles, or (B) enforce/document
squash-only merges and update all help/error messages that reference PR titles
to explicitly say the workflow parses commit subjects (and adjust any guidance
around merge style), making changes around the git log invocation and the
messages that mention PR titles/formatting (references: the git log
--first-parent call and the major_bump/minor_bump/patch_bump logic and the
help/error text that tells users to "use a PR title like feat:, fix:, or
chore:").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c3c26092-12bd-43ac-82cc-70f7915ab5fc

📥 Commits

Reviewing files that changed from the base of the PR and between 40b834a and 4a61a42.

📒 Files selected for processing (2)
  • .github/workflows/release-agent.yml
  • .github/workflows/tag-go-module.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/release-agent.yml

Comment on lines +86 to +120
range_spec="$target_sha"
if [[ -n "$previous_tag" ]]; then
range_spec="${previous_tag}..${target_sha}"
fi

major_bump=0
minor_bump=0
patch_bump=0

while IFS= read -r -d '' subject && IFS= read -r -d '' body; do
if [[ -z "$subject" && -z "$body" ]]; then
continue
fi

if [[ "$subject" =~ ^([a-z]+)(\([^)]+\))?(!)?:[[:space:]].+ ]]; then
commit_type="${BASH_REMATCH[1]}"
breaking_marker="${BASH_REMATCH[3]}"

if [[ -n "$breaking_marker" ]] || grep -Eq '(^|[[:space:]])BREAKING CHANGE:' <<<"$body"; then
major_bump=1
continue
fi

case "$commit_type" in
feat)
minor_bump=1
;;
fix|chore|refactor|perf|build|ci|docs|test|style)
patch_bump=1
;;
esac
elif grep -Eq '(^|[[:space:]])BREAKING CHANGE:' <<<"$body"; then
major_bump=1
fi
done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Scope version inference to the selected module.

This git log scan is repo-wide, so an unrelated feat: or fix: elsewhere can bump and tag an unchanged module. In a multi-module repo, the bump calculation needs to be filtered to the released module’s path(s), not just the tag range.

Suggested fix
+          case "$MODULE" in
+            agent-proto) module_path="agent-proto" ;;
+            pkg) module_path="pkg" ;;
+            agent) module_path="agent" ;;
+            coderunner) module_path="coderunner" ;;
+          esac
+
           ...
-            done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec")
+            done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec" -- "$module_path")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tag-go-module.yml around lines 86 - 120, The commit-scan
is currently repo-wide and must be limited to the released module's path(s):
introduce or use a variable holding the target module path(s) (e.g.,
module_paths or RELEASE_MODULE_PATH) and pass those paths to the git log
invocation so the scan only considers commits that touch the module; keep the
rest of the logic (range_spec, previous_tag, bump flags, subject/body parsing,
BREAKING CHANGE detection) intact but change the git log call in the while read
loop to include the module paths (git log ... "$range_spec" -- $module_paths) so
unrelated commits in other modules do not influence major/minor/patch bump
decisions.

Comment thread .github/workflows/tag-go-module.yml Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.github/workflows/tag-go-module.yml (2)

16-17: ⚠️ Potential issue | 🟠 Major

The workflow still describes PR-title inference, but the code reads commit subjects.

The implementation only inspects git log subjects/bodies, so telling users this infers from “merged PR titles” is inaccurate and will break guidance for non-squash merges. Either fetch PR metadata from GitHub, or update the input/help text to explicitly say conventional commit subjects are parsed from git history.

Also applies to: 131-133

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tag-go-module.yml around lines 16 - 17, The workflow input
help text incorrectly says versions are inferred from "merged PR titles" while
the implementation parses git commit subjects via git log; update the input
description strings (the YAML "description" fields currently mentioning merged
PR titles — also duplicate instances around the other description block) to say
that conventional commit subjects from git history are parsed, or alternatively
implement PR metadata fetching from GitHub instead of relying on git log; ensure
you change both description occurrences so the docs match the actual behavior
(or replace the git-log parsing with a GitHub API/PullRequest lookup if you
choose the fetch approach).

86-121: ⚠️ Potential issue | 🟠 Major

Scope version inference to the selected module.

This scan is still repo-wide, so a feat: in coderunner can bump an agent release. Since this repo contains multiple Go modules, the git log call needs the selected module path(s) after -- so only relevant commits affect major_bump / minor_bump / patch_bump. Cross-file evidence: go.work:1-8.

Suggested fix
           else
             range_spec="$target_sha"
             if [[ -n "$previous_tag" ]]; then
               range_spec="${previous_tag}..${target_sha}"
             fi
+
+            case "$MODULE" in
+              agent-proto) module_path="agent-proto" ;;
+              pkg) module_path="pkg" ;;
+              agent) module_path="agent" ;;
+              coderunner) module_path="coderunner" ;;
+            esac
 
             major_bump=0
             minor_bump=0
             patch_bump=0
             conventional_commit_pattern='^([a-z]+)(\([^)]+\))?(!)?:[[:space:]].+'
@@
-            done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec")
+            done < <(git log --first-parent --format='%s%x00%b%x00' "$range_spec" -- "$module_path")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tag-go-module.yml around lines 86 - 121, The git log scan
is currently repo-wide and should be limited to the selected Go module(s):
modify the git log invocation inside the while loop producer (the command
reading into subject/body where range_spec is used) to append the module path(s)
after “--” so only commits under the module affect
major_bump/minor_bump/patch_bump; use the existing variable that holds the
module path(s) (or add one if missing) and pass it to git log --first-parent
--format=... "$range_spec" -- <module_path(s)> so scope is constrained to the
selected module(s).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/tag-go-module.yml:
- Around line 292-299: The workflow step that uses
softprops/action-gh-release@v2 to "Publish GitHub release" currently sets
make_latest: true which can wrongly mark older/overridden releases as Latest;
update that step to set make_latest: legacy instead (i.e., replace the
make_latest: true entry with make_latest: legacy in the Publish GitHub release
step) so GitHub's automatic logic determines the Latest tag and prevents forced
overrides.

---

Duplicate comments:
In @.github/workflows/tag-go-module.yml:
- Around line 16-17: The workflow input help text incorrectly says versions are
inferred from "merged PR titles" while the implementation parses git commit
subjects via git log; update the input description strings (the YAML
"description" fields currently mentioning merged PR titles — also duplicate
instances around the other description block) to say that conventional commit
subjects from git history are parsed, or alternatively implement PR metadata
fetching from GitHub instead of relying on git log; ensure you change both
description occurrences so the docs match the actual behavior (or replace the
git-log parsing with a GitHub API/PullRequest lookup if you choose the fetch
approach).
- Around line 86-121: The git log scan is currently repo-wide and should be
limited to the selected Go module(s): modify the git log invocation inside the
while loop producer (the command reading into subject/body where range_spec is
used) to append the module path(s) after “--” so only commits under the module
affect major_bump/minor_bump/patch_bump; use the existing variable that holds
the module path(s) (or add one if missing) and pass it to git log --first-parent
--format=... "$range_spec" -- <module_path(s)> so scope is constrained to the
selected module(s).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 083f6ccc-4389-4b8f-b0ee-8f5dce79c0cc

📥 Commits

Reviewing files that changed from the base of the PR and between 4a61a42 and 4063541.

📒 Files selected for processing (1)
  • .github/workflows/tag-go-module.yml

Comment on lines +292 to +299
- name: Publish GitHub release
if: needs.prepare.outputs.publish_agent_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.release_tag }}
name: ${{ needs.prepare.outputs.release_name }}
generate_release_notes: true
make_latest: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For softprops/action-gh-release@v2, what values does make_latestaccept, and doesmake_latest: true force a GitHub release to be marked as Latest even when the tag version is older than an existing release?

💡 Result:

Web search failed: Server error: no LLM provider could handle the message


🌐 Web query:

softprops action-gh-release make_latest parameter documentation

💡 Result:

make_latest (in softprops/action-gh-release) is an optional with: input that controls whether the created/updated release should be marked as the repository’s “Latest” release.

  • Type: String
  • Allowed values: true, false, or legacy
  • Notes: Drafts and prereleases cannot be set as latest. If you don’t provide it, the action uses the GitHub API default behavior. [1] (github.com)

Example:

- uses: softprops/action-gh-release@v2
  with:
    make_latest: "true"   # or "false" / "legacy"

Citations:


🌐 Web query:

GitHub API release latest semantics version comparison

💡 Result:

Web search failed: Server error: no LLM provider could handle the message


🌐 Web query:

GitHub API release "latest" marking semantic version ordering

💡 Result:

The GitHub API endpoint GET /repos/{owner}/{repo}/releases/latest returns the latest published full release (non-prerelease, non-draft). It selects the most recent one sorted by the created_at attribute, which is the date of the commit used for the release (not the draft or publish date). It does not use semantic versioning (semver) ordering for tag names by default. Prior to October 2022, the "latest" was determined by creation date, with semver used as a tie-breaker for same-date releases. Now, releases can explicitly mark themselves as "latest" via the make_latest parameter when creating/updating (true/false/legacy), overriding the automatic selection. In legacy mode (make_latest: "legacy"), it falls back to the old behavior: release creation date, then higher semantic version as tie-breaker. However, the /releases/latest endpoint itself always uses created_at sorting among eligible releases, regardless of explicit latest marking—the explicit flag primarily affects the UI "Latest" label and possibly other surfaces, but the API endpoint follows its documented sorting logic. To get the semver-highest release, fetch the list of releases (/repos/{owner}/{repo}/releases), filter non-prerelease/non-draft, parse tag_name as semver, and select the maximum.

Citations:


🌐 Web query:

softprops action-gh-release make_latest true vs legacy difference

💡 Result:

In the softprops/action-gh-release GitHub Action, the make_latest input controls whether a created or updated release is marked as the repository's "latest" release, passing directly to GitHub's Releases API. - make_latest: true: Forces the release to be set as latest (if not draft/prerelease). This explicitly marks it as latest regardless of other releases. - legacy (or unspecified): Uses GitHub's legacy logic to determine the latest release based on release creation date and higher semantic version (e.g., newer semver or creation timestamp). This matches pre-API change behavior where GitHub auto-selects based on those criteria. Key differences: - true guarantees this release is latest. - legacy defers to GitHub's automatic determination, which might not select this release if another has higher semver or earlier creation date. The input is a string accepting true, false, or legacy. If omitted, GitHub API defaults apply (typically true for new publishes, but action leaves undefined for compatibility). Drafts/prereleases cannot be latest. Example usage: - uses: softprops/action-gh-release@v2 with: make_latest: true vs make_latest: legacy Added in v2.0.1 (PR #304). Recent bug in v2.5.0 ignored false during draft finalization (fixed in later patches like 2.5.1+).

Citations:


🏁 Script executed:

cat -n .github/workflows/tag-go-module.yml | head -100

Repository: mosteligible/mcp-codemode

Length of output: 3735


🏁 Script executed:

sed -n '280,310p' .github/workflows/tag-go-module.yml

Repository: mosteligible/mcp-codemode

Length of output: 919


Unconditional make_latest: true can force older releases to Latest.

Because this workflow accepts arbitrary ref and version_override, make_latest: true forces a release to Latest regardless of version ordering. For example, releasing an old backport branch with an overridden version would immediately supersede a newer stable release as Latest, confusing users about which version to download. Use make_latest: legacy instead, which defers to GitHub's automatic logic (creation date with semantic version as tie-breaker), preventing forced overrides from misrepresenting the latest stable release.

Suggested fix
       - name: Publish GitHub release
         if: needs.prepare.outputs.publish_agent_release == 'true'
         uses: softprops/action-gh-release@v2
         with:
           tag_name: ${{ needs.prepare.outputs.release_tag }}
           name: ${{ needs.prepare.outputs.release_name }}
           generate_release_notes: true
-          make_latest: true
+          make_latest: legacy
           files: |
             release-assets/agent_linux_amd64.tar.gz
             release-assets/agent_linux_arm64.tar.gz
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Publish GitHub release
if: needs.prepare.outputs.publish_agent_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.release_tag }}
name: ${{ needs.prepare.outputs.release_name }}
generate_release_notes: true
make_latest: true
- name: Publish GitHub release
if: needs.prepare.outputs.publish_agent_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.release_tag }}
name: ${{ needs.prepare.outputs.release_name }}
generate_release_notes: true
make_latest: legacy
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tag-go-module.yml around lines 292 - 299, The workflow
step that uses softprops/action-gh-release@v2 to "Publish GitHub release"
currently sets make_latest: true which can wrongly mark older/overridden
releases as Latest; update that step to set make_latest: legacy instead (i.e.,
replace the make_latest: true entry with make_latest: legacy in the Publish
GitHub release step) so GitHub's automatic logic determines the Latest tag and
prevents forced overrides.

@mosteligible
mosteligible merged commit 8be4e5b into main Apr 10, 2026
0 of 2 checks passed
@mosteligible
mosteligible deleted the cicd branch April 10, 2026 16:38
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