Skip to content

ci: post-merge-verify v1.1——修 startup failure(P2-6,ADR-0041) - #112

Merged
randypanding merged 1 commit into
mainfrom
p2-6-post-merge-verify-v1.1
Aug 20, 2026
Merged

ci: post-merge-verify v1.1——修 startup failure(P2-6,ADR-0041)#112
randypanding merged 1 commit into
mainfrom
p2-6-post-merge-verify-v1.1

Conversation

@randypanding

@randypanding randypanding commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

摘要

#110 合入后的 0-job startup failure(run 32337015373):workflow_call+push 混用时 inputs.smoke 在 push 运行中是 Unrecognized named-value。v1 收敛为纯 push(治理仓自检冒烟);业务仓接入走 ADR-0041 后续逐仓注册(文件头注释记录了该坑)。另修告警步骤的 SHA/RUN_URL env 归属。

验证

  • YAML 解析、无 inputs 残留
  • 本 PR 合并的 push run 即自检(冒烟应绿)

Summary by CodeRabbit

  • 工作流改进
    • 合并后的验证流程现仅在 main 分支推送时自动触发。
    • 优化冒烟检查、自动回退与告警流程,减少重复触发并提升执行稳定性。
    • 自动回退相关告警统一使用 P0 标签,便于快速识别和处理。

0-job startup failure 实测(run 32337015373):workflow_call+push 混用时
inputs.smoke 在 push 运行中是 Unrecognized named-value。v1 收敛为纯 push
(治理仓自检);业务仓接入走 ADR-0041 后续逐仓注册。另修告警步骤 SHA/URL
env(原先引用他步 env 为空)。
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98c09845-f370-4796-adf9-a651681b04bd

📥 Commits

Reviewing files that changed from the base of the PR and between ec514b4 and d87a972.

📒 Files selected for processing (1)
  • .github/workflows/post-merge-verify.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch p2-6-post-merge-verify-v1.1

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix post-merge verification startup and alert context

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Restricts post-merge verification to pushes, eliminating unavailable workflow_call inputs.
• Keeps governance YAML, JSON, and shell validation as the v1 smoke scope.
• Shares repository, commit, and run context across revert and fallback alerts.
Diagram

graph TD
  PUSH["Main push"] --> SMOKE["Governance smoke"] --> RESULT{"Smoke result"}
  RESULT -->|pass| DONE["Run succeeds"]
  RESULT -->|fail| GUARD["Revert guards"] -->|allowed| REVERT["Auto-revert PR"]
  GUARD -->|blocked| ALERT["P0 alert"]
  REVERT -->|unavailable| ALERT
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Separate reusable and push workflows
  • ➕ Preserves custom smoke commands for registered business repositories.
  • ➕ Keeps workflow_call inputs isolated from push-event expression evaluation.
  • ➕ Allows governance self-checks and repository integrations to evolve independently.
  • ➖ Requires an additional workflow and explicit caller wiring.
  • ➖ Expands the immediate scope beyond the v1 governance repository self-check.
  • ➖ Needs coordinated per-repository registration under ADR-0041.

Recommendation: The push-only workflow is the safest immediate fix because it removes the invalid event-context combination and matches the documented v1 scope. When business repositories are onboarded, introduce a separate reusable workflow_call workflow rather than restoring both triggers in this file.

Files changed (1) +20 / -21

Bug fix (1) +20 / -21
post-merge-verify.ymlMake post-merge verification push-only and repair rollback alerts +20/-21

Make post-merge verification push-only and repair rollback alerts

• Removes the reusable-workflow trigger and custom smoke input that caused zero-job startup failures on push events, leaving governance validation as the v1 smoke test. Promotes repository, SHA, and run URL values to job-level environment variables, emits deterministic guard outputs, and makes fallback alert creation retry without requiring a missing label.

.github/workflows/post-merge-verify.yml

@coderabbitai coderabbitai Bot added breaking bug Something isn't working security labels Aug 20, 2026
@randypanding
randypanding merged commit 8c91075 into main Aug 20, 2026
8 of 9 checks passed
@randypanding
randypanding deleted the p2-6-post-merge-verify-v1.1 branch August 20, 2026 05:55
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📜 Skill insights (0)

Grey Divider


Action required

1. Successful reverts trigger alerts 🐞 Bug ≡ Correctness
Description
Once removing the invalid inputs.smoke references allows the workflow to run, the fallback alert
executes even after a successful automatic revert because failure() remains true from the failed
ancestor smoke job. Every successful auto-revert therefore creates a false “revert not executed”
P0 issue, potentially prompting an unnecessary manual rollback.
Code

.github/workflows/post-merge-verify.yml[L29-30]

-          if [ -n "${{ inputs.smoke }}" ]; then
-            bash -c '${{ inputs.smoke }}'
Relevance

●●● Strong

Recent workflow correctness findings are accepted; ancestor failure causing false alert is a
concrete deterministic bug.

