Skip to content

Enable CI Fix bot for valkey-io/valkey-search - #46

Open
Aksha1812 wants to merge 2 commits into
valkey-io:mainfrom
Aksha1812:enable-ci-fix-valkey-search
Open

Enable CI Fix bot for valkey-io/valkey-search#46
Aksha1812 wants to merge 2 commits into
valkey-io:mainfrom
Aksha1812:enable-ci-fix-valkey-search

Conversation

@Aksha1812

Copy link
Copy Markdown
Collaborator

What

Extends the on-demand CI Fix bot (@valkeyrie-bot fix <ci-link>) to work on valkey-io/valkey-search backport PRs, in addition to valkey-io/valkey.

Why

The scripts/ci_fix/ engine is already repo-agnostic — it threads the PR's repo through the gate, diagnosis, and verifier, and derives the reproduce command from the target repo's own CI rather than any hardcoded command list. The only thing scoping the bot to valkey-io/valkey was the workflow wiring:

  • ci-fix.yml hard-refused any repo != valkey-io/valkey, and minted an App token scoped to valkey only.
  • ci-fix-comment-poll.yml minted a poll token scoped to valkey (+ agent repo), and the poller only ever scanned a single target repo.

Changes

  • .github/workflows/ci-fix.yml — accept valkey-io/valkey-search in the repo gate (now a case allowlist) and add valkey-search to the minted App token scope.
  • .github/workflows/ci-fix-comment-poll.yml — add valkey-search to the poll token scope.
  • scripts/ci_fix/comment_poll.pymain() now polls a comma-separated list of target repos (CI_FIX_POLL_TARGET_REPO, default valkey-io/valkey,valkey-io/valkey-search), wrapping each poll_once so one repo's read failure cannot abort the tick for the others. The reaction-claim idempotency is unchanged.
  • README.md — document search support.
  • Testtest_target_repos_default_and_override covers the default, comma-split/trim, order-preservation, and de-dup.

No engine changes. For a container-based search job, the verifier classifies and runs the reproduce command exactly as it does for core.

Notes / follow-ups

  • Search integration tests are slow. The verifier caps a single reproduce command at 30 min (runner.py), while search's own integration workflow allows 140 min. A cold devcontainer build + from-source valkey-server/valkey-json build could approach that cap. Not changed here — better to observe a real run first, then raise the timeout (or make it per-repo) only if needed. Search unit tests should be well within budget.
  • The comment trigger still needs the planned thin wrapper in the target repo to forward issue_comment events; until then, workflow_dispatch with --field repo=valkey-io/valkey-search works.

Testing

  • ruff check and mypy clean on changed files.
  • pytest tests/test_ci_fix_*.py — 176 passed.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4f6588a-09f3-4b68-bf3a-a961dd0da1eb

📥 Commits

Reviewing files that changed from the base of the PR and between a4f724f and 02d0203.

📒 Files selected for processing (2)
  • README.md
  • tests/test_ci_fix_comment_poll.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • tests/test_ci_fix_comment_poll.py

📝 Walkthrough

Walkthrough

This PR extends CI fix polling and dispatch to support both valkey-io/valkey and valkey-io/valkey-search. It updates workflow permissions and validation, adds multi-repository polling with isolated failures, tests the new behavior, and revises the workflow documentation.

Changes

CI Fix Multi-repo Support

Layer / File(s) Summary
Workflow repository allowlists
.github/workflows/ci-fix-comment-poll.yml, .github/workflows/ci-fix.yml
Workflow permissions, dispatch inputs, concurrency grouping, comments, and repository validation now support both target repositories.
Multi-repository polling and validation
scripts/ci_fix/comment_poll.py, tests/test_ci_fix_comment_poll.py
_target_repos() parses ordered, deduplicated repository overrides; polling runs once per repository with isolated failures and raises when all repositories fail. Tests cover selection and failure handling.
CI fix workflow documentation
README.md
Documents both supported repositories, comment-trigger requirements, and token scopes.

Sequence Diagram(s)

sequenceDiagram
  participant Poller as comment_poll.main
  participant Config as _target_repos
  participant GitHub as poll_once
  participant Dispatcher as dispatch

  Poller->>Config: read CI_FIX_POLL_TARGET_REPO
  Config-->>Poller: ordered deduplicated repositories
  loop for each repository
    Poller->>GitHub: poll_once(repository, lookback_minutes)
    GitHub-->>Poller: matching comments or repository error
    GitHub->>Dispatcher: dispatch matching CI fix
  end
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: enabling the CI Fix bot for valkey-io/valkey-search.
Description check ✅ Passed The description is directly about extending the CI Fix bot to valkey-search and matches the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@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.

🧹 Nitpick comments (1)
scripts/ci_fix/comment_poll.py (1)

257-267: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Silent no-op if override resolves to empty list.

If CI_FIX_POLL_TARGET_REPO is set but parses to zero entries (e.g. empty string, only commas/whitespace), _target_repos() returns (), and main()'s loop silently polls nothing — the only signal is "dispatched 0 fix(es)" in the log, indistinguishable from a normal quiet tick. Consider falling back to the default list when the parsed result is empty.

♻️ Proposed fix
 def _target_repos() -> tuple[str, ...]:
     raw = os.environ.get("CI_FIX_POLL_TARGET_REPO", _DEFAULT_TARGET_REPOS)
     repos = [entry.strip() for entry in raw.split(",") if entry.strip()]
     # Preserve order, drop duplicates.
