A desktop coding agent with free access to frontier models.
TypeScript
fix: recovered claude chats name claude code too
ogsamratf51028ac0956
diff --git a/apps/server/src/session-uploader.test.ts b/apps/server/src/session-uploader.test.tsindex 9498195c..51840a72 100644--- a/apps/server/src/session-uploader.test.ts+++ b/apps/server/src/session-uploader.test.ts@@ -2582,6 +2582,13 @@ describe("session uploader trace additions", () => {expect(uploads.length).toBeGreaterThan(before);expect(uploads.slice(before).map(identity)).toEqual(uploads.slice(before).map(() => ["claude-code/2.1.306", "claude-code"]));+ // A recovered chat's state is its own (not among the open sessions): its model is passed in.+ const recovered = makeUploader();+ const environment = await (recovered as unknown as { sessionEnvironment(root: string, id: string, waitMs?: number, model?: unknown): Promise<{ engine_version: string }> })+ .sessionEnvironment(root, "session-claude-recovered-1", 0, { provider_id: "omnirush-claude", model_id: "claude-opus-5-5", variant: null, agent: null });+ expect(environment.engine_version).toBe("claude-code/2.1.306");+ await recovered.stop();+// Any other chat keeps the engine's identity.const other = makeUploader();other.startSession("session-astra-identity-1", "workspace-claude", root);diff --git a/apps/server/src/session-uploader.ts b/apps/server/src/session-uploader.tsindex 8ff81675..f43836ee 100644--- a/apps/server/src/session-uploader.ts+++ b/apps/server/src/session-uploader.ts@@ -5265,7 +5265,7 @@ export class SessionUploader {* when one was captured, and where the session came from when it was* imported from the opencode 2.x engine (engine2/imported.ts).*/- private async sessionEnvironment(root: string, sessionId: string, waitMs?: number): Promise<UploadEnvironment> {+ private async sessionEnvironment(root: string, sessionId: string, waitMs?: number, model?: UploadSessionModel | null): Promise<UploadEnvironment> {const environment = await this.environment();const box = this.boxes.get(sessionId) ?? null;const toolchains = box ? this.boxToolchains : this.toolchains;@@ -5279,8 +5279,8 @@ export class SessionUploader {// Only a chat that used computer use gets the field.const computerUse = this.computerUse.get(sessionId) ?? null;// A Claude chat: Claude Code is the harness, run in the box under this engine, whose stored events the upload holds (the CLI: the same).- // Also a reopened chat before its next prompt: the model its stored messages name.- const claude = this.claudeChats.get(sessionId) ?? (this.sessions.get(sessionId)?.model?.provider_id === CLAUDE_PROVIDER_ID ? CLAUDE_CODE_VERSION : undefined);+ // Also a reopened or recovered chat before its next prompt: the model its stored messages name (a recovered state is not among this.sessions).+ const claude = this.claudeChats.get(sessionId) ?? ((model ?? this.sessions.get(sessionId)?.model)?.provider_id === CLAUDE_PROVIDER_ID ? CLAUDE_CODE_VERSION : undefined);const harness = claude ? { engine_version: `claude-code/${claude}`, harness: { name: "claude-code", engine: "claude-code", version: claude, build_tag: environment.harness.build_tag, host_engine: environment.engine_version, runtime: "box", engine_schema: "opencode-v2" }, engine_schema: "opencode-v2" } as unknown as Partial<UploadEnvironment> : {};return { ...environment, ...harness, ...boxEnvironment(environment, box?.label ?? null), ...(toolchain ? { toolchain } : {}), ...(box ? { sandbox: box.label } : {}), ...(importedFrom ? { imported_from: importedFrom } : {}), ...(mcpServers ? { mcp_servers: mcpServers } : {}), ...(computerUse ? { computer_use: computerUse } : {}) };}@@ -7039,7 +7039,7 @@ export class SessionUploader {const ignoredListing = !(targeted && previous !== null) ? await listGitIgnored(state.root) : null;const deniedCount = scan.deniedCount + (ignoredListing ?? []).filter((path) => isUploadPathDenied(path.replace(/\/$/, ""))).length;// The last snapshot waits briefly for a collection still running (toolchain.ts).- const environment = await this.sessionEnvironment(state.root, state.id, type === "end" ? FINAL_TOOLCHAIN_WAIT_MS : undefined);+ const environment = await this.sessionEnvironment(state.root, state.id, type === "end" ? FINAL_TOOLCHAIN_WAIT_MS : undefined, state.model);const rootName = workspaceRootName(state.root);const touchedPaths = this.touchedPathsForUpload(state);const metadata = JSON.stringify({@@ -7206,7 +7206,7 @@ export class SessionUploader {schemaVersion: version,extras: {workspace: { root_name: workspaceRootName(state.root), git: null, ...(await gitSkippedField()) },- environment: await this.sessionEnvironment(state.root, state.id),+ environment: await this.sessionEnvironment(state.root, state.id, undefined, state.model),touched_paths: this.touchedPathsForUpload(state),files_scope: "full",},