PR-#19
PR-#51

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The revert job is deliberately started only because its smoke ancestor failed, after which the
auto-revert may complete successfully; nevertheless, the alert condition uses bare failure().
GitHub documents that failure() remains true when any ancestor job in a dependency chain failed,
so the condition is true regardless of the revert step's success.

.github/workflows/post-merge-verify.yml[43-46]
.github/workflows/post-merge-verify.yml[85-103]
🌐 GitHub states that failure() returns true when any ancestor job in a chain of dependent jobs fails.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The now-operational workflow always enters the alert step after a smoke failure, even when the automatic revert succeeds, because `failure()` includes failures from ancestor jobs.

## Issue Context
Give the guard and automatic-revert steps IDs, then base the fallback condition on their explicit outcomes and the guard/App outputs. Preserve alerts for guard failures, token failures, blocked reverts, missing PRs, and failed revert commands without treating the expected upstream smoke failure as a revert failure.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[43-46]
- .github/workflows/post-merge-verify.yml[58-103]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Revert rate limit bypass 🐞 Bug ☼ Reliability
Description
The now-activated loop guard examines only the 20 newest PRs, so an auto-revert created earlier in
the same hour is missed whenever at least 20 newer PRs exist. A subsequent smoke failure can then
create another revert despite the stated one-per-hour limit.
Code

.github/workflows/post-merge-verify.yml[L29-30]

-          if [ -n "${{ inputs.smoke }}" ]; then
-            bash -c '${{ inputs.smoke }}'
Relevance

●●● Strong

Recent PR #19 accepted the same fixed-page GitHub API truncation bypass pattern.

PR-#19

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The guard states a one-per-hour policy but requests per_page=20 without pagination before
filtering by creation time. The repository's accepted pagination defect in PR #19 demonstrates the
same truncated GitHub API result pattern.

.github/workflows/post-merge-verify.yml[70-73]
PR-#19

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The one-hour auto-revert rate-limit guard only checks the first 20 pull requests and can miss a qualifying revert PR on a later page.