-    return tuple(dict.fromkeys(repos))
+    if not repos:
+        repos = [entry.strip() for entry in _DEFAULT_TARGET_REPOS.split(",")]
+    return tuple(dict.fromkeys(repos))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/ci_fix/comment_poll.py` around lines 257 - 267, The _target_repos()
helper can return an empty tuple when CI_FIX_POLL_TARGET_REPO is set to only
commas/whitespace, causing main() to do a silent no-op; update _target_repos()
so it falls back to _DEFAULT_TARGET_REPOS whenever the parsed repos list is
empty. Keep the existing dedupe/order behavior in _target_repos(), and make sure
the polling loop in main() always receives at least one target repo unless
explicitly configured otherwise.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/ci_fix/comment_poll.py`:
- Around line 257-267: The _target_repos() helper can return an empty tuple when
CI_FIX_POLL_TARGET_REPO is set to only commas/whitespace, causing main() to do a
silent no-op; update _target_repos() so it falls back to _DEFAULT_TARGET_REPOS
whenever the parsed repos list is empty. Keep the existing dedupe/order behavior
in _target_repos(), and make sure the polling loop in main() always receives at
least one target repo unless explicitly configured otherwise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f7983417-cfcb-40b1-a4f1-5eb4403959ba

📥 Commits

Reviewing files that changed from the base of the PR and between 1f80cd9 and 4cfb5b8.

📒 Files selected for processing (5)
  • .github/workflows/ci-fix-comment-poll.yml
  • .github/workflows/ci-fix.yml
  • README.md
  • scripts/ci_fix/comment_poll.py
  • tests/test_ci_fix_comment_poll.py

@sarthakaggarwal97 sarthakaggarwal97 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sharing some comments. Looks simple otherwise.

claim=claim_via_status,
)
except Exception as exc: # noqa: BLE001 - one repo must not abort the tick
logger.warning("Skipping repo %s after error: %s", target_repo, exc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what if all the repos failed due to some bad config / app installation etc. If it's just one maybe it's okay but if all the repos failed, we should fail the workflow instead of silently logging it.

also, let's see we can catch a non-generic exception as well.

Comment thread .github/workflows/ci-fix.yml Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Now that this workflow supports multiple target repos, the concurrency key should include the repo as well as the PR number.

ci-fix-${{ inputs.pr }} makes valkey-io/valkey#123 and valkey-io/valkey-search#123 share the same queue even though they are unrelated branches. With cancel-in-progress: false, one long run can unnecessarily block the other.

Something like ci-fix-${{ inputs.repo }}-${{ inputs.pr }} would preserve same-PR serialization without cross-repo collisions.

The ci-fix engine is already repo-agnostic; only the workflow wiring was
scoped to valkey-io/valkey. Extend that wiring to valkey-search:

- ci-fix.yml: accept valkey-io/valkey-search in the repo gate and add it to
  the minted App token scope.
- ci-fix-comment-poll.yml: add valkey-search to the poll token scope.
- comment_poll: poll a comma-separated list of target repos (default now
  valkey and valkey-search), isolating per-repo read failures so one repo
  cannot abort the tick.

No engine changes: diagnosis derives the reproduce command from the repo's
own CI, and the verifier classifies the failed job's environment as before.

Signed-off-by: Aksha Thakkar <thaakb@amazon.com>
@Aksha1812
Aksha1812 force-pushed the enable-ci-fix-valkey-search branch from 4cfb5b8 to a4f724f Compare July 26, 2026 19:44

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 178-184: Update the README workflow documentation to state that
comment-triggered forwarding still requires a target-repository wrapper, while
workflow_dispatch remains available directly. Revise the claims about end-to-end
comments and App-token coverage, and align the Configuration section’s
repository scopes with both valkey-io/valkey and valkey-io/valkey-search.

In `@tests/test_ci_fix_comment_poll.py`:
- Around line 241-247: Reorder the target_repos fixture in the polling test so
owner/bad appears before owner/good, while preserving the assertions that one
dispatch occurs and both repositories are polled. This ensures the test observes
continuation after the first repository failure.
🪄 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: CHILL

Plan: Pro Plus

Run ID: 2060dee0-141f-49b6-ab31-114adafaaa70

📥 Commits

Reviewing files that changed from the base of the PR and between 4cfb5b8 and a4f724f.

📒 Files selected for processing (5)
  • .github/workflows/ci-fix-comment-poll.yml
  • .github/workflows/ci-fix.yml
  • README.md
  • scripts/ci_fix/comment_poll.py
  • tests/test_ci_fix_comment_poll.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci-fix-comment-poll.yml
  • .github/workflows/ci-fix.yml

Comment thread README.md
Comment thread tests/test_ci_fix_comment_poll.py Outdated
…tion test

- README: the ci-fix Configuration section listed minted token scopes on
  valkey-io/valkey only; ci-fix.yml now scopes the token to both valkey and
  valkey-search, so document both consistently.
- test_poll_all_repos_isolates_single_repo_failure: put the failing repo
  first so the test proves polling continues to the healthy repo after an
  exception, rather than passing even if the loop aborted on failure.

Co-authored-by: Aksha Thakkar <thaakb@amazon.com>
Signed-off-by: AkshaThakkar1812 <akshathakkar@gmail.com>
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.

2 participants