Repository navigation
cicd: manual semantic versioning of agent - #12
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDeletes the standalone Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
| git tag -a "$RELEASE_TAG" "$TARGET_SHA" -m "Release $RELEASE_TAG" | ||
| git push origin "refs/tags/$RELEASE_TAG" |
There was a problem hiding this comment.
🚩 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| 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") |
There was a problem hiding this comment.
🚩 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
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
📒 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
| 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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.github/workflows/tag-go-module.yml (2)
16-17:⚠️ Potential issue | 🟠 MajorThe workflow still describes PR-title inference, but the code reads commit subjects.
The implementation only inspects
git logsubjects/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 | 🟠 MajorScope version inference to the selected module.
This scan is still repo-wide, so a
feat:incoderunnercan bump anagentrelease. Since this repo contains multiple Go modules, thegit logcall needs the selected module path(s) after--so only relevant commits affectmajor_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
📒 Files selected for processing (1)
.github/workflows/tag-go-module.yml
| - 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 |
There was a problem hiding this comment.
🧩 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, orlegacy - 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:
- 1: https://docs.github.com/en/rest/releases/releases
- 2: https://docs.github.com/rest/releases/releases
- 3: https://docs.github.com/en/rest/releases/releases?apiVersion=2026-03-10
- 4: https://github.blog/changelog/2022-10-20-explicitly-set-the-latest-release
- 5: https://docs.github.com/github/administering-a-repository/managing-releases-in-a-repository
- 6: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28
🌐 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:
- 1: Add support for make_latest property softprops/action-gh-release#304
- 2: Release marked as 'latest' despite make_latest: false in v2.5.0 softprops/action-gh-release#703
- 3: softprops/action-gh-release@0bea76b
- 4: https://github.com/softprops/action-gh-release
- 5: https://github.com/softprops/action-gh-release/blob/master/action.yml
- 6: https://github.com/softprops/action-gh-release?tab=readme-ov-file
- 7: https://docs.github.com/v3/repos/releases
🏁 Script executed:
cat -n .github/workflows/tag-go-module.yml | head -100Repository: mosteligible/mcp-codemode
Length of output: 3735
🏁 Script executed:
sed -n '280,310p' .github/workflows/tag-go-module.ymlRepository: 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.
| - 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.
Summary by CodeRabbit
Refactor
Chores