Skip to content

[chores] Updated CI failure bot caller#1298

Open
stktyagi wants to merge 3 commits intomasterfrom
chores/failure-bot-improvements
Open

[chores] Updated CI failure bot caller#1298
stktyagi wants to merge 3 commits intomasterfrom
chores/failure-bot-improvements

Conversation

@stktyagi
Copy link
Member

Updated the failure bot caller with respect to new improvements.

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Description of Changes

Added the caller changes with respect to new updates

Updated the failure bot caller with respect to new improvements.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

This change updates the CI failure bot GitHub Actions workflow (.github/workflows/bot-ci-failure.yml). It changes the job permissions for actions from read to write, tightens the job-if condition to require both conclusion == 'failure' and event == 'pull_request', and simplifies PR-author extraction by removing the fallback to workflow_run.actor.login and emitting a warning if the PR author is missing.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as "GitHub Actions Workflow"
    participant Runner as "Actions Runner"
    participant GitHub as "GitHub API / Events"
    participant Script as "find-pr job script"

    GitHub->>Workflow: workflow_run event
    Workflow->>Runner: start find-pr job
    Runner->>Script: evaluate if (conclusion == 'failure' && event == 'pull_request')
    alt condition true
        Script->>GitHub: query pull requests for workflow_run
        GitHub-->>Script: returns PR(s) with author
        alt author present
            Script->>Runner: set pr_author output
        else author missing
            Script->>Runner: emit warning (no fallback)
        end
    else condition false
        Runner-->>Workflow: job skipped
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • nemesifier
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes the required checklist and references changes, but lacks a specific issue number reference and provides vague change descriptions without detailed technical context. Add 'Closes #' section and provide more specific technical details about the changes (e.g., explain the null check addition and permission changes).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title '[chores] Updated CI failure bot caller' follows the required format with [chores] prefix and provides a clear, descriptive summary of the changes made to the CI workflow file.
Bug Fixes ✅ Passed PR fixes a null check bug in GitHub Actions workflow file, which is an explicitly listed exception to regression test requirements.

✏️ 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 chores/failure-bot-improvements
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/bot-ci-failure.yml:
- Around line 37-39: The PR author extraction can return the literal "null"
string because jq '.author.login' yields null rather than an empty string;
update the gh pr view command that sets pr_author to use jq with the // empty
fallback (e.g., '.author.login // empty') so it outputs an empty string instead
of "null", and then change the check around pr_author (the variable set by
pr_author=$(gh pr view ...)) to treat both empty and the literal "null" as
missing (i.e., if [ -z "$pr_author" ] || [ "$pr_author" = "null" ] then emit the
warning).
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 67df73d5-6252-4384-83a7-d1c394029bbc

📥 Commits

Reviewing files that changed from the base of the PR and between 8cf6733 and a27792b.

📒 Files selected for processing (1)
  • .github/workflows/bot-ci-failure.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=4.2.0
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=4.2.0
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:35-35
Timestamp: 2026-02-24T16:25:31.829Z
Learning: Repository: openwisp/openwisp-controller
File/Area: .github/workflows/backport.yml (backport-on-comment condition)
Learning: Project policy is to restrict the backport trigger via issue comments to users with author_association "MEMBER" or "OWNER" only; "COLLABORATOR" is intentionally excluded (per maintainer feedback on PR `#1233`).
📚 Learning: 2026-02-24T16:25:20.080Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:35-35
Timestamp: 2026-02-24T16:25:20.080Z
Learning: In .github/workflows/backport.yml, enforce that backport-on-comment triggers only for users with author_association MEMBE R or OWNER (COLLABORATOR excluded), reflecting maintainer feedback. Update the trigger condition to check author_association and restrict to MEMBERS/OWNERS; document rationale and PR `#1233` reference in code comments.

Applied to files:

  • .github/workflows/bot-ci-failure.yml
📚 Learning: 2026-02-24T16:24:55.443Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:22-22
Timestamp: 2026-02-24T16:24:55.443Z
Learning: In repositories within the OpenWISP organization, it is acceptable to reference reusable workflows from other OpenWISP-controlled repos using mutable refs (e.g., master) in .github/workflows. This is permissible due to the shared trust boundary within the organization. If applying this pattern, ensure the target repos are under the same organization and maintain awareness of potential breakages from upstream mutable refs; consider pinning to a tagged version for longer-term stability when appropriate.

Applied to files:

  • .github/workflows/bot-ci-failure.yml
