feat(ext): expose the detected session ID to request rewriters - #612
feat(ext): expose the detected session ID to request rewriters#612SantiagoDePolonia wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesSession ID propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 1
🤖 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 `@internal/server/request_rewrite_test.go`:
- Around line 122-154: Convert TestRequestRewriteMiddlewareExposesSessionID into
a table-driven test covering both a populated session ID and an absent session
ID. For each case, configure the session-stamping middleware accordingly,
execute the request, and assert the rewriter observes the expected session
value, including an empty default when no session is present.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: ef829019-e33f-432e-920d-8082be09d54a
📒 Files selected for processing (3)
ext/ext.gointernal/server/request_rewrite.gointernal/server/request_rewrite_test.go
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The session-capture middleware runs before request rewriting and stores the identifier in the same request context from which the new field is populated; existing repository construction of the extended input uses keyed fields. Files Needing Attention: No files need attention.
What T-Rex did
Reviews (1): Last reviewed commit: "feat(ext): expose the detected session I..." | Re-trigger Greptile |
3d71ff7 to
1a3bd5b
Compare
Session detection already runs before the rewrite middleware, so the scoped session ID is sitting in the request context when rewriters fire. Surfacing it on ext.Input lets a rewriter keep per-conversation decisions stable — for example pinning a model-tier choice to the session instead of re-deciding on every message. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1a3bd5b to
5a91572
Compare
Summary
Adds
SessionIDtoext.Input. Session detection (SessionCapture) already runs beforeRequestRewriteMiddleware, so the user-path-scoped session ID is in the request context when rewriters fire — this just surfaces it.Motivation: lets a rewriter keep per-conversation decisions stable across messages, e.g. GoModel Pro's content-aware tier router pinning its easy/hard model choice to the session instead of re-deciding (and potentially flip-flopping) on every message.
Stacked on #611 (base:
feat/ext-route-selector); rebase tomainif it lands first.Tests
TestRequestRewriteMiddlewareExposesSessionID— stamps a session viaExtraMiddleware(which runs before rewriters, standing in for the detector) and asserts the rewriter observes it.🤖 Generated with Claude Code
Summary by CodeRabbit