Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughThe PR refactors configuration handling to always apply defaults via a new ChangesConfig and Pipeline API Contracts
Config Validation and Application
Pipeline Structure and Sequencing
Point ID Generation
Embedding Optimization
Event Filtering and Control Flow
Label Application and Transfer Routing
Implementation Details
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
cmd/simili/commands/pipeline_runner.go (1)
35-41: ⚡ Quick winPrefer
errors.Isover==for theErrSkipPipelinesentinel.All three comparisons rely on
ErrSkipPipelineflowing through unwrapped, which is true today but will break the moment any step doesfmt.Errorf("…: %w", pipeline.ErrSkipPipeline)— a graceful-skip would then be reported aspipeline failed:and the post-pipeline indexer for that path would also stop short.errors.Isis the idiomatic, wrap-safe form.♻️ Proposed fix
-import ( +import ( "context" "encoding/json" + "errors" "fmt" "os" "time" @@ - if err != nil { - if err == pipeline.ErrSkipPipeline { + if err != nil { + if errors.Is(err, pipeline.ErrSkipPipeline) { fmt.Printf("⏭️ [%s] Skipped: %s\n", s.Name(), ctx.Result.SkipReason) return err } @@ - pipelineErr := mainPipeline.Run(pCtx) - if pipelineErr != nil && pipelineErr != pipeline.ErrSkipPipeline { + pipelineErr := mainPipeline.Run(pCtx) + if pipelineErr != nil && !errors.Is(pipelineErr, pipeline.ErrSkipPipeline) { return nil, fmt.Errorf("pipeline failed: %w", pipelineErr) } @@ - if err := s.Run(pCtx); err != nil && err != pipeline.ErrSkipPipeline { + if err := s.Run(pCtx); err != nil && !errors.Is(err, pipeline.ErrSkipPipeline) { // Log but don't fail the overall result for post-pipeline steps pCtx.Result.Errors = append(pCtx.Result.Errors, fmt.Sprintf("post-pipeline step '%s': %v", step.Name(), err)) }Also applies to: 86-89, 105-108
🤖 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 `@cmd/simili/commands/pipeline_runner.go` around lines 35 - 41, Replace direct equality checks against the sentinel pipeline.ErrSkipPipeline with wrap-safe errors.Is calls: where the code currently does if err == pipeline.ErrSkipPipeline (and similar checks around the s.Name()/ctx.Result.SkipReason handling and the other two occurrences), change them to if errors.Is(err, pipeline.ErrSkipPipeline) and import the standard "errors" package; keep the existing logging (fmt.Printf lines that use s.Name(), ctx.Result.SkipReason, and err.Error()) intact so graceful skips still produce the same messages while safely handling wrapped errors.
🤖 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 `@cmd/simili/commands/batch.go`:
- Around line 148-155: The assignment line "cfg = &config.Config{}" in the error
branch after calling config.LoadWithInheritance(cfgPath, fetcher) is
mis-indented and should be moved into the if-block body to match the surrounding
statements; update the indentation so that "cfg = &config.Config{}" and the
following "cfg.ApplyDefaults()" are at the same indentation level inside the if
err != nil { ... } block (the code paths around cfg, config.LoadWithInheritance
and cfg.ApplyDefaults should align with the else branch and be
gofmt-consistent).
In `@internal/steps/auto_closer.go`:
- Around line 386-417: The comment's displayed grace period (gracePeriodDisplay)
is always rendered as hours but Run may use GracePeriodMinutesOverride, so
update the logic around gracePeriodDisplay and the comment formatting to reflect
the actual runtime override: read ac.cfg.AutoClose.GracePeriodHours and
ac.cfg.AutoClose.GracePeriodMinutesOverride (or the runtime value passed to
Run), compute a single effective duration value and choose the unit (hours vs
minutes) when building the comment string (reference the variables
gracePeriodDisplay, ac.cfg.AutoClose.GracePeriodHours,
GracePeriodMinutesOverride and the comment var) so the posted message shows the
correct number and unit matching what was used to decide the close.
- Around line 253-284: The triage-comment scan currently only skips comments
older than triageWindow but fails to exclude comments newer than since, allowing
post-label bot comments to short-circuit the search; update the timestamp check
around comment.CreatedAt in the auto-closer loop so it only considers comments
whose CreatedAt is within the window [since, triageWindow] (i.e., skip if
CreatedAt is nil or CreatedAt.Time.Before(since) or
CreatedAt.Time.After(triageWindow)), leaving the isBotUser/isBotComment checks
and subsequent reaction processing (ListIssueCommentReactions) intact so we
still detect the true triage comment correctly.
In `@internal/transfer/vdb_router_test.go`:
- Around line 49-53: The derivation of issueNum from id currently assumes every
rune in id is a digit and does rune arithmetic directly; change the loop that
computes issueNum to skip any non-digit characters (e.g., check
unicode.IsDigit(c) or '0'<=c && c<='9') so only numeric runes contribute to
issueNum, leaving issueNum unchanged for skipped characters; update the loop
that references id and the variable issueNum to perform this guard so UUID-like
or alphanumeric IDs don't produce incorrect numbers.
In `@internal/transfer/vdb_router.go`:
- Around line 93-104: The dedupe logic only handles float64 so issue numbers
deserialized as int64 become 0 and all issues collapse; update the extraction
around res.Payload["issue_number"] / res.Payload["number"] (the block that sets
issueNum and builds dedupeKey/seenIssues) to use a type-switch like in
similarity.go that handles int64, int, float64 (and json.Number/string if
present), converting the found numeric value into a numeric representation used
for the key (e.g., convert ints to float64 or format the integer) before
creating dedupeKey and marking seenIssues[dedupeKey]=true.
---
Nitpick comments:
In `@cmd/simili/commands/pipeline_runner.go`:
- Around line 35-41: Replace direct equality checks against the sentinel
pipeline.ErrSkipPipeline with wrap-safe errors.Is calls: where the code
currently does if err == pipeline.ErrSkipPipeline (and similar checks around the
s.Name()/ctx.Result.SkipReason handling and the other two occurrences), change
them to if errors.Is(err, pipeline.ErrSkipPipeline) and import the standard
"errors" package; keep the existing logging (fmt.Printf lines that use s.Name(),
ctx.Result.SkipReason, and err.Error()) intact so graceful skips still produce
the same messages while safely handling wrapped errors.
🪄 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
Run ID: 1e5cb2f0-d5ba-4943-a225-81a7a609e359
📒 Files selected for processing (18)
cmd/simili/commands/batch.gocmd/simili/commands/learn.gocmd/simili/commands/pipeline_runner.gocmd/simili/commands/process.gointernal/core/config/config.gointernal/core/pipeline/pipeline.gointernal/steps/action_executor.gointernal/steps/auto_closer.gointernal/steps/command_handler.gointernal/steps/duplicate_detector.gointernal/steps/indexer.gointernal/steps/llm_router.gointernal/steps/pending_action_scheduler.gointernal/steps/quality_checker.gointernal/steps/similarity.gointernal/steps/transfer_check.gointernal/transfer/vdb_router.gointernal/transfer/vdb_router_test.go
Validate() was gated behind a needsVDB flag that made it a no-op for
most configurations, causing 7 test failures where empty required
fields (qdrant.url, qdrant.api_key, qdrant.collection, embedding.api_key)
passed validation silently.
- Remove the conditional needsVDB gate from Validate()
- Always check the 4 required fields unconditionally
- Export ApplyDefaults() so callers constructing Config{} directly
(e.g. fallback when no config file exists) can apply sane defaults
Fixes 7 failing tests in internal/core/config.
Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
…RL logic
- process.go: call ApplyDefaults() on both fallback Config{} paths to
prevent zero-value thresholds (0.0 similarity, 0 max results)
- batch.go: same ApplyDefaults() fix, plus unify Qdrant URL fallback
to match process.go (skip VectorStore init when no real URL is
configured instead of defaulting to localhost:6334)
- process.go: restrict sender.login → CommentAuthor mapping to
primary-actor events only (opened/edited/closed/reopened) to prevent
bot-labeled issues from being incorrectly skipped by the gatekeeper
Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- pipeline.go: Return ErrSkipPipeline to the caller instead of swallowing it, so the runner knows the pipeline was skipped gracefully. - pipeline_runner.go: Execute the 'indexer' as a post-pipeline step that always runs, even if the main pipeline skips (e.g. transferred issues). This ensures Qdrant state stays in sync with skipped/transferred issues. Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- indexer.go: Use org/repo#number-chunk-0 format for UUID generation to match the bulk indexer, preventing duplicate Qdrant points. - indexer.go: Add issue body to the 'text' payload field so similarity search results can provide context to the LLM duplicate detector. - learn.go: Generate RFC 4122 UUIDs via uuid.NewMD5 instead of raw SHA256 hex. Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- transfer_check.go: Exit early if ctx.TransferTarget is already set (L2). - transfer_check.go: Set original_repo metadata in setTransferTarget so the response builder correctly shows 'Transferred from' (L10). - vdb_router.go: Deduplicate VDB results by issue number before calculating per-repo hit counts to prevent chunk-count bias (L7). Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- duplicate_detector.go, quality_checker.go: Skip pr_comment events so duplicate detection and quality checks don't run on PR reviews (L8). - action_executor.go: When an issue is a duplicate, only apply the 'potential-duplicate' label and filter out triage labels (L9). Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- similarity.go, llm_router.go: Cache issue embedding in context metadata to avoid redundant duplicate API calls (L1). - command_handler.go: Return ErrSkipPipeline for unknown slash commands so they don't trigger the full triage pipeline (L4). - pending_action_scheduler.go: Add documentation warning about ephemeral storage in GitHub Actions and a TODO for GitHubStateManager (L11). - auto_closer.go: Normalize CRLF to LF. Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
- auto_closer.go: Fix triage window filtering logic - vdb_router_test.go: Update issue number parsing loop to guard against non-digits - vdb_router.go: Update issue number extraction to handle different numeric types - pipeline_runner.go: Use errors.Is for ErrSkipPipeline Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
2e27033 to
da79e45
Compare
Summary
This PR resolves 12 functional and logic bugs across the pipeline's stage ordering, data flow, transfer routing, and gatekeeper. All tests and builds pass.
Fixes
Data Integrity
Pipeline Flow
transfer_checkfrom overwriting existing transfer decisions made byllm_router./status).Duplicate Detection & Actions
pr_commentevents.potential-duplicateis applied.original_repometadata during rule-based transfers so responses correctly show 'Transferred from'.Gatekeeper & Infrastructure
sender.login→CommentAuthormapping to primary-actor events to stop the gatekeeper from skipping human-opened but bot-labeled issues.pending_action_scheduler.Verification
go build ./...andgo vet ./...are clean.go test ./...passes (including fixes to the VDB router deduplication test).Summary by CodeRabbit
New Features
Bug Fixes
Documentation