🔇 Additional comments (2)
.github/workflows/bot-ci-failure.yml (2)

21-21: No additional concerns on this trigger guard tightening.


11-11: [Rewritten review comment]
[Classification tag]

Added explicit null check to prevent literal null string in author output.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/bot-ci-failure.yml:
- Line 11: The workflow grants unnecessary permission "actions: write"; confirm
whether the reusable workflow reusable-bot-ci-failure.yml
(openwisp/openwisp-utils@master) actually needs write scope for any called step
or API, and if not, remove or downgrade this permission to "actions: read" (or
omit it) in the job definition to follow least-privilege; update the job
permissions accordingly and ensure any referenced commands (gh pr view, gh api
commits/pulls, gh pr list) still work with the reduced scope.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 956feb40-ba7c-4849-8767-96f6c21a7887

📥 Commits

Reviewing files that changed from the base of the PR and between a27792b and f3e70c3.

📒 Files selected for processing (1)
  • .github/workflows/bot-ci-failure.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=4.2.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=4.2.0
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:35-35
Timestamp: 2026-02-24T16:25:31.829Z
Learning: Repository: openwisp/openwisp-controller
File/Area: .github/workflows/backport.yml (backport-on-comment condition)
Learning: Project policy is to restrict the backport trigger via issue comments to users with author_association "MEMBER" or "OWNER" only; "COLLABORATOR" is intentionally excluded (per maintainer feedback on PR `#1233`).
📚 Learning: 2026-02-24T16:25:20.080Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:35-35
Timestamp: 2026-02-24T16:25:20.080Z
Learning: In .github/workflows/backport.yml, enforce that backport-on-comment triggers only for users with author_association MEMBE R or OWNER (COLLABORATOR excluded), reflecting maintainer feedback. Update the trigger condition to check author_association and restrict to MEMBERS/OWNERS; document rationale and PR `#1233` reference in code comments.

Applied to files:

  • .github/workflows/bot-ci-failure.yml
📚 Learning: 2026-02-24T16:24:55.443Z
Learnt from: nemesifier
Repo: openwisp/openwisp-controller PR: 1233
File: .github/workflows/backport.yml:22-22
Timestamp: 2026-02-24T16:24:55.443Z
Learning: In repositories within the OpenWISP organization, it is acceptable to reference reusable workflows from other OpenWISP-controlled repos using mutable refs (e.g., master) in .github/workflows. This is permissible due to the shared trust boundary within the organization. If applying this pattern, ensure the target repos are under the same organization and maintain awareness of potential breakages from upstream mutable refs; consider pinning to a tagged version for longer-term stability when appropriate.

Applied to files:

  • .github/workflows/bot-ci-failure.yml
🔇 Additional comments (2)
.github/workflows/bot-ci-failure.yml (2)

21-21: Good execution guard for CI-failure PR runs.

Line 21 correctly limits this workflow to failed pull_request workflow_run events, reducing non-PR and non-failure noise.


38-39: Null/empty PR-author handling looks correct now.

Lines 38-39 properly treat missing author values as invalid and emit a warning instead of silently passing bad output.

@openwisp-companion
Copy link

Test Failures in openwisp-controller CI

Hello @stktyagi,
(Analysis for commit f3e70c3)

The CI build failed due to a selenium.common.exceptions.InvalidSessionIdException. This typically indicates that the Selenium WebDriver session became invalid during the test execution, likely due to an unexpected interruption or a problem with the browser or driver.

Failure: selenium.common.exceptions.InvalidSessionIdException in test_restoring_deleted_device

Reason: The test test_restoring_deleted_device in openwisp_controller/tests/test_selenium.py failed with an InvalidSessionIdException. This exception occurs when Selenium tries to interact with a WebDriver session that is no longer valid. The traceback points to the driver.get() call within the login() method, suggesting the session might have been lost before or during the login process.

Fix: This appears to be a transient issue. It's recommended to re-run the CI pipeline. If the failure persists, it might indicate a more complex environment issue or a subtle bug in how the test handles browser sessions.

Additional Notes:
The logs also show several RuntimeWarning: DateTimeField ... received a naive datetime warnings. While these are not the cause of the current failure, they indicate potential issues with timezone handling in the application and should be addressed separately.

Please re-run the CI pipeline. If the issue persists, further investigation into the test environment and session management might be necessary.

@coveralls
Copy link

Coverage Status

coverage: 98.658%. remained the same
when pulling fce7113 on chores/failure-bot-improvements
into 45b24b6 on master.

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.

3 participants