e6195f3fc0
GetWorkspaceInfoForSession initializes info.TaskEnvironmentID from session.TaskEnvironmentID, then resolves the env — first by that ID, falling back to GetTaskEnvironmentByTaskID when the session's ID points to a stale/missing row. When the fallback kicks in, the resolved env has a different ID, but applyTaskEnvironmentToWorkspaceInfo was only updating info.TaskEnvironmentID when it was empty. So downstream reconcilers received metadata + path from one env keyed by a different env's ID. Always overwrite info.TaskEnvironmentID with env.ID inside the apply function — once we've picked an env to spread, the info should identify that env consistently.