Skip to content

Commit 379296d

Browse files
refactor: rename pre_auth to eager_auth
Signed-off-by: Patrick Chin <8509935+thepatrickchin@users.noreply.github.com>
1 parent 21245f8 commit 379296d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

components/Chat/Chat.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ export const Chat = () => {
375375
wsUrl += `${wsUrl.includes('?') ? '&' : '?'}conversation_id=${encodeURIComponent(conversationId)}`;
376376
}
377377

378-
// Skip pre-auth if the user previously declined it OR is returning from a cancelled OAuth
378+
// Skip eager auth if the user previously declined it OR is returning from a cancelled OAuth
379379
// right now. The oauth_auth_error param is checked directly because the cleanup effect
380-
// (which sets oauth_pre_auth_declined) runs after this effect due to declaration order.
380+
// (which sets oauth_eager_auth_declined) runs after this effect due to declaration order.
381381
const currentUrlParams = new URLSearchParams(window.location.search);
382-
const preAuthDeclined = sessionStorage.getItem('oauth_pre_auth_declined') === 'true'
382+
const eagerAuthDeclined = sessionStorage.getItem('oauth_eager_auth_declined') === 'true'
383383
|| (!!currentUrlParams.get('oauth_auth_error') && !sessionStorage.getItem('oauth_pending_message'));
384-
if (preAuthDeclined) {
385-
wsUrl += `${wsUrl.includes('?') ? '&' : '?'}skip_pre_auth=true`;
384+
if (eagerAuthDeclined) {
385+
wsUrl += `${wsUrl.includes('?') ? '&' : '?'}skip_eager_auth=true`;
386386
}
387387

388388
// Append custom parameters from settings (query + headers encoded for proxy)
@@ -746,7 +746,7 @@ export const Chat = () => {
746746
const messageConversationId = message.conversation_id;
747747
const currentConversationId = selectedConversationRef.current?.id;
748748

749-
// OAuth consent messages from pre-auth have no conversation_id and no active message.
749+
// OAuth consent messages from eager auth have no conversation_id and no active message.
750750
// Handle them before the conversation filter so they are never dropped.
751751
if (isSystemInteractionMessage(message) && message?.content?.input_type === 'oauth_consent') {
752752
const oauthUrl =
@@ -1525,13 +1525,13 @@ export const Chat = () => {
15251525
const pendingMessageRaw = sessionStorage.getItem('oauth_pending_message');
15261526
const pendingConversationId = sessionStorage.getItem('oauth_pending_conversation_id');
15271527
if (!pendingMessageRaw || !pendingConversationId) {
1528-
// No pending message means this was a page-load pre-auth.
1528+
// No pending message means this was a page-load eager auth.
15291529
if (authError) {
1530-
// User declined pre-auth; skip it on reconnect to avoid a redirect loop.
1531-
sessionStorage.setItem('oauth_pre_auth_declined', 'true');
1530+
// User declined eager auth; skip it on reconnect to avoid a redirect loop.
1531+
sessionStorage.setItem('oauth_eager_auth_declined', 'true');
15321532
} else if (authCompleted) {
1533-
// Successful auth clears any prior decline so pre-auth resumes on future connections.
1534-
sessionStorage.removeItem('oauth_pre_auth_declined');
1533+
// Successful auth clears any prior decline so eager auth resumes on future connections.
1534+
sessionStorage.removeItem('oauth_eager_auth_declined');
15351535
}
15361536
return;
15371537
}
@@ -1540,9 +1540,9 @@ export const Chat = () => {
15401540
sessionStorage.removeItem('oauth_pending_message');
15411541
sessionStorage.removeItem('oauth_pending_conversation_id');
15421542

1543-
// Successful mid-workflow auth clears any pre-auth decline flag.
1543+
// Successful mid-workflow auth clears any eager auth decline flag.
15441544
if (authCompleted) {
1545-
sessionStorage.removeItem('oauth_pre_auth_declined');
1545+
sessionStorage.removeItem('oauth_eager_auth_declined');
15461546
}
15471547

15481548
// If the user pressed back without completing OAuth, show a cancellation message.

types/websocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export function validateWebSocketMessageWithConversationId(message: any): messag
174174
);
175175
}
176176

177-
// OAuth consent messages sent at connection time (pre-auth) have no conversation yet.
177+
// OAuth consent messages sent at connection time (eager auth) have no conversation yet.
178178
// Allow them through without a conversation_id.
179179
if (message.type === 'system_interaction_message' && message.content?.input_type === 'oauth_consent') {
180180
return true;

0 commit comments

Comments
 (0)