Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .trajectories/active/traj_rsavt0jipi3c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "traj_rsavt0jipi3c",
"version": 1,
"task": {
"title": "Power agent session - ready for tasks"
},
"status": "active",
"startedAt": "2026-01-08T07:54:35.678Z",
"agents": [
{
"name": "khaliqgant",
"role": "lead",
"joinedAt": "2026-01-08T07:54:35.679Z"
}
],
"chapters": [
{
"id": "chap_cgughl8lm8b5",
"title": "Work",
"agentName": "default",
"startedAt": "2026-01-08T08:04:56.261Z",
"events": [
{
"ts": 1767859496262,
"type": "decision",
"content": "Fixed cloud link auth flow - two bugs: Fixed cloud link auth flow - two bugs",
"raw": {
"question": "Fixed cloud link auth flow - two bugs",
"chosen": "Fixed cloud link auth flow - two bugs",
"alternatives": [],
"reasoning": "1) Cloud link page checked for data.userId but API returns data.authenticated + data.user.id. 2) Login page ignored return URL param, so after login it went to /app instead of back to cloud link page"
},
"significance": "high"
},
{
"ts": 1767859507874,
"type": "decision",
"content": "Fixed login page return URL support: Fixed login page return URL support",
"raw": {
"question": "Fixed login page return URL support",
"chosen": "Fixed login page return URL support",
"alternatives": [],
"reasoning": "Added useSearchParams to read return query param and redirect back after login instead of always going to /app"
},
"significance": "high"
}
]
}
],
"commits": [],
"filesChanged": [],
"projectId": "/Users/khaliqgant/Projects/agent-workforce/relay",
"tags": []
}
8 changes: 7 additions & 1 deletion .trajectories/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 1,
"lastUpdated": "2026-01-07T21:41:49.091Z",
"lastUpdated": "2026-01-08T08:05:07.874Z",
"trajectories": {
"traj_ozd98si6a7ns": {
"title": "Fix thinking indicator showing on all messages",
Expand Down Expand Up @@ -498,6 +498,12 @@
"startedAt": "2026-01-07T21:41:28.024Z",
"completedAt": "2026-01-07T21:41:49.080Z",
"path": "/Users/khaliqgant/Projects/agent-workforce/relay/.trajectories/completed/2026-01/traj_lgtodco7dp1n.json"
},
"traj_rsavt0jipi3c": {
"title": "Power agent session - ready for tasks",
"status": "active",
"startedAt": "2026-01-08T07:54:35.678Z",
"path": "/Users/khaliqgant/Projects/agent-workforce/relay/.trajectories/active/traj_rsavt0jipi3c.json"
}
}
}
4 changes: 2 additions & 2 deletions src/dashboard/app/cloud/link/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ function CloudLinkContent() {

const checkAuth = async () => {
try {
const data = await api.get<{ userId?: string }>('/api/auth/session');
if (data.userId) {
const data = await api.get<{ authenticated?: boolean; user?: { id: string } }>('/api/auth/session');
if (data.authenticated && data.user?.id) {
setState('ready');
} else {
setState('auth-required');
Expand Down
14 changes: 12 additions & 2 deletions src/dashboard/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
'use client';

import React, { useState, useEffect, useRef } from 'react';
import { useSearchParams } from 'next/navigation';
import Nango from '@nangohq/frontend';
import { LogoIcon } from '../../react-components/Logo';

export default function LoginPage() {
const searchParams = useSearchParams();
const [isReady, setIsReady] = useState(false);
const [isAuthenticating, setIsAuthenticating] = useState(false);
const [authStatus, setAuthStatus] = useState<string>('');
const [error, setError] = useState('');

// Get return URL from query params (used by cloud link flow)
const returnUrl = searchParams.get('return');

// Store Nango instance and session token - initialized on mount
const nangoRef = useRef<InstanceType<typeof Nango> | null>(null);
Expand Down Expand Up @@ -82,8 +87,13 @@ export default function LoginPage() {
try {
const result = await checkAuthStatus(connectionId);
if (result && result.ready) {
// Redirect to connect-repos if no repos, otherwise to app
window.location.href = result.hasRepos ? '/app' : '/connect-repos';
// Redirect to return URL if provided (e.g., cloud link flow),
// otherwise to connect-repos if no repos, or to app
if (returnUrl) {
window.location.href = returnUrl;
} else {
window.location.href = result.hasRepos ? '/app' : '/connect-repos';
}
return;
}

Expand Down
Loading