## Issue Context
Fetch and aggregate all pages needed to cover the one-hour window before counting matching `[auto-revert]` titles. Ensure the resulting `RECENT` value is one aggregate integer rather than one count per page.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[70-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Fallback uses workflow token 📘 Rule violation ⛨ Security
Description
The modified fallback creates GitHub issues using ${{ github.token }} instead of a
single-repository cloudbrid-agent token obtained through scripts/gh-app-token.sh. This bypasses
the required bot identity and authentication path.
Code

.github/workflows/post-merge-verify.yml[107]

+          gh issue create --repo "$REPO" \
Relevance

●● Moderate

Recent token-identity precedent is rejected, but it concerns cross-repository access rather than
this fallback's mandated identity.

PR-#73

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2778539 requires GitHub API operations to authenticate exclusively through
scripts/gh-app-token.sh. The fallback step sets GH_TOKEN from ${{ github.token }} at lines
104-105 and the modified line 107 invokes gh issue create; the mandated script itself enforces
cloudbrid-agent identity and single-repository scope.

Rule 2778539: Agent operations must use the cloudbrid-agent GitHub App identity via scripts/gh-app-token.sh with single-repo tokens
.github/workflows/post-merge-verify.yml[102-107]
scripts/gh-app-token.sh[20-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The fallback GitHub issue operation authenticates with the workflow token rather than a cloudbrid-agent single-repository token issued by `scripts/gh-app-token.sh`.

## Issue Context
All authenticated GitHub operations must use the mandated script and must scope the resulting installation token to the current repository. If App authentication is unavailable, preserve a failed check rather than falling back to another identity.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[102-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Alert creates repository issue 📘 Rule violation § Compliance
Description
The modified bot fallback creates a repository issue, while the automation standard permits machine
feedback only through failed check runs or ordinary PR comments. This introduces an undocumented
feedback channel for the workflow.
Code

.github/workflows/post-merge-verify.yml[107]

+          gh issue create --repo "$REPO" \
Relevance

●● Moderate

Issue automation is accepted elsewhere, while recent channel-separation concerns were rejected;
compliance evidence remains ambiguous.

PR-#19
PR-#73

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2801912 requires modified automation to follow standards/automation/. That
standard limits machine feedback to failed check runs and ordinary PR comments, whereas the modified
workflow calls gh issue create.

Rule 2801912: Automation bots must comply with documented standards in standards/automation/
standards/automation/bot-channels.md[3-18]
.github/workflows/post-merge-verify.yml[102-113]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The post-merge bot publishes failure feedback by creating a repository issue, which is not one of the feedback channels permitted by `standards/automation/`.

## Issue Context
The existing failed workflow check is already an approved feedback mechanism. Remove the issue creation or, where suitable and authenticated correctly, report through an ordinary PR comment.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[102-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 8 rules
✅ Web pages:
  +21 more
Review mode: ⚖️ Balanced: This changes a post-merge CI workflow with automatic revert, permissions, GitHub API calls, and failure-alert behavior; the risk and blast radius warrant a complete single-pass review.

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

run: |
gh issue create --repo "$REPO" --title "P0: post-merge 冒烟失败且自动 revert 未执行(run ${{ github.run_id }})" --body "合并 ${SHA:-HEAD} 后冒烟失败。自动 revert 未执行的原因:App 令牌不可用(未安装本仓?)/ 防回环闸(嵌套 revert 或 1h 限频)/ 无关联 PR。人工复核并回滚:${{ github.server_url }}/${REPO}/actions/runs/${{ github.run_id }}(ADR-0041)" --label auto-revert-alert || \
gh issue create --repo "$REPO" --title "P0: post-merge 冒烟失败且自动 revert 未执行(run ${{ github.run_id }})" --body "同上(label 创建失败兜底)" No newline at end of file
gh issue create --repo "$REPO" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Fallback uses workflow token 📘 Rule violation ⛨ Security

The modified fallback creates GitHub issues using ${{ github.token }} instead of a
single-repository cloudbrid-agent token obtained through scripts/gh-app-token.sh. This bypasses
the required bot identity and authentication path.
Agent Prompt
## Issue description
The fallback GitHub issue operation authenticates with the workflow token rather than a cloudbrid-agent single-repository token issued by `scripts/gh-app-token.sh`.

## Issue Context
All authenticated GitHub operations must use the mandated script and must scope the resulting installation token to the current repository. If App authentication is unavailable, preserve a failed check rather than falling back to another identity.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[102-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

run: |
gh issue create --repo "$REPO" --title "P0: post-merge 冒烟失败且自动 revert 未执行(run ${{ github.run_id }})" --body "合并 ${SHA:-HEAD} 后冒烟失败。自动 revert 未执行的原因:App 令牌不可用(未安装本仓?)/ 防回环闸(嵌套 revert 或 1h 限频)/ 无关联 PR。人工复核并回滚:${{ github.server_url }}/${REPO}/actions/runs/${{ github.run_id }}(ADR-0041)" --label auto-revert-alert || \
gh issue create --repo "$REPO" --title "P0: post-merge 冒烟失败且自动 revert 未执行(run ${{ github.run_id }})" --body "同上(label 创建失败兜底)" No newline at end of file
gh issue create --repo "$REPO" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. Alert creates repository issue 📘 Rule violation § Compliance

The modified bot fallback creates a repository issue, while the automation standard permits machine
feedback only through failed check runs or ordinary PR comments. This introduces an undocumented
feedback channel for the workflow.
Agent Prompt
## Issue description
The post-merge bot publishes failure feedback by creating a repository issue, which is not one of the feedback channels permitted by `standards/automation/`.

## Issue Context
The existing failed workflow check is already an approved feedback mechanism. Remove the issue creation or, where suitable and authenticated correctly, report through an ordinary PR comment.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[102-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines -29 to -30
if [ -n "${{ inputs.smoke }}" ]; then
bash -c '${{ inputs.smoke }}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Successful reverts trigger alerts 🐞 Bug ≡ Correctness

Once removing the invalid inputs.smoke references allows the workflow to run, the fallback alert
executes even after a successful automatic revert because failure() remains true from the failed
ancestor smoke job. Every successful auto-revert therefore creates a false “revert not executed”
P0 issue, potentially prompting an unnecessary manual rollback.
Agent Prompt
## Issue description
The now-operational workflow always enters the alert step after a smoke failure, even when the automatic revert succeeds, because `failure()` includes failures from ancestor jobs.

## Issue Context
Give the guard and automatic-revert steps IDs, then base the fallback condition on their explicit outcomes and the guard/App outputs. Preserve alerts for guard failures, token failures, blocked reverts, missing PRs, and failed revert commands without treating the expected upstream smoke failure as a revert failure.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[43-46]
- .github/workflows/post-merge-verify.yml[58-103]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines -29 to -30
if [ -n "${{ inputs.smoke }}" ]; then
bash -c '${{ inputs.smoke }}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Revert rate limit bypass 🐞 Bug ☼ Reliability

The now-activated loop guard examines only the 20 newest PRs, so an auto-revert created earlier in
the same hour is missed whenever at least 20 newer PRs exist. A subsequent smoke failure can then
create another revert despite the stated one-per-hour limit.
Agent Prompt
## Issue description
The one-hour auto-revert rate-limit guard only checks the first 20 pull requests and can miss a qualifying revert PR on a later page.

## Issue Context
Fetch and aggregate all pages needed to cover the one-hour window before counting matching `[auto-revert]` titles. Ensure the resulting `RECENT` value is one aggregate integer rather than one count per page.

## Fix Focus Areas
- .github/workflows/post-merge-verify.yml[70-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@randypanding randypanding mentioned this pull request Aug 20, 2026
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking bug Something isn't working security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant