Implement reasoning trigger gate with cooldown logic#60
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: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds configuration-driven reasoning trigger logic to detect suspicious track patterns. A new settings module exposes dwell and cooldown thresholds, a trigger service implements gating rules and per-track cooldown state, and comprehensive tests validate all trigger conditions and cooldown behavior. ChangesReasoning Trigger Gate
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: 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 `@services/memory/trigger.py`:
- Around line 33-54: The gate logic can be silently broken by negative
thresholds; before applying the dwell and cooldown checks, validate that
settings.reasoning_dwell_threshold_seconds and
settings.reasoning_cooldown_seconds are non-negative (and that
event.dwell_time_seconds is not negative). If any of these values are invalid,
log a clear error (or raise a ValueError) and either clamp to 0 or abort the
check (return False) so the gate behavior is deterministic; update the
validation near where event.dwell_time_seconds,
settings.reasoning_dwell_threshold_seconds, and
settings.reasoning_cooldown_seconds are used (also consider adding this check
once at function entry or initialization) and keep
_reasoning_cooldowns/monotonic() logic unchanged.
In `@tests/test_trigger.py`:
- Around line 1-9: The tests in tests/test_trigger.py rely on ambient env config
for dwell/cooldown causing nondeterminism; add an autouse pytest fixture that
pins the relevant config values used by should_trigger_reasoning and
reset_cooldown (e.g., dwell_time, cooldown_time) to fixed constants for the test
run by monkeypatching the config loader or os.environ before importing/using
those functions; ensure the fixture is autouse and scoped to the module so all
tests (including lines ~26-115) see the pinned values and remove reliance on
external .env.
🪄 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: b0da8842-53a8-4fba-85a4-6b0cae7bd592
📒 Files selected for processing (3)
libs/config/settings.pyservices/memory/trigger.pytests/test_trigger.py
|
Addressed the review feedback:
All trigger gate tests are passing successfully. |
|
Hi @Devnil434 this is merged & solved but i did not get any points ? |
Summary by CodeRabbit