GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — feat(relay): Add managed relay tunnels and APN service by juliusmarminge · Pull Request #2837 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
554a1d2 to
8480c92
Compare
65c36c0 to
a7ed828
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
8480c92 to
e3ab348
Compare
a7ed828 to
b868fee
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
e3ab348 to
436b1b9
Compare
b868fee to
589e2ed
Compare
436b1b9 to
d20a8ce
Compare
63a525d to
8027af0
Compare
6c0e54d to
f15e2ba
Compare
8027af0 to
1a912f6
Compare
f15e2ba to
71e0186
Compare
1a912f6 to
90bf2b3
Compare
71e0186 to
e721336
Compare
e63e3f4 to
ba9802d
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
22e103a to
60b7d8d
Compare
ba9802d to
8789910
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
60b7d8d to
ee4ec05
Compare
8789910 to
f7ac694
Compare
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: codex <[email protected]>
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 6 total unresolved issues (including 5 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting:
@cursor push 4ee9127816
diff --git a/apps/desktop/src/app/DesktopCloudAuth.test.ts b/apps/desktop/src/app/DesktopCloudAuth.test.ts --- a/apps/desktop/src/app/DesktopCloudAuth.test.ts +++ b/apps/desktop/src/app/DesktopCloudAuth.test.ts @@ -299,4 +299,34 @@ }).pipe(Effect.provide(harness.layer), Effect.scoped); }, ); + + it.effect("dispatches cold-start callback URL from process.argv on Windows/Linux", () => { + const callbackUrl = + "t3code://auth/callback?t3_state=prev-session-state&rotating_token_nonce=nonce-1"; + const originalArgv = process.argv; + process.argv = ["electron", callbackUrl]; + const harness = makeHarness({ isDevelopment: false }); + + return Effect.gen(function* () { + const cloudAuth = yield* DesktopCloudAuth.DesktopCloudAuth; + yield* cloudAuth.configure; + yield* flushCloudAuthDispatch; + + assert.deepEqual(harness.sends, [ + { + channel: IpcChannels.CLOUD_AUTH_CALLBACK_CHANNEL, + args: [callbackUrl], + }, + ]); + assert.lengthOf(harness.reveals, 1); + }).pipe( + Effect.ensuring( + Effect.sync(() => { + process.argv = originalArgv; + }), + ), + Effect.provide(harness.layer), + Effect.scoped, + ); + }); }); diff --git a/apps/desktop/src/app/DesktopCloudAuth.ts b/apps/desktop/src/app/DesktopCloudAuth.ts --- a/apps/desktop/src/app/DesktopCloudAuth.ts +++ b/apps/desktop/src/app/DesktopCloudAuth.ts @@ -66,10 +66,9 @@ return url.toString(); } -export function parseCloudAuthCallbackUrl(input: { +export function matchCloudAuthCallbackRoute(input: { readonly rawUrl: unknown; readonly scheme: string; - readonly state: string; }): URL | null { if (typeof input.rawUrl !== "string") { return null; @@ -80,13 +79,23 @@ if (url.protocol !== `${input.scheme}:`) return null; if (url.hostname !== CLOUD_AUTH_CALLBACK_HOST) return null; if (url.pathname !== CLOUD_AUTH_CALLBACK_PATHNAME) return null; - if (url.searchParams.get(CLOUD_AUTH_CALLBACK_STATE_PARAM) !== input.state) return null; return url; } catch { return null; } } +export function parseCloudAuthCallbackUrl(input: { + readonly rawUrl: unknown; + readonly scheme: string; + readonly state: string; +}): URL | null { + const url = matchCloudAuthCallbackRoute(input); + if (!url) return null; + if (url.searchParams.get(CLOUD_AUTH_CALLBACK_STATE_PARAM) !== input.state) return null; + return url; +} + export function findCloudAuthCallbackUrl(input: { readonly values: readonly unknown[]; readonly scheme: string; @@ -323,6 +332,28 @@ ); }, ); + + // On Windows/Linux cold start, the protocol callback URL is delivered + // via process.argv rather than a second-instance or open-url event. + const coldStartValues = resolveProtocolClientLaunchArgs({ argv: process.argv }); + for (const value of coldStartValues) { + const coldStartUrl = matchCloudAuthCallbackRoute({ rawUrl: value, scheme }); + if (!coldStartUrl) continue; + pendingAuthRequest = closeCloudAuthRequest(pendingAuthRequest); + void runPromise( + Effect.gen(function* () { + yield* electronWindow.sendAll( + IpcChannels.CLOUD_AUTH_CALLBACK_CHANNEL, + coldStartUrl.toString(), + ); + const mainWindow = yield* electronWindow.currentMainOrFirst; + if (Option.isSome(mainWindow)) { + yield* electronWindow.reveal(mainWindow.value); + } + }), + ); + break; + } }).pipe(Effect.withSpan("desktop.cloudAuth.configure")), }); });
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 6 total unresolved issues (including 5 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
electronApp.quit (async graceful shutdown) with electronApp.exit(0) (immediate process termination) so the duplicate instance cannot proceed with backend bootstrap or window creation.Or push these changes by commenting:
@cursor push 1dbb6b6ec0
diff --git a/apps/desktop/src/app/DesktopCloudAuth.ts b/apps/desktop/src/app/DesktopCloudAuth.ts --- a/apps/desktop/src/app/DesktopCloudAuth.ts +++ b/apps/desktop/src/app/DesktopCloudAuth.ts @@ -292,7 +292,7 @@ const hasInstanceLock = yield* electronApp.requestSingleInstanceLock; if (!hasInstanceLock) { - return yield* electronApp.quit; + return yield* electronApp.exit(0); } yield* electronApp.on<[Electron.Event, string]>("open-url", (event, rawUrl) => {
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const hasInstanceLock = yield* electronApp.requestSingleInstanceLock; | ||
| if (!hasInstanceLock) { | ||
| return yield* electronApp.quit; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Medium Severity
When requestSingleInstanceLock is false, configure only calls app.quit() and returns. Startup in DesktopApp still proceeds to whenReady and backend bootstrap, so a duplicate desktop process can briefly run two servers or windows instead of exiting immediately.
Reviewed by Cursor Bugbot for commit 640dc63. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 7 total unresolved issues (including 6 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting:
@cursor push a98d0e596a
diff --git a/apps/mobile/src/features/agent-awareness/liveActivityController.ts b/apps/mobile/src/features/agent-awareness/liveActivityController.ts --- a/apps/mobile/src/features/agent-awareness/liveActivityController.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityController.ts @@ -598,6 +598,10 @@ return error instanceof Error && error.message.includes("Can't find live activity with id:"); } +export function setLocalLiveActivitiesEnabled(enabled: boolean): void { + localLiveActivitiesEnabled = enabled; +} + export function __resetAgentLiveActivitiesForTest(): void { localLiveActivitiesEnabled = true; activeActivity = null; diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts @@ -8,7 +8,7 @@ import type { SavedRemoteConnection } from "../../lib/connection"; import { savePreferencesPatch } from "../../lib/storage"; import { linkEnvironmentToCloud } from "../cloud/linkEnvironment"; -import { endAllAgentLiveActivities } from "./liveActivityController"; +import { endAllAgentLiveActivities, setLocalLiveActivitiesEnabled } from "./liveActivityController"; import { setLiveActivityUpdatesEnabled } from "./liveActivityPreferences"; import { refreshAgentAwarenessRegistration } from "./remoteRegistration"; @@ -22,6 +22,7 @@ vi.mock("./liveActivityController", () => ({ endAllAgentLiveActivities: vi.fn(() => Effect.void), + setLocalLiveActivitiesEnabled: vi.fn(), })); vi.mock("./remoteRegistration", () => ({ diff --git a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts --- a/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts +++ b/apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts @@ -3,11 +3,18 @@ import { ManagedRelayClient } from "@t3tools/client-runtime"; import type { SavedRemoteConnection } from "../../lib/connection"; -import { savePreferencesPatch } from "../../lib/storage"; +import { loadPreferences, savePreferencesPatch } from "../../lib/storage"; import { linkEnvironmentToCloud } from "../cloud/linkEnvironment"; -import { endAllAgentLiveActivities } from "./liveActivityController"; +import { endAllAgentLiveActivities, setLocalLiveActivitiesEnabled } from "./liveActivityController"; import { refreshAgentAwarenessRegistration } from "./remoteRegistration"; +export async function initializeLiveActivityPreferenceState(): Promise<void> { + const preferences = await loadPreferences(); + if (preferences.liveActivitiesEnabled === false) { + setLocalLiveActivitiesEnabled(false); + } +} + export function setLiveActivityUpdatesEnabled(input: { readonly enabled: boolean; readonly clerkToken: string | null; @@ -19,6 +26,8 @@ catch: (error) => error, }); + setLocalLiveActivitiesEnabled(input.enabled); + if (!input.enabled) { yield* endAllAgentLiveActivities(); } diff --git a/apps/mobile/src/state/use-remote-environment-registry.ts b/apps/mobile/src/state/use-remote-environment-registry.ts --- a/apps/mobile/src/state/use-remote-environment-registry.ts +++ b/apps/mobile/src/state/use-remote-environment-registry.ts @@ -59,6 +59,7 @@ stopAgentAwarenessForEnvironment, stopAllAgentAwareness, } from "../features/agent-awareness/shellLiveActivitySync"; +import { initializeLiveActivityPreferenceState } from "../features/agent-awareness/liveActivityPreferences"; import { environmentRuntimeManager, useEnvironmentRuntimeStates } from "./use-environment-runtime"; import { clearCachedShellSnapshotMetadata, @@ -565,6 +566,11 @@ return; } + await initializeLiveActivityPreferenceState(); + if (cancelled) { + return; + } + replaceSavedConnections( Object.fromEntries( connections.map((connection) => [connection.environmentId, connection]),
You can send follow-ups to the cloud agent here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 7 total unresolved issues (including 6 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting:
@cursor push 4d22a1f898
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit ee69e93. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| "if (status !== 0) throw new Error(`LSSetDefaultHandlerForURLScheme failed: ${status}`);", | ||
| ].join(" "), | ||
| ]); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Medium Severity
Development builds give each worktree a unique bundle id but still register the same t3code-dev URL scheme and call LSSetDefaultHandlerForURLScheme for it. macOS keeps one default handler per scheme, so the last dev launch steals cloud OAuth callbacks from other local worktrees.
Reviewed by Cursor Bugbot for commit ee69e93. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.