Skip to content

Comments

[chore] Use port-aware cookies#3779

Open
junaway wants to merge 5 commits intomainfrom
fix/port-aware-cookies
Open

[chore] Use port-aware cookies#3779
junaway wants to merge 5 commits intomainfrom
fix/port-aware-cookies

Conversation

@junaway
Copy link
Contributor

@junaway junaway commented Feb 18, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 18, 2026 13:38
@vercel
Copy link

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Feb 20, 2026 9:26am

Request Review

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the OSS web, API, and SDK auth flows to support port-aware (namespaced) cookies for local multi-environment setups, reducing session/cookie collisions when running multiple instances on the same host.

Changes:

  • Add helpers to derive a local cookie name suffix and apply it to region selection, PostHog persistence, and SuperTokens cookie handling in the OSS frontend.
  • Add server-side SuperTokens cookie name overrides (API) and update auth/analytics services to read the access token from port-suffixed cookies.
  • Update the Python SDK middleware and Playwright teardown to look up the correct access-token cookie name in local environments.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/tests/playwright/global-teardown.ts Extract access token from state.json using a port-aware cookie name heuristic.
web/oss/src/lib/helpers/region.ts Namespace the region preference cookie key using a local port suffix.
web/oss/src/lib/helpers/cookies.ts Introduce a helper for deriving a local cookie port suffix.
web/oss/src/lib/helpers/auth/supertokensCookieHandler.ts Add a SuperTokens cookie handler wrapper to rewrite cookie names for local namespacing.
web/oss/src/lib/helpers/analytics/AgPosthogProvider.tsx Allow injecting PostHog config and namespace persistence in local dev.
web/oss/src/config/frontendConfig.ts Wire the local SuperTokens cookie handler into the frontend config.
sdk/agenta/sdk/middlewares/routing/auth.py Use a port-aware sAccessToken_<port> cookie name for localhost/IP hosts.
api/test-auth.http Document port-suffixed cookie behavior in local multi-env setups.
api/oss/src/services/auth_service.py Read access token from cookies via the new SuperTokens cookie-name helper.
api/oss/src/services/analytics_service.py Detect session auth via the new cookie-name helper.
api/oss/src/core/auth/supertokens/cookie_names.py Add API-side logic to compute/override SuperTokens cookie names (port suffixing) and helpers to read cookies.
api/oss/src/core/auth/supertokens/config.py Apply SuperTokens cookie-name overrides during SuperTokens initialization.
api/ee/tests/manual/auth/QUICK-START.md Document port-suffixed cookie names for local usage.
api/ee/tests/manual/auth/04-policy-enforcement.http Document port-suffixed cookie names for local usage.
api/ee/tests/manual/auth/03-identity-tracking.http Document port-suffixed cookie names for local usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 18, 2026 13:46
@junaway junaway marked this pull request as draft February 18, 2026 13:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@junaway junaway changed the title [fix] Use port-aware cookies [chore] Use port-aware cookies Feb 20, 2026
@junaway junaway marked this pull request as ready for review February 20, 2026 10:01
Copilot AI review requested due to automatic review settings February 20, 2026 10:01
@dosubot dosubot bot added the feature label Feb 20, 2026
@dosubot dosubot bot added the tests label Feb 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend feature Frontend SDK size:L This PR changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants