Changesets · Branches · Tags · Compare
| Changeset | e31fcddb0dec4eef0853ab5eb70e26e5f9375eff3f23eda23bdee6a2e311ac5c |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-09-24 00:00 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-24 00:00 -07:00 |
| Parents | 78599bd09fb6 |
6 files changed
modified .github/workflows/continue-detailed-review.yaml +1 −1
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | timeout-minutes: 10 |
| 19 | 19 | steps: |
| 20 | 20 | - name: Run Detailed PR Review |
| 21 | - uses: continuedev/continue/actions/detailed-review@12e933bf9d13736c5f47728c436445ef4127fd52 | |
| 21 | + uses: continuedev/continue/actions/detailed-review@main | |
| 22 | 22 | with: |
| 23 | 23 | continue-api-key: ${{ secrets.CONTINUE_API_KEY }} |
| 24 | 24 | continue-org: continuedev |
modified .github/workflows/continue-general-review.yaml +1 −1
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | timeout-minutes: 10 |
| 19 | 19 | steps: |
| 20 | 20 | - name: Run Continue PR Review Action |
| 21 | - uses: continuedev/continue/actions/general-review@12e933bf9d13736c5f47728c436445ef4127fd52 | |
| 21 | + uses: continuedev/continue/actions/general-review@main | |
| 22 | 22 | with: |
| 23 | 23 | continue-api-key: ${{ secrets.CONTINUE_API_KEY }} |
| 24 | 24 | continue-org: "continuedev" |
modified extensions/cli/src/commands/serve.ts +15 −8
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | ConfigServiceState, |
| 17 | 17 | ModelServiceState, |
| 18 | 18 | } from "../services/types.js"; |
| 19 | -import { createSession, getSessionPersistenceSnapshot } from "../session.js"; | |
| 19 | +import { createSession, getCompleteStateSnapshot } from "../session.js"; | |
| 20 | 20 | import { messageQueue } from "../stream/messageQueue.js"; |
| 21 | 21 | import { constructSystemMessage } from "../systemMessage.js"; |
| 22 | 22 | import { telemetryService } from "../telemetry/telemetryService.js"; |
| @@ -159,7 +159,13 @@ | ||
| 159 | 159 | storageOption: options.id, |
| 160 | 160 | accessToken, |
| 161 | 161 | syncSessionHistory, |
| 162 | - getSessionSnapshot: () => getSessionPersistenceSnapshot(state.session), | |
| 162 | + getCompleteStateSnapshot: () => | |
| 163 | + getCompleteStateSnapshot( | |
| 164 | + state.session, | |
| 165 | + state.isProcessing, | |
| 166 | + messageQueue.getQueueLength(), | |
| 167 | + state.pendingPermission, | |
| 168 | + ), | |
| 163 | 169 | isActive: () => state.serverRunning, |
| 164 | 170 | }); |
| 165 | 171 | |
| @@ -181,12 +187,13 @@ | ||
| 181 | 187 | app.get("/state", (_req: Request, res: Response) => { |
| 182 | 188 | state.lastActivity = Date.now(); |
| 183 | 189 | syncSessionHistory(); |
| 184 | - res.json({ | |
| 185 | - session: state.session, // Return session directly instead of converting | |
| 186 | - isProcessing: state.isProcessing, | |
| 187 | - messageQueueLength: messageQueue.getQueueLength(), | |
| 188 | - pendingPermission: state.pendingPermission, | |
| 189 | - }); | |
| 190 | + const stateSnapshot = getCompleteStateSnapshot( | |
| 191 | + state.session, | |
| 192 | + state.isProcessing, | |
| 193 | + messageQueue.getQueueLength(), | |
| 194 | + state.pendingPermission, | |
| 195 | + ); | |
| 196 | + res.json(stateSnapshot); | |
| 190 | 197 | }); |
| 191 | 198 | |
| 192 | 199 | // POST /message - Queue a message and potentially interrupt |
modified extensions/cli/src/services/StorageSyncService.test.ts +10 −10
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 | storageOption: undefined, |
| 56 | 56 | accessToken: "token", |
| 57 | 57 | syncSessionHistory: vi.fn(), |
| 58 | - getSessionSnapshot: vi.fn(), | |
| 58 | + getCompleteStateSnapshot: vi.fn(), | |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | expect(result).toBe(false); |
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | storageOption: " ", |
| 70 | 70 | accessToken: "token", |
| 71 | 71 | syncSessionHistory: vi.fn(), |
| 72 | - getSessionSnapshot: vi.fn(), | |
| 72 | + getCompleteStateSnapshot: vi.fn(), | |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | 75 | expect(result).toBe(false); |
| @@ -86,7 +86,7 @@ | ||
| 86 | 86 | storageOption: "session-123", |
| 87 | 87 | accessToken: null, |
| 88 | 88 | syncSessionHistory: vi.fn(), |
| 89 | - getSessionSnapshot: vi.fn(), | |
| 89 | + getCompleteStateSnapshot: vi.fn(), | |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | 92 | expect(result).toBe(false); |
| @@ -98,7 +98,7 @@ | ||
| 98 | 98 | |
| 99 | 99 | it("starts syncing when presign succeeds", async () => { |
| 100 | 100 | const syncSessionHistory = vi.fn(); |
| 101 | - const getSessionSnapshot = vi.fn().mockReturnValue({ foo: "bar" }); | |
| 101 | + const getCompleteStateSnapshot = vi.fn().mockReturnValue({ foo: "bar" }); | |
| 102 | 102 | |
| 103 | 103 | fetchMock.mockResolvedValueOnce({ |
| 104 | 104 | ok: true, |
| @@ -114,13 +114,13 @@ | ||
| 114 | 114 | storageOption: "session-123", |
| 115 | 115 | accessToken: "token", |
| 116 | 116 | syncSessionHistory, |
| 117 | - getSessionSnapshot, | |
| 117 | + getCompleteStateSnapshot, | |
| 118 | 118 | isActive: () => true, |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | expect(result).toBe(true); |
| 122 | 122 | expect(syncSessionHistory).toHaveBeenCalledTimes(1); |
| 123 | - expect(getSessionSnapshot).toHaveBeenCalledTimes(1); | |
| 123 | + expect(getCompleteStateSnapshot).toHaveBeenCalledTimes(1); | |
| 124 | 124 | expect(fetchMock).toHaveBeenCalledTimes(3); |
| 125 | 125 | const [presignUrl, presignOptions] = fetchMock.mock.calls[0]; |
| 126 | 126 | expect(presignUrl).toBeInstanceOf(URL); |
| @@ -152,7 +152,7 @@ | ||
| 152 | 152 | storageOption: "session-123", |
| 153 | 153 | accessToken: "token", |
| 154 | 154 | syncSessionHistory: vi.fn(), |
| 155 | - getSessionSnapshot: vi.fn(), | |
| 155 | + getCompleteStateSnapshot: vi.fn(), | |
| 156 | 156 | }); |
| 157 | 157 | |
| 158 | 158 | expect(result).toBe(false); |
| @@ -187,7 +187,7 @@ | ||
| 187 | 187 | storageOption: "session-123", |
| 188 | 188 | accessToken: "token", |
| 189 | 189 | syncSessionHistory: vi.fn(), |
| 190 | - getSessionSnapshot: vi.fn().mockReturnValue({}), | |
| 190 | + getCompleteStateSnapshot: vi.fn().mockReturnValue({}), | |
| 191 | 191 | }); |
| 192 | 192 | |
| 193 | 193 | expect(result).toBe(true); |
| @@ -235,7 +235,7 @@ | ||
| 235 | 235 | |
| 236 | 236 | it("includes server-side encryption header when required by signed headers", async () => { |
| 237 | 237 | const syncSessionHistory = vi.fn(); |
| 238 | - const getSessionSnapshot = vi.fn().mockReturnValue({ test: "data" }); | |
| 238 | + const getCompleteStateSnapshot = vi.fn().mockReturnValue({ test: "data" }); | |
| 239 | 239 | |
| 240 | 240 | // Mock presign response with server-side encryption in signed headers |
| 241 | 241 | const sessionUrlWithSSE = |
| @@ -256,7 +256,7 @@ | ||
| 256 | 256 | storageOption: "session-123", |
| 257 | 257 | accessToken: "token", |
| 258 | 258 | syncSessionHistory, |
| 259 | - getSessionSnapshot, | |
| 259 | + getCompleteStateSnapshot, | |
| 260 | 260 | isActive: () => true, |
| 261 | 261 | }); |
| 262 | 262 |
modified extensions/cli/src/services/StorageSyncService.ts +9 −5
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | accessToken: string; |
| 30 | 30 | intervalMs?: number; |
| 31 | 31 | syncSessionHistory: () => void; |
| 32 | - getSessionSnapshot: () => unknown; | |
| 32 | + getCompleteStateSnapshot: () => unknown; | |
| 33 | 33 | isActive?: () => boolean; |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -284,14 +284,18 @@ | ||
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | + // Capture references to prevent race condition with stop() | |
| 288 | + const targets = this.targets; | |
| 289 | + const options = this.options; | |
| 290 | + | |
| 287 | 291 | this.uploadInFlight = true; |
| 288 | 292 | |
| 289 | 293 | try { |
| 290 | - this.options.syncSessionHistory(); | |
| 291 | - const snapshot = this.options.getSessionSnapshot(); | |
| 294 | + options.syncSessionHistory(); | |
| 295 | + const snapshot = options.getCompleteStateSnapshot(); | |
| 292 | 296 | const sessionPayload = JSON.stringify(snapshot, null, 2); |
| 293 | 297 | await this.uploadToPresignedUrl( |
| 294 | - this.targets.sessionUrl, | |
| 298 | + targets.sessionUrl, | |
| 295 | 299 | sessionPayload, |
| 296 | 300 | "application/json", |
| 297 | 301 | ); |
| @@ -304,7 +308,7 @@ | ||
| 304 | 308 | this.missingRepoLogged = true; |
| 305 | 309 | } |
| 306 | 310 | await this.uploadToPresignedUrl( |
| 307 | - this.targets.diffUrl, | |
| 311 | + targets.diffUrl, | |
| 308 | 312 | diffResult.diff, |
| 309 | 313 | "text/plain", |
| 310 | 314 | ); |
modified extensions/cli/src/session.ts +24 −0
| @@ -161,6 +161,30 @@ | ||
| 161 | 161 | return modifySessionBeforeSave(session); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | +/** | |
| 165 | + * Get the complete state snapshot that matches the /state endpoint format | |
| 166 | + */ | |
| 167 | +export interface StateSnapshot { | |
| 168 | + session: Session; | |
| 169 | + isProcessing: boolean; | |
| 170 | + messageQueueLength: number; | |
| 171 | + pendingPermission: any; | |
| 172 | +} | |
| 173 | + | |
| 174 | +export function getCompleteStateSnapshot( | |
| 175 | + session: Session, | |
| 176 | + isProcessing: boolean = false, | |
| 177 | + messageQueueLength: number = 0, | |
| 178 | + pendingPermission: any = null, | |
| 179 | +): StateSnapshot { | |
| 180 | + return { | |
| 181 | + session: getSessionPersistenceSnapshot(session), | |
| 182 | + isProcessing, | |
| 183 | + messageQueueLength, | |
| 184 | + pendingPermission, | |
| 185 | + }; | |
| 186 | +} | |
| 187 | + | |
| 164 | 188 | /** |
| 165 | 189 | * Save the current session to file |
| 166 | 190 | */ |