-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Identify cloud tasks in the extension bridge #8539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,8 @@ export interface BridgeOrchestratorOptions { | |||||
| socketBridgeUrl: string | ||||||
| token: string | ||||||
| provider: TaskProviderLike | ||||||
| sessionId?: string | ||||||
| sessionId: string | ||||||
| isCloudAgent: boolean | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -44,6 +45,7 @@ export class BridgeOrchestrator { | |||||
| private readonly instanceId: string | ||||||
| private readonly appProperties: StaticAppProperties | ||||||
| private readonly gitProperties?: GitProperties | ||||||
| private readonly isCloudAgent?: boolean | ||||||
|
|
||||||
| // Components | ||||||
| private socketTransport: SocketTransport | ||||||
|
|
@@ -96,6 +98,7 @@ export class BridgeOrchestrator { | |||||
| if (!instance) { | ||||||
| try { | ||||||
| console.log(`[BridgeOrchestrator#connectOrDisconnect] Connecting...`) | ||||||
|
|
||||||
| // Populate telemetry properties before registering the instance. | ||||||
| await options.provider.getTelemetryProperties() | ||||||
|
|
||||||
|
|
@@ -174,6 +177,7 @@ export class BridgeOrchestrator { | |||||
| this.instanceId = options.sessionId || crypto.randomUUID() | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Minor cleanup: sessionId is now required in BridgeOrchestratorOptions, but the constructor still falls back to crypto.randomUUID(). Since callers must provide sessionId, the fallback is redundant. Consider simplifying to direct assignment for clarity.
Suggested change
|
||||||
| this.appProperties = { ...options.provider.appProperties, hostname: os.hostname() } | ||||||
| this.gitProperties = options.provider.gitProperties | ||||||
| this.isCloudAgent = options.isCloudAgent | ||||||
|
|
||||||
| this.socketTransport = new SocketTransport({ | ||||||
| url: this.socketBridgeUrl, | ||||||
|
|
@@ -200,12 +204,14 @@ export class BridgeOrchestrator { | |||||
| gitProperties: this.gitProperties, | ||||||
| userId: this.userId, | ||||||
| provider: this.provider, | ||||||
| isCloudAgent: this.isCloudAgent, | ||||||
| }) | ||||||
|
|
||||||
| this.taskChannel = new TaskChannel({ | ||||||
| instanceId: this.instanceId, | ||||||
| appProperties: this.appProperties, | ||||||
| gitProperties: this.gitProperties, | ||||||
| isCloudAgent: this.isCloudAgent, | ||||||
| }) | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ export class ExtensionChannel extends BaseChannel< | |
| instanceId: options.instanceId, | ||
| appProperties: options.appProperties, | ||
| gitProperties: options.gitProperties, | ||
| isCloudAgent: options.isCloudAgent, | ||
| }) | ||
|
|
||
| this.userId = options.userId | ||
|
|
@@ -55,6 +56,7 @@ export class ExtensionChannel extends BaseChannel< | |
| lastHeartbeat: Date.now(), | ||
| task: { taskId: "", taskStatus: TaskStatus.None }, | ||
| taskHistory: [], | ||
| isCloudAgent: this.isCloudAgent, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Durability: you set isCloudAgent on initial registration, but updateInstance relies on spreading the prior object to retain it. To make it future‑proof against refactors that rebuild the object, consider explicitly setting |
||
| } | ||
|
|
||
| this.setupListeners() | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -411,6 +411,7 @@ export const extensionInstanceSchema = z.object({ | |||||
| modes: z.array(z.object({ slug: z.string(), name: z.string() })).optional(), | ||||||
| providerProfile: z.string().optional(), | ||||||
| providerProfiles: z.array(z.object({ name: z.string(), provider: z.string().optional() })).optional(), | ||||||
| isCloudAgent: z.boolean().optional(), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Schema default improves robustness: if older clients omit this field, downstream code can always rely on a concrete boolean. Suggest defaulting to false so the property is present after parsing even when not sent.
Suggested change
|
||||||
| }) | ||||||
|
|
||||||
| export type ExtensionInstance = z.infer<typeof extensionInstanceSchema> | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0] Type mismatch can break build: isCloudAgent is declared as optional on the class (boolean | undefined) but passed to ExtensionChannel/TaskChannel which require a boolean. This allows undefined to flow into a non-optional parameter and will fail type-checking under strictNullChecks. Recommend aligning the class property with the options type: make it non-optional.