MCPcopy
hub / github.com/coder/mux / overlayPendingGoal

Method overlayPendingGoal

src/node/services/workspaceService.ts:2381–2393  ·  view source on GitHub ↗

* Overlay the optimistic mid-stream goal onto an activity snapshot. * * A goal set while the agent is streaming is held as optimistic state in the * goal service until stream-end persistence; goal.json keeps the pre-stream * goal. Activity snapshots built from persisted metadata (status_

(
    workspaceId: string,
    snapshot: WorkspaceActivitySnapshot | null
  )

Source from the content-addressed store, hash-verified

2379 * pending snapshot before emitting, so they win naturally.
2380 */
2381 private overlayPendingGoal(
2382 workspaceId: string,
2383 snapshot: WorkspaceActivitySnapshot | null
2384 ): WorkspaceActivitySnapshot | null {
2385 if (!snapshot || snapshot.transientGoalOnly === true) {
2386 return snapshot;
2387 }
2388 const pending = this.workspaceGoalService?.getPendingGoalSnapshot(workspaceId);
2389 if (!pending) {
2390 return snapshot;
2391 }
2392 return { ...snapshot, goal: pending };
2393 }
2394
2395 private async emitWorkspaceActivityUpdate(
2396 workspaceId: string,

Callers 2

emitWorkspaceActivityMethod · 0.95
getActivityListMethod · 0.95

Calls 1

Tested by

no test coverage detected