Skip to content

chore: restore reverted test suites, folder structure, and security patches (v6)#204

Closed
sheepdestroyer wants to merge 19 commits into
masterfrom
chore/restore-reversions-final-v6
Closed

chore: restore reverted test suites, folder structure, and security patches (v6)#204
sheepdestroyer wants to merge 19 commits into
masterfrom
chore/restore-reversions-final-v6

Conversation

@sheepdestroyer

@sheepdestroyer sheepdestroyer commented Jul 2, 2026

Copy link
Copy Markdown
Owner

This PR comprehensively restores all files, directory organization, logic optimizations, container dependencies, and security patches that were mistakenly deleted or reverted during recent automated merge conflict resolutions on master.

1. Folder Structure & Reorganization Restored

  • Moved 23 test and utility files currently at the root back to their reorganized directories (tests/, scripts/, scripts/verification/, and router/tests/) matching PR Refactor: Reorganize repository structure #181.
  • Consolidated duplicate test files.

2. Missing Test and Utility Files Recovered

Restored 10 test and script files from repository history.

3. Logic Optimizations Re-applied in router/main.py

  • Async Cache: Restored the async annotations caching logic to prevent blocking the event loop.
  • Token Heuristics: Restored regex-based token estimation.
  • Valkey URL Connection: Restored URL-based Redis/Valkey client initialization in get_redis.

4. Security & Configuration Patches Restored

  • Category Injection: Restored input sanitization in router/memory_mcp.py.
  • Password Placeholders: Restored pod.yaml and start-stack.sh back to secure, placeholder-based configurations.
  • Version Upgrades: Restored LiteLLM v1.90.2 and newer container tags.

5. CI Workflow & Test Collection Fixes

  • Dependency List: Added aiofiles to pip installs.
  • Import-time Execution: Wrapped tests/test_agy_behavior.py in __main__.

6. Review & Bot Reversion Updates Applied (v5)

  • Restored Prisma datetime serialization, offloading of aa-scores, env placeholders fallbacks, audit plan, etc.

7. Code Review Feedback & Cleanups Applied (v6)

  • Log scan fallback: Returned False on successful log check with no errors in agy_proxy.py.
  • DELETE path encoding: Properly URL-quoted memory keys in HTTP DELETE requests in memory_mcp.py.
  • Scalar JSON normalization: Ensured scalar values in _parse_memory_value return a valid dictionary structure, preventing TypeError.
  • Redis/ClickHouse Secrets: Propagated dynamically generated secrets in start-stack.sh to pod.yaml placeholders.
  • Interactive Ollama key validation: Added non-empty checks when prompting the user.
  • Argument exit code logic: Made unknown arguments in start-stack.sh exit with status 1.
  • Test paths centralized: Consolidated root-finding and sys.path modification in tests/conftest.py and simplified unit tests.
  • CI safety: Added skip logic in tests/test_antigravity.py and workflow configuration to skip CI runs for connections.

Verification: All 179 unit and integration tests successfully pass.

Summary by CodeRabbit

  • New Features

    • Added clearer setup and verification guidance for stack startup, routing checks, and live tier testing.
    • Improved environment handling so more service credentials can be configured safely with placeholders.
  • Bug Fixes

    • Made routing and memory handling more resilient, including better fallback behavior and safer key processing.
    • Improved date/time and cache handling to reduce failures during server startup and data reads.
  • Tests

    • Expanded automated coverage for routing, status reporting, token estimation, and stack verification scenarios.

…am limits and add early arg parsing for --help in start-stack.sh

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @sheepdestroyer, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@sheepdestroyer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5624521f-f4fa-498f-8adc-b3c8c7e9878f

📥 Commits

Reviewing files that changed from the base of the PR and between a08d453 and 2eae001.

📒 Files selected for processing (11)
  • .agents/AGENTS.md
  • .agents/branch_audit_plan.md
  • README.md
  • litellm/entrypoint.py
  • router/main.py
  • router/memory_mcp.py
  • router/tests/test_memory_mcp.py
  • scripts/benchmark_classifier.py
  • scripts/benchmark_tokens.py
  • start-stack.sh
  • tests/conftest.py
📝 Walkthrough

Walkthrough

