Skip to content

Commit 5e95b9a

Browse files
refactor: converge artifact roots and recovery fallback
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 7afbc8c commit 5e95b9a

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

src/compat/artifacts.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import { appendJsonl, writeJson, writeText } from "../utils/fs";
1+
import { writeText } from "../utils/fs";
22
import type { ExperimentSession } from "../experiment/session";
33
import type { ExperimentSpec } from "../spec/schema";
44
import {
5-
getCompatAttemptsPath,
6-
getCompatBestPath,
75
getCompatGoalPath,
8-
getCompatProposalCardsPath,
9-
getCompatRunEventsPath,
10-
getCompatSessionPath,
116
} from "../utils/paths";
127

138
function yamlList(values: string[]): string {
@@ -37,21 +32,27 @@ export async function syncGoalArtifact(workspaceRoot: string, spec: ExperimentSp
3732
}
3833

3934
export async function syncSessionArtifact(workspaceRoot: string, session: ExperimentSession): Promise<void> {
40-
await writeJson(getCompatSessionPath(workspaceRoot), session);
35+
void workspaceRoot;
36+
void session;
4137
}
4238

4339
export async function syncAttemptArtifact(workspaceRoot: string, record: unknown): Promise<void> {
44-
await appendJsonl(getCompatAttemptsPath(workspaceRoot), record);
40+
void workspaceRoot;
41+
void record;
4542
}
4643

4744
export async function syncBestArtifact(workspaceRoot: string, best: unknown): Promise<void> {
48-
await writeJson(getCompatBestPath(workspaceRoot), best);
45+
void workspaceRoot;
46+
void best;
4947
}
5048

5149
export async function syncProposalCardArtifact(workspaceRoot: string, card: unknown): Promise<void> {
52-
await appendJsonl(getCompatProposalCardsPath(workspaceRoot), card);
50+
void workspaceRoot;
51+
void card;
5352
}
5453

5554
export async function syncRunEventArtifact(workspaceRoot: string, runId: string, event: unknown): Promise<void> {
56-
await appendJsonl(getCompatRunEventsPath(workspaceRoot, runId), event);
55+
void workspaceRoot;
56+
void runId;
57+
void event;
5758
}

src/recovery/resume.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from "node:path";
12
import { readJson, writeJson } from "../utils/fs";
23
import { getRecoveryCheckpointPath } from "../utils/paths";
34

@@ -12,7 +13,10 @@ export async function saveRecoveryCheckpoint(workspaceRoot: string, checkpoint:
1213
}
1314

1415
export async function resumeExperiment(workspaceRoot: string): Promise<{ resumed: boolean; source: string | null }> {
15-
const checkpoint = await readJson<RecoveryCheckpoint | null>(getRecoveryCheckpointPath(workspaceRoot), null);
16+
let checkpoint = await readJson<RecoveryCheckpoint | null>(getRecoveryCheckpointPath(workspaceRoot), null);
17+
if (!checkpoint) {
18+
checkpoint = await readJson<RecoveryCheckpoint | null>(path.join(workspaceRoot, ".opencode", "auto-experiment", "recovery-checkpoint.json"), null);
19+
}
1620
if (!checkpoint) {
1721
return { resumed: false, source: null };
1822
}

src/utils/paths.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "node:path";
44
export const GLOBAL_CONFIG_PATH = path.join(homedir(), ".config", "opencode", "opencode-auto-experiment.json");
55

66
export function getExperimentRoot(workspaceRoot: string): string {
7-
return path.join(workspaceRoot, ".opencode", "auto-experiment");
7+
return path.join(workspaceRoot, "experiments");
88
}
99

1010
export function getCompatConfigDir(workspaceRoot: string): string {
@@ -48,7 +48,7 @@ export function getCompatRunEventsPath(workspaceRoot: string, runId: string): st
4848
}
4949

5050
export function getWorkspaceConfigPath(workspaceRoot: string): string {
51-
return path.join(getExperimentRoot(workspaceRoot), "experiment-spec.json");
51+
return path.join(workspaceRoot, ".opencode", "auto-experiment", "experiment-spec.json");
5252
}
5353

5454
export function getSessionPath(workspaceRoot: string): string {
@@ -72,11 +72,11 @@ export function getOrchestrationDir(workspaceRoot: string): string {
7272
}
7373

7474
export function getResultPacketPath(workspaceRoot: string): string {
75-
return path.join(getAnalysisDir(workspaceRoot), "result-packet.json");
75+
return path.join(getExperimentRoot(workspaceRoot), "result_packet.json");
7676
}
7777

7878
export function getProposalCardsPath(workspaceRoot: string): string {
79-
return path.join(getAnalysisDir(workspaceRoot), "proposal-cards.jsonl");
79+
return path.join(getExperimentRoot(workspaceRoot), "proposal_cards.jsonl");
8080
}
8181

8282
export function getOrchestrationTracePath(workspaceRoot: string): string {

0 commit comments

Comments
 (0)