Reduce remaining remote URL debug detail
This commit is contained in:
@@ -181,7 +181,7 @@ export async function initEnvLessBridgeCore(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const sessionId: string = createdSessionId
|
const sessionId: string = createdSessionId
|
||||||
logForDebugging(`[remote-bridge] Created session ${sessionId}`)
|
logForDebugging('[remote-bridge] Created remote bridge session')
|
||||||
logForDiagnosticsNoPII('info', 'bridge_repl_v2_session_created')
|
logForDiagnosticsNoPII('info', 'bridge_repl_v2_session_created')
|
||||||
|
|
||||||
// ── 2. Fetch bridge credentials (POST /bridge → worker_jwt, expires_in, api_base_url) ──
|
// ── 2. Fetch bridge credentials (POST /bridge → worker_jwt, expires_in, api_base_url) ──
|
||||||
@@ -214,7 +214,7 @@ export async function initEnvLessBridgeCore(
|
|||||||
|
|
||||||
// ── 3. Build v2 transport (SSETransport + CCRClient) ────────────────────
|
// ── 3. Build v2 transport (SSETransport + CCRClient) ────────────────────
|
||||||
const sessionUrl = buildCCRv2SdkUrl(credentials.api_base_url, sessionId)
|
const sessionUrl = buildCCRv2SdkUrl(credentials.api_base_url, sessionId)
|
||||||
logForDebugging(`[remote-bridge] v2 session URL: ${sessionUrl}`)
|
logForDebugging('[remote-bridge] Configured v2 session transport endpoint')
|
||||||
|
|
||||||
let transport: ReplBridgeTransport
|
let transport: ReplBridgeTransport
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1365,7 +1365,7 @@ export async function initBridgeCore(
|
|||||||
const sessionUrl = buildCCRv2SdkUrl(baseUrl, workSessionId)
|
const sessionUrl = buildCCRv2SdkUrl(baseUrl, workSessionId)
|
||||||
const thisGen = v2Generation
|
const thisGen = v2Generation
|
||||||
logForDebugging(
|
logForDebugging(
|
||||||
`[bridge:repl] CCR v2: sessionUrl=${sessionUrl} session=${workSessionId} gen=${thisGen}`,
|
`[bridge:repl] CCR v2: creating transport for session=${workSessionId} gen=${thisGen}`,
|
||||||
)
|
)
|
||||||
void createV2ReplTransport({
|
void createV2ReplTransport({
|
||||||
sessionUrl,
|
sessionUrl,
|
||||||
@@ -1435,7 +1435,7 @@ export async function initBridgeCore(
|
|||||||
// secret. refreshHeaders picks up the latest OAuth token on each
|
// secret. refreshHeaders picks up the latest OAuth token on each
|
||||||
// WS reconnect attempt.
|
// WS reconnect attempt.
|
||||||
const wsUrl = buildSdkUrl(sessionIngressUrl, workSessionId)
|
const wsUrl = buildSdkUrl(sessionIngressUrl, workSessionId)
|
||||||
logForDebugging(`[bridge:repl] Ingress URL: ${wsUrl}`)
|
logForDebugging('[bridge:repl] Using session ingress WebSocket endpoint')
|
||||||
logForDebugging(
|
logForDebugging(
|
||||||
`[bridge:repl] Creating HybridTransport: session=${workSessionId}`,
|
`[bridge:repl] Creating HybridTransport: session=${workSessionId}`,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ export class SessionsWebSocket {
|
|||||||
const baseUrl = getOauthConfig().BASE_API_URL.replace('https://', 'wss://')
|
const baseUrl = getOauthConfig().BASE_API_URL.replace('https://', 'wss://')
|
||||||
const url = `${baseUrl}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`
|
const url = `${baseUrl}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`
|
||||||
|
|
||||||
logForDebugging(`[SessionsWebSocket] Connecting to ${url}`)
|
logForDebugging(
|
||||||
|
'[SessionsWebSocket] Connecting to session subscription endpoint',
|
||||||
|
)
|
||||||
|
|
||||||
// Get fresh token for each connection attempt
|
// Get fresh token for each connection attempt
|
||||||
const accessToken = this.getAccessToken()
|
const accessToken = this.getAccessToken()
|
||||||
|
|||||||
@@ -19,6 +19,25 @@ interface SessionIngressError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function summarizeSessionIngressPayload(payload: unknown): string {
|
||||||
|
if (payload === null) return 'null'
|
||||||
|
if (payload === undefined) return 'undefined'
|
||||||
|
if (Array.isArray(payload)) return `array(${payload.length})`
|
||||||
|
if (typeof payload === 'object') {
|
||||||
|
const value = payload as Record<string, unknown>
|
||||||
|
return jsonStringify({
|
||||||
|
payloadType: 'object',
|
||||||
|
keys: Object.keys(value)
|
||||||
|
.sort()
|
||||||
|
.slice(0, 10),
|
||||||
|
loglinesCount: Array.isArray(value.loglines) ? value.loglines.length : 0,
|
||||||
|
dataCount: Array.isArray(value.data) ? value.data.length : 0,
|
||||||
|
hasNextCursor: typeof value.next_cursor === 'string',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return typeof payload
|
||||||
|
}
|
||||||
|
|
||||||
// Module-level state
|
// Module-level state
|
||||||
const lastUuidMap: Map<string, UUID> = new Map()
|
const lastUuidMap: Map<string, UUID> = new Map()
|
||||||
|
|
||||||
@@ -249,7 +268,7 @@ export async function getSessionLogsViaOAuth(
|
|||||||
orgUUID: string,
|
orgUUID: string,
|
||||||
): Promise<Entry[] | null> {
|
): Promise<Entry[] | null> {
|
||||||
const url = `${getOauthConfig().BASE_API_URL}/v1/session_ingress/session/${sessionId}`
|
const url = `${getOauthConfig().BASE_API_URL}/v1/session_ingress/session/${sessionId}`
|
||||||
logForDebugging(`[session-ingress] Fetching session logs from: ${url}`)
|
logForDebugging('[session-ingress] Fetching session logs via OAuth endpoint')
|
||||||
const headers = {
|
const headers = {
|
||||||
...getOAuthHeaders(accessToken),
|
...getOAuthHeaders(accessToken),
|
||||||
'x-organization-uuid': orgUUID,
|
'x-organization-uuid': orgUUID,
|
||||||
@@ -299,7 +318,7 @@ export async function getTeleportEvents(
|
|||||||
'x-organization-uuid': orgUUID,
|
'x-organization-uuid': orgUUID,
|
||||||
}
|
}
|
||||||
|
|
||||||
logForDebugging(`[teleport] Fetching events from: ${baseUrl}`)
|
logForDebugging('[teleport] Fetching session events via teleport endpoint')
|
||||||
|
|
||||||
const all: Entry[] = []
|
const all: Entry[] = []
|
||||||
let cursor: string | undefined
|
let cursor: string | undefined
|
||||||
@@ -362,7 +381,9 @@ export async function getTeleportEvents(
|
|||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
logError(
|
logError(
|
||||||
new Error(
|
new Error(
|
||||||
`Teleport events returned ${response.status}: ${jsonStringify(response.data)}`,
|
`Teleport events returned ${response.status}: ${summarizeSessionIngressPayload(
|
||||||
|
response.data,
|
||||||
|
)}`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
logForDiagnosticsNoPII('error', 'teleport_events_bad_status')
|
logForDiagnosticsNoPII('error', 'teleport_events_bad_status')
|
||||||
@@ -373,7 +394,9 @@ export async function getTeleportEvents(
|
|||||||
if (!Array.isArray(data)) {
|
if (!Array.isArray(data)) {
|
||||||
logError(
|
logError(
|
||||||
new Error(
|
new Error(
|
||||||
`Teleport events invalid response shape: ${jsonStringify(response.data)}`,
|
`Teleport events invalid response shape: ${summarizeSessionIngressPayload(
|
||||||
|
response.data,
|
||||||
|
)}`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
logForDiagnosticsNoPII('error', 'teleport_events_invalid_shape')
|
logForDiagnosticsNoPII('error', 'teleport_events_invalid_shape')
|
||||||
@@ -439,7 +462,9 @@ async function fetchSessionLogsFromUrl(
|
|||||||
if (!data || typeof data !== 'object' || !Array.isArray(data.loglines)) {
|
if (!data || typeof data !== 'object' || !Array.isArray(data.loglines)) {
|
||||||
logError(
|
logError(
|
||||||
new Error(
|
new Error(
|
||||||
`Invalid session logs response format: ${jsonStringify(data)}`,
|
`Invalid session logs response format: ${summarizeSessionIngressPayload(
|
||||||
|
data,
|
||||||
|
)}`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
logForDiagnosticsNoPII('error', 'session_get_fail_invalid_response')
|
logForDiagnosticsNoPII('error', 'session_get_fail_invalid_response')
|
||||||
|
|||||||
@@ -17,12 +17,19 @@ import {
|
|||||||
filterExistingPaths,
|
filterExistingPaths,
|
||||||
getKnownPathsForRepo,
|
getKnownPathsForRepo,
|
||||||
} from '../githubRepoPathMapping.js'
|
} from '../githubRepoPathMapping.js'
|
||||||
import { jsonStringify } from '../slowOperations.js'
|
|
||||||
import { readLastFetchTime } from './banner.js'
|
import { readLastFetchTime } from './banner.js'
|
||||||
import { parseDeepLink } from './parseDeepLink.js'
|
import { parseDeepLink } from './parseDeepLink.js'
|
||||||
import { MACOS_BUNDLE_ID } from './registerProtocol.js'
|
import { MACOS_BUNDLE_ID } from './registerProtocol.js'
|
||||||
import { launchInTerminal } from './terminalLauncher.js'
|
import { launchInTerminal } from './terminalLauncher.js'
|
||||||
|
|
||||||
|
function summarizeDeepLinkAction(action: {
|
||||||
|
query?: string
|
||||||
|
cwd?: string
|
||||||
|
repo?: string
|
||||||
|
}): string {
|
||||||
|
return `hasQuery=${Boolean(action.query)} hasCwd=${Boolean(action.cwd)} hasRepo=${Boolean(action.repo)}`
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming deep link URI.
|
* Handle an incoming deep link URI.
|
||||||
*
|
*
|
||||||
@@ -34,7 +41,7 @@ import { launchInTerminal } from './terminalLauncher.js'
|
|||||||
* @returns exit code (0 = success)
|
* @returns exit code (0 = success)
|
||||||
*/
|
*/
|
||||||
export async function handleDeepLinkUri(uri: string): Promise<number> {
|
export async function handleDeepLinkUri(uri: string): Promise<number> {
|
||||||
logForDebugging(`Handling deep link URI: ${uri}`)
|
logForDebugging('Handling deep link URI')
|
||||||
|
|
||||||
let action
|
let action
|
||||||
try {
|
try {
|
||||||
@@ -46,7 +53,7 @@ export async function handleDeepLinkUri(uri: string): Promise<number> {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
logForDebugging(`Parsed deep link action: ${jsonStringify(action)}`)
|
logForDebugging(`Parsed deep link action (${summarizeDeepLinkAction(action)})`)
|
||||||
|
|
||||||
// Always the running executable — no PATH lookup. The OS launched us via
|
// Always the running executable — no PATH lookup. The OS launched us via
|
||||||
// an absolute path (bundle symlink / .desktop Exec= / registry command)
|
// an absolute path (bundle symlink / .desktop Exec= / registry command)
|
||||||
@@ -125,11 +132,11 @@ async function resolveCwd(action: {
|
|||||||
const known = getKnownPathsForRepo(action.repo)
|
const known = getKnownPathsForRepo(action.repo)
|
||||||
const existing = await filterExistingPaths(known)
|
const existing = await filterExistingPaths(known)
|
||||||
if (existing[0]) {
|
if (existing[0]) {
|
||||||
logForDebugging(`Resolved repo ${action.repo} → ${existing[0]}`)
|
logForDebugging('Resolved repo deep link to local clone')
|
||||||
return { cwd: existing[0], resolvedRepo: action.repo }
|
return { cwd: existing[0], resolvedRepo: action.repo }
|
||||||
}
|
}
|
||||||
logForDebugging(
|
logForDebugging(
|
||||||
`No local clone found for repo ${action.repo}, falling back to home`,
|
'No local clone found for repo deep link, falling back to home',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return { cwd: homedir() }
|
return { cwd: homedir() }
|
||||||
|
|||||||
Reference in New Issue
Block a user