This PR bundles agent process documentation, deployment secret placeholderization across pod.yaml/start-stack.sh, router runtime changes (async Redis init, regex token estimation, lazy AA score loading, async annotations caching, async quota detection, memory key v2 encoding, Prisma datetime serialization), reworked benchmarking scripts, a migrated PR-status script, and broad new/updated test coverage.

Changes

Agent Process Documentation

Layer / File(s) Summary
Conflict resolution policy and regression docs
.agents/AGENTS.md, .agents/branch_audit_plan.md, .agents/jules_regression_analysis.md
New policy rules and audit/regression-analysis documents describing rebase-first agent behavior, directory-rename safety, credential preservation, and full test-suite verification requirements.

Router Runtime and Async Behavior

Layer / File(s) Summary
Redis init, token estimation, AA score lazy loading
router/main.py, router/tests/test_get_redis.py, router/tests/test_estimate_prompt_tokens.py, router/tests/test_load_persisted_stats.py, tests/test_compute_free_model_score.py
Redis client prefers VALKEY_URL; prompt token estimation switches to a regex heuristic; AA score cache is loaded lazily; classifier input is truncated; a target-model alias is remapped; tests updated/added accordingly.
Async cached annotations reader
router/main.py, tests/test_read_annotations_async.py
Adds an mtime-based async annotations cache using aiofiles, wired into save_annotations with invalidation on write.
Async quota-exhaustion detection
router/agy_proxy.py, router/tests/test_agy_proxy.py
_is_quota_exhausted becomes async, reading log tails via aiofiles; call sites and tests updated to await results.
Memory key v2 encoding and value parsing hardening
router/memory_mcp.py, router/tests/test_memory_mcp.py
New URL-encoded v2 memory key format with backward-compatible parsing, hardened JSON value normalization, and URL-encoded delete requests; extensive new tests.
Prisma datetime serializer registration
litellm/entrypoint.py
Registers Prisma serializers for original_datetime and RobustDatetime to force UTC ISO8601 serialization.
New router helper test coverage
router/tests/test_detect_active_tool.py, router/tests/test_get_gemini_oauth_status.py, router/tests/test_get_goose_sessions.py, tests/test_host_agy_daemon.py
Adds test modules covering tool detection, OAuth status, Goose sessions, and host-agy-daemon HTTP/streaming behaviors.

Deployment Secrets, CI, and Scripts

Layer / File(s) Summary
Placeholder-based secrets and version pins
pod.yaml, start-stack.sh, README.md
Hardcoded credentials replaced with placeholders across LiteLLM, Postgres, ClickHouse, Valkey, Langfuse, and MinIO; several image versions bumped; secret generation/templating extended in start-stack.sh.
CI workflow and test import-path cleanup
.github/workflows/test.yml, router/Dockerfile, tests/conftest.py, tests/test_a2_verify.py, tests/test_circuit_breaker.py, tests/test_agy_behavior.py, tests/test_antigravity.py, tests/test_models_proxy.py
Updates CI dependency install/test paths, centralizes path setup via conftest.py, removes redundant sys.path hacks, and adds a CI skip for the antigravity connection test.
Concurrent benchmarking and verification scripts
scripts/benchmark_classifier.py, scripts/benchmark_tokens.py, scripts/verification/test_reasoning_tiers.py, scripts/verification/verify_breaker.py, scripts/watch_quota.sh, scripts/README.md, README.md
Classifier benchmarking parallelized via ThreadPoolExecutor; new token-accuracy and tier-verification scripts added; import-path and script-path fixes.
PR status script migration
scripts/get_pr_status.py, tests/test_get_pr_status.py, get_pr_status.py
Adds a gh-based PR status checker under scripts/ with new tests; removes the old root-level script.

Estimated code review effort: 4 (Complex) | ~75 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant classify_request
  participant get_redis
  participant sync_adaptive_router_roster
  participant _load_aa_scores

  Client->>classify_request: chat completion request
  classify_request->>classify_request: truncate prompt to CLASSIFIER_INPUT_MAX_CHARS
  classify_request->>get_redis: fetch cache client
  get_redis-->>classify_request: aioredis client
  classify_request->>sync_adaptive_router_roster: sync roster / free model score
  sync_adaptive_router_roster->>_load_aa_scores: load AA scores if not loaded
  _load_aa_scores-->>sync_adaptive_router_roster: scores cache
  sync_adaptive_router_roster-->>classify_request: routing decision
Loading
sequenceDiagram
  participant TryAgyProxy
  participant IsQuotaExhausted
  participant LogFile as cli.log

  TryAgyProxy->>IsQuotaExhausted: await _is_quota_exhausted(rc, stdout, stderr)
  IsQuotaExhausted->>LogFile: async tail read via aiofiles
  LogFile-->>IsQuotaExhausted: log content
  IsQuotaExhausted-->>TryAgyProxy: exhausted flag
  TryAgyProxy->>TryAgyProxy: branch fallback vs failure handling
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: restoring reverted tests, structure, and security fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/restore-reversions-final-v6

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request reorganizes the repository structure, pins container image versions, and replaces hardcoded credentials with secure placeholders in pod.yaml and start-stack.sh. It introduces asynchronous file reading via aiofiles in agy_proxy.py and main.py, implements a regex-based prompt token estimation heuristic, offloads blocking JSON reads to background threads, and adds several new test suites. Feedback recommends importing timezone in entrypoint.py to prevent a potential NameError, safely accessing keys in benchmark_classifier.py to avoid crashes, and utilizing asyncio.gather in memory_mcp.py to perform HTTP DELETE requests concurrently.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread litellm/entrypoint.py Outdated
Comment on lines +113 to +117
def _serialize_dt(dt):
"""Serialize datetime to ISO8601 with timezone (UTC if naive)."""
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return dt.isoformat()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The timezone name is used here (timezone.utc), but it may not be imported in the global scope of litellm/entrypoint.py. To prevent a potential NameError when serializing naive datetimes, import timezone from datetime inside the function or at the top of the block.

Suggested change
def _serialize_dt(dt):
"""Serialize datetime to ISO8601 with timezone (UTC if naive)."""
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return dt.isoformat()
def _serialize_dt(dt):
"""Serialize datetime to ISO8601 with timezone (UTC if naive)."""
if dt.tzinfo is None:
from datetime import timezone
dt = dt.replace(tzinfo=timezone.utc)
return dt.isoformat()

