Repository navigation
fix(mcp): read overlay cohort for pr_review_context simulation session - #1134
Merged
zzet merged 1 commit intoOct 26, 2026
Conversation
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
3 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pr_review_contextfalls back toSessionIDFromContextwhen nosession_idparam is given, but the value it picks is an overlay session that gets passed to the simulation. Since #649, overlay-scoped call sites are supposed to useOverlayCohortIDFromContext. Because this one didn't, a caller that setsX-Gortex-Overlay-Sessiongot a simulation run against their own transport session's overlay instead of the cohort they asked for.Changes
OverlayCohortIDFromContext(ctx)instead ofSessionIDFromContext(ctx). When no cohort override is set, this returns the same value as before.buildSimulationwithWithOverlayCohortIDinstead ofWithSessionID.buildSimulationreadsOverlayCohortIDFromContext, so with the old code a cohort set on the context would still win over an explicitsession_idparam. Without a cohort set, behaviour is unchanged.TestPRReviewContext_SimulateUsesOverlayCohort. With a cohort set on the context it checks that the simulation uses the cohort and not the real session, and that an explicitsession_idstill takes precedence.I also went through the other
SessionIDFromContextconsumers again (session/token stats, localization, agent registry, query log, diagnostics/health/readiness/stale-refs/graph-invalidated subscriptions, notes,tools_llm,tools_proxy). They all key per-session state rather than overlay scope, so I left them as they are.Testing
main(expected: \"pr-review-cohort\", actual: \"real-transport-session\") and passes with the fixgo test -race ./internal/mcp -run 'TestPRReviewContext_|Simulat|Overlay|Cohort'passesgo vet ./internal/mcpandgofmt -lare cleanThe full
go test -race ./...suite was not run locally.Checklist
Fixes #708