fix: scope evaluation results by user identity#212
Conversation
Add user identity to agent success evaluation result identity and retrieval paths so users with the same session or request IDs do not collide.\n\nAlso keep evaluation-only session data in the agent-success precheck path and cover the behavior with focused regression tests.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds Changesuser_id scoping for evaluation identity
Sequence Diagram(s)sequenceDiagram
participant Client
participant grade_on_demand
participant storage
participant AgentSuccessEvaluationService
participant AgentSuccessEvaluator
Client->>grade_on_demand: POST /api/evaluations/grade_on_demand {user_id, session_id, ...}
grade_on_demand->>storage: get_agent_success_evaluation_result_ids(user_id, session_id, ...)
storage-->>grade_on_demand: previous_result_ids
grade_on_demand->>AgentSuccessEvaluationService: run(request{user_id, session_id, ...})
AgentSuccessEvaluationService->>AgentSuccessEvaluationService: _load_generation_service_config → AgentSuccessGenerationServiceConfig{user_id}
AgentSuccessEvaluationService->>AgentSuccessEvaluator: evaluate(service_config{user_id})
AgentSuccessEvaluator->>AgentSuccessEvaluator: _build_evaluation_result → AgentSuccessEvaluationResult{user_id}
AgentSuccessEvaluator->>storage: save_agent_success_evaluation_results([result{user_id}])
AgentSuccessEvaluator-->>grade_on_demand: result saved
grade_on_demand->>storage: get_agent_success_evaluation_result_ids(user_id, session_id, ...) [find fresh]
storage-->>grade_on_demand: fresh_result_id
grade_on_demand-->>Client: evaluation result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
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 docstrings
🧪 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 |
Summary
Changes
Test Plan
uv run ruff checkon staged Python filesuv run ruff formaton staged Python filesuv run pyrighton staged Python filesuv run pytest tests/server/services/agent_success_evaluation/test_agent_success_evaluation_services.py -q --no-covSummary by CodeRabbit
New Features
Database