Comment on lines +93 to +97
results_list[i] = {
"prompt": item["prompt"][:100],
"expected": expected,
"predicted": predicted,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If item is not a dictionary (which is caught and handled in process_item), accessing item["prompt"] directly in the main thread will raise a TypeError and crash the benchmark script. Similarly, if the "prompt" key is missing, it will raise a KeyError. Use a safe .get() check with type validation to prevent runtime crashes.

Suggested change
results_list[i] = {
"prompt": item["prompt"][:100],
"expected": expected,
"predicted": predicted,
}
results_list[i] = {
"prompt": item.get("prompt", "")[:100] if isinstance(item, dict) else "",
"expected": expected,
"predicted": predicted,
}

Comment thread router/memory_mcp.py Outdated
Comment on lines +237 to +241
async with httpx.AsyncClient(timeout=30.0) as client:
for entry in to_delete:
key = entry["key"]
await client.delete(f"{API_URL}/{key}", timeout=5.0)
quoted_key = urllib.parse.quote(key, safe="")
await client.delete(f"{API_URL}/{quoted_key}", timeout=5.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Performing sequential HTTP DELETE requests in a loop can be extremely slow and might lead to timeouts if there are many memories to delete. Since we are using httpx.AsyncClient, we can execute these requests concurrently using asyncio.gather to significantly improve efficiency.

Suggested change
async with httpx.AsyncClient(timeout=30.0) as client:
for entry in to_delete:
key = entry["key"]
await client.delete(f"{API_URL}/{key}", timeout=5.0)
quoted_key = urllib.parse.quote(key, safe="")
await client.delete(f"{API_URL}/{quoted_key}", timeout=5.0)
import asyncio
async with httpx.AsyncClient(timeout=30.0) as client:
tasks = [
client.delete(f"{API_URL}/{urllib.parse.quote(entry['key'], safe='')}", timeout=5.0)
for entry in to_delete
]
await asyncio.gather(*tasks)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (4)
router/tests/test_memory_mcp.py (2)

330-341: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for encoded DELETE paths.

The round-trip test covers key quoting/parsing, but the runtime also quotes the full key before DELETE. Add async tests for handle_remove_memory_category and handle_remove_specific_memory with a v2 key containing %, /, or : and assert the DELETE URL contains the fully encoded key.

🤖 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 `@router/tests/test_memory_mcp.py` around lines 330 - 341, The current
round-trip test only covers _make_key and _parse_key, but it does not verify the
DELETE path encoding used at runtime. Add async regression tests for
handle_remove_memory_category and handle_remove_specific_memory that use a v2
key containing characters like %, /, or :, and assert the DELETE request URL
includes the fully URL-encoded key. Keep the coverage aligned with the existing
key helpers (_make_key/_parse_key) so the tests validate both category encoding
and the final DELETE endpoint construction.

7-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the centralized test path setup.

This file reintroduces local project-root discovery and sys.path mutation even though this PR centralizes test path setup in tests/conftest.py. Keeping path setup in one place avoids divergent test collection behavior.

Proposed cleanup
 import json
 import re
-import sys
 import time
-from pathlib import Path
-
-# Dynamic project root discovery
-root = Path(__file__).resolve()
-while root.parent != root and not (root / ".git").exists():
-    root = root.parent
-sys.path.insert(0, str(root))
-sys.path.insert(0, str(root / "router"))
 
 import pytest
🤖 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 `@router/tests/test_memory_mcp.py` around lines 7 - 12, This test file is
duplicating project-root discovery and mutating sys.path locally, which should
be centralized in tests/conftest.py. Remove the local root-walking setup and the
sys.path.insert calls from test_memory_mcp, and rely on the shared test path
configuration used across the test suite so collection behavior stays
consistent.
scripts/benchmark_classifier.py (1)

76-90: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Semaphore(5) largely idles 15 of the 20 pool workers.

max_workers=20 but the semaphore caps actual concurrent work at 5, so most worker threads sit blocked on sem.acquire(). Not incorrect, just wasteful; max_workers=5 (or matching the semaphore) would avoid unnecessary thread creation.

🤖 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/benchmark_classifier.py` around lines 76 - 90, The ThreadPoolExecutor
in process_item_with_rate_limit is overprovisioned because the Semaphore(5)
already limits concurrency to 5, so most of the 20 worker threads just block
unnecessarily. Update the executor configuration to match the semaphore limit,
or otherwise make the semaphore and max_workers consistent in
benchmark_classifier.py so the pool size reflects the actual parallelism used by
process_item_with_rate_limit.
scripts/benchmark_tokens.py (1)

60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated magic overhead constant (50) risks drifting from estimate_prompt_tokens.

This subtracts a hardcoded 50 to back out the metadata overhead. The upstream estimate_prompt_tokens in router/main.py currently adds the same literal 50, but if that constant changes there this benchmark will silently misreport accuracy without any coupling/failure signal.

🤖 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/benchmark_tokens.py` at line 60, The benchmark calculation is coupled
to a duplicated hardcoded metadata overhead value, so update the logic in
benchmark_tokens.py to avoid subtracting a literal 50 directly. Reuse the same
named constant or shared helper used by estimate_prompt_tokens in
router/main.py, or otherwise import the overhead value from that code path, so
changes to the upstream estimate remain consistent and the benchmark stays in
sync.
🤖 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 @.agents/AGENTS.md:
- Line 26: Tighten the “Directory Rename Safety” rule in AGENTS.md because it
ambiguously ասում folder deletions instead of file deletions. Update that
guidance to refer to deleting tracked files from moved directories and keep the
instruction focused on resolving conflicts by using the refactored paths,
without implying folders themselves are staged or deleted.

In @.agents/branch_audit_plan.md:
- Around line 54-56: The verification summary in branch_audit_plan.md is stale
and reports 176 passing tests instead of the current 179. Update the Test Suite
result in the Verification Status section to match the PR’s actual passing
count, keeping the wording aligned with the existing audit log entry.

In `@litellm/entrypoint.py`:
- Around line 113-117: The _serialize_dt helper in entrypoint.py only normalizes
naive datetimes, so aware values can keep non-UTC offsets and create
inconsistent Prisma payloads. Update _serialize_dt to normalize any aware
datetime to UTC before serialization, using astimezone(timezone.utc) for
non-naive inputs and keeping the existing timezone assignment for naive ones, so
the serialized output matches the router’s UTC Z form.

In `@README.md`:
- Line 796: The Location link in README should use a repository-relative path
instead of the absolute file:///home/gpav/... URL. Update the markdown link in
the README entry for test_reasoning_tiers.py to point to the repo-relative
location so it works for all contributors and does not expose local paths.

In `@router/memory_mcp.py`:
- Around line 237-241: The delete loop in the memory removal flow ignores the
HTTP DELETE response, so failures in the encoded key path can still be reported
as successful removals. Update the logic around the async delete calls in the
category-delete branch to inspect each response status, mirroring the error
handling used by handle_remove_specific_memory, and surface 404/500 or other
non-success results instead of always returning “Removed N memory(ies)”. If some
entries succeed and others fail, report the partial failure clearly and stop or
aggregate the failures using the existing delete loop and API_URL/quoted_key
path.
- Around line 91-98: The repaired memory parsing path in `_memory_entry` can թող
`data` as non-string values, which later breaks substring checks in
`handle_remove_specific_memory`. Normalize `data` to a string at the
parser/entry boundary when repairing `val` from `json.loads(raw)`, and keep
`tags` as a list so downstream consumers always see the expected contract.

In `@scripts/benchmark_classifier.py`:
- Around line 87-97: The benchmark aggregation in benchmark_classifier.py
re-accesses item["prompt"] in the main thread, which can still crash the run for
malformed items even though process_item_with_rate_limit already handles those
errors. Update the results_list assignment inside the as_completed loop to use
the same safe item handling as process_item_with_rate_limit, ideally by carrying
a prevalidated prompt or by guarding access to item["prompt"] with a
fallback/error path. Keep the fix localized around future.result() processing
and results_list population so a bad prompt only affects that item, not the
whole benchmark.

In `@start-stack.sh`:
- Around line 230-241: The secret write path in start-stack.sh is storing
user-provided values like OLLAMA_API_KEY and other whole-value placeholders
without escaping, which can break `.env` parsing or allow shell/YAML
metacharacters to alter startup behavior. Update the code that appends to
`$ENV_FILE` and the YAML generation paths to serialize these values safely
before writing, using the existing secret-handling flow around OLLAMA_API_KEY
and applying `yaml_scalar(...)` to the other whole-value secret placeholders
referenced in the diff.
- Around line 25-36: The argument parsing in start-stack.sh only inspects $1, so
extra unexpected flags after a valid one are silently ignored. Update the
top-level option handling around the existing --full-rebuild, --replace, and
show_help branches to reject any additional arguments beyond the recognized
single flag, and make sure the script exits with an error when more than one
argument is supplied or when any extra unknown token remains after parsing.

In `@tests/conftest.py`:
- Around line 6-9: The root-detection logic in conftest.py silently falls back
to the filesystem root if the .git marker is never found, which can poison
CONFIG_PATH and sys.path setup. Update the root खोज in the top-level bootstrap
code to fail fast when the loop reaches the filesystem root without finding
.git, and raise a clear error instead of continuing with a bogus root. Keep the
fix localized around the root discovery and any subsequent path setup that
depends on that root value.

---

Nitpick comments:
In `@router/tests/test_memory_mcp.py`:
- Around line 330-341: The current round-trip test only covers _make_key and
_parse_key, but it does not verify the DELETE path encoding used at runtime. Add
async regression tests for handle_remove_memory_category and
handle_remove_specific_memory that use a v2 key containing characters like %, /,
or :, and assert the DELETE request URL includes the fully URL-encoded key. Keep
the coverage aligned with the existing key helpers (_make_key/_parse_key) so the
tests validate both category encoding and the final DELETE endpoint
construction.
- Around line 7-12: This test file is duplicating project-root discovery and
mutating sys.path locally, which should be centralized in tests/conftest.py.
Remove the local root-walking setup and the sys.path.insert calls from
test_memory_mcp, and rely on the shared test path configuration used across the
test suite so collection behavior stays consistent.

In `@scripts/benchmark_classifier.py`:
- Around line 76-90: The ThreadPoolExecutor in process_item_with_rate_limit is
overprovisioned because the Semaphore(5) already limits concurrency to 5, so
most of the 20 worker threads just block unnecessarily. Update the executor
configuration to match the semaphore limit, or otherwise make the semaphore and
max_workers consistent in benchmark_classifier.py so the pool size reflects the
actual parallelism used by process_item_with_rate_limit.

In `@scripts/benchmark_tokens.py`:
- Line 60: The benchmark calculation is coupled to a duplicated hardcoded
metadata overhead value, so update the logic in benchmark_tokens.py to avoid
subtracting a literal 50 directly. Reuse the same named constant or shared
helper used by estimate_prompt_tokens in router/main.py, or otherwise import the
overhead value from that code path, so changes to the upstream estimate remain
consistent and the benchmark stays in sync.
🪄 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: d8828451-95ab-44f0-b8a6-3b6f1308df1f

📥 Commits

Reviewing files that changed from the base of the PR and between c304f3d and a08d453.

⛔ Files ignored due to path filters (1)
  • debug-homepage.png is excluded by !**/*.png
📒 Files selected for processing (53)
  • .agents/AGENTS.md
  • .agents/branch_audit_plan.md
  • .agents/jules_regression_analysis.md
  • .github/workflows/test.yml
  • README.md
  • get_pr_status.py
  • litellm/entrypoint.py
  • pod.yaml
  • router/Dockerfile
  • router/agy_proxy.py
  • router/main.py
  • router/memory_mcp.py
  • router/test_memory_mcp.py
  • router/tests/test_agy_proxy.py
  • router/tests/test_detect_active_tool.py
  • router/tests/test_estimate_prompt_tokens.py
  • router/tests/test_get_gemini_oauth_status.py
  • router/tests/test_get_goose_sessions.py
  • router/tests/test_get_redis.py
  • router/tests/test_load_persisted_stats.py
  • router/tests/test_memory_mcp.py
  • scripts/README.md
  • scripts/benchmark_classifier.py
  • scripts/benchmark_tokens.py
  • scripts/get_pr_status.py
  • scripts/host_agy_daemon.py
  • scripts/sync_gemini_token.py
  • scripts/test_quota_reset.sh
  • scripts/verification/test_reasoning_tiers.py
  • scripts/verification/verify_breaker.py
  • scripts/watch_quota.sh
  • start-stack.sh
  • test_memory_mcp.py
  • tests/conftest.py
  • tests/test_a2_verify.py
  • tests/test_agy_behavior.py
  • tests/test_agy_tiers.py
  • tests/test_antigravity.py
  • tests/test_atomic_write.py
  • tests/test_check_http_endpoint.py
  • tests/test_circuit_breaker.py
  • tests/test_classifier_accuracy.py
  • tests/test_compute_free_model_score.py
  • tests/test_get_pr_status.py
  • tests/test_host_agy_daemon.py
  • tests/test_map_tool_to_category.py
  • tests/test_models_proxy.py
  • tests/test_pie_chart_gradient.py
  • tests/test_read_annotations_async.py
  • tests/test_record_tool_usage.py
  • tests/test_src_badge.py
  • tests/test_stream_latency.py
  • tests/test_sync_gemini_token.py
💤 Files with no reviewable changes (6)
  • tests/test_models_proxy.py
  • get_pr_status.py
  • tests/test_a2_verify.py
  • router/test_memory_mcp.py
  • test_memory_mcp.py
  • tests/test_circuit_breaker.py

Comment thread .agents/AGENTS.md Outdated
Comment thread .agents/branch_audit_plan.md Outdated
Comment on lines +54 to +56
## Verification Status
* **Test Suite:** Ran `PYTHONPATH=router:. pytest`
* **Result:** **176 tests passed** successfully (100% success rate).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Refresh the reported test result.

This says 176 passing tests, but the PR context says 179 unit and integration tests pass. Please update the recorded count so the audit log stays accurate.

♻️ Proposed fix
-* **Result:** **176 tests passed** successfully (100% success rate).
+* **Result:** **179 tests passed** successfully (100% success rate).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Verification Status
* **Test Suite:** Ran `PYTHONPATH=router:. pytest`
* **Result:** **176 tests passed** successfully (100% success rate).
## Verification Status
* **Test Suite:** Ran `PYTHONPATH=router:. pytest`
* **Result:** **179 tests passed** successfully (100% success rate).
🤖 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 @.agents/branch_audit_plan.md around lines 54 - 56, The verification summary
in branch_audit_plan.md is stale and reports 176 passing tests instead of the
current 179. Update the Test Suite result in the Verification Status section to
match the PR’s actual passing count, keeping the wording aligned with the
existing audit log entry.

Comment thread litellm/entrypoint.py Outdated
Comment thread README.md Outdated
Comment thread router/memory_mcp.py
Comment thread router/memory_mcp.py Outdated
Comment thread scripts/benchmark_classifier.py
Comment thread start-stack.sh
Comment thread start-stack.sh Outdated
Comment thread tests/conftest.py
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.

1 participant