fix(orchestrator): preserve task-step elapsed time across restart #10051
Mergedsaphid(GitHub profile, opens in a new tab)merged 2 commits into
t3code/codex-turn-mapping fromrefs/pull/10051/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/web/src/components/chat/composerPromptHistory.ts line 71OutdatedResolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +51,21 @@51+ entries: ReadonlyArray<ComposerPromptHistoryEntry>,52+ position: ComposerPromptHistoryPosition,53+): number {54+ const byId = entries.findIndex((entry) => entry.id === position.entryId);55+ if (byId >= 0) return byId;56+ return entries.findLastIndex((entry) => entry.prompt === position.recalled);57+}58+59+export interface ComposerPromptHistoryStep {60+ readonly position: ComposerPromptHistoryPosition | null;61+ readonly prompt: string;62+}63+64+/**65+ * Drop only the review comments appended at send time, which sit at the66+ * end. Cuts the original string at the start of the trailing run of blocks67+ * so any review comment block the user typed earlier stays byte-for-byte.68+ */69+function stripTrailingReviewComments(prompt: string): string {70+ let cut = prompt.length;71+ for (const match of [...prompt.matchAll(REVIEW_COMMENT_BLOCK_PATTERN)].toReversed()) {
- apps/server/src/terminal/Manager.ts lines 1365 to 1366OutdatedResolvedby saphid(GitHub profile, opens in a new tab)@@ -1306,5 +1322,17 @@13061322 readonly threadId: string;13071323 readonly terminalId: string;13081324 }) => Effect.Effect<void>;1325+ resolveProviderInstanceEnvironment?: (1326+ providerInstanceId: string,1327+ env: Record<string, string> | undefined,1328+ ) => Effect.Effect<1329+ Record<string, string>,1330+ TerminalProviderInstanceNotFoundError | TerminalProviderEnvironmentError1331+ >;13091332 }131013331334+export const resolveProviderInstanceTerminalEnvironment = Effect.fn(1335+ "terminal.resolveProviderInstanceTerminalEnvironment",1336+)(function* (input: {1337+ readonly serverSettings: ServerSettings.ServerSettingsService["Service"];1338+ readonly path: Path.Path;apps/server/src/orchestration-v2/AgentSessionImportSources.ts lines 59 to 61OutdatedResolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +41,21 @@41+ AND json_extract(thread.payload_json, '$.deletedAt') IS NULL42+ AND json_extract(thread.payload_json, '$.archivedAt') IS NULL43+ `;44+ return yield* Effect.forEach(rows, (row) => decode(row.source_json));45+ },46+ Effect.mapError(47+ (cause) => new AgentSessionScanError({ operation: "read-projects", cause }),48+ ),49+ ),50+ record: Effect.fn("AgentSessionImportSources.record")(51+ function* (threadId, source) {52+ const encoded = yield* encode(source);53+ yield* sql`54+ INSERT INTO orchestration_v2_agent_session_import_sources (thread_id, file_path, source_json)55+ VALUES (${threadId}, ${source.filePath}, ${encoded})56+ ON CONFLICT(thread_id, file_path) DO UPDATE SET source_json = excluded.source_json57+ `;58+ },59+ Effect.mapError(60+ (cause) => new AgentSessionScanError({ operation: "read-projects", cause }),61+ ),
- apps/web/src/components/onboarding/WelcomeWizard.tsx line 623OutdatedResolvedby saphid(GitHub profile, opens in a new tab)@@ -0,0 +603,21 @@603+ <Input604+ id="onboarding-pairing-url"605+ className="mt-2"606+ size="lg"607+ autoCapitalize="none"608+ autoComplete="off"609+ autoCorrect="off"610+ spellCheck={false}611+ nativeInput612+ disabled={isPairing}613+ placeholder="https://your-server:5230/pair#token=…"614+ value={pairingUrl}615+ onChange={(event) => setPairingUrl(event.currentTarget.value)}616+ onKeyDown={(event) => {617+ if (event.nativeEvent.isComposing || event.keyCode === 229) return;618+ if (event.key === "Enter" && pairingUrl.trim().length > 0) void submit();619+ }}620+ />621+ </div>622+ {errorMessage ? (623+ <div className="rounded-lg border border-destructive/30 bg-destructive/6 px-3 py-2 text-sm text-destructive">
- @@ -158,3 +159,9 @@158159 import * as ReviewService from "./review/ReviewService.ts";159160 import * as ProjectEnrichmentService from "./project/ProjectEnrichmentService.ts";160161 import * as ProjectService from "./project/ProjectService.ts";162+import * as AgentSessionScanner from "./project/AgentSessionScanner.ts";163+import { importRecentAgentThreads } from "./project/AgentSessionImporter.ts";164+import { EventSinkV2 } from "./orchestration-v2/EventSink.ts";165+import {166+ ProjectionStoreV2,167+ layer as projectionStoreV2Layer,
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XXL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
saphid(GitHub profile, opens in a new tab) changed the title
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this89459e3
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed