Merge pull request #2785 from pikasTech/fix/embdagentbench-launch-context-jsonb

fix: 修正 CaseRun jsonb 身份比较
This commit is contained in:
Lyon
2026-07-24 21:18:56 +08:00
committed by GitHub
2 changed files with 25 additions and 2 deletions
+20 -1
View File
@@ -48,7 +48,7 @@ test("API restart preserves PostgreSQL-shaped registry read model", async () =>
test("Workbench launch context is frozen and conflicting run replay is rejected", async () => {
const fixture = await softwareSmokeFixture();
const registry = new MemoryRegistry();
const registry = new JsonbMemoryRegistry();
const service = createHarnessRLService({ registry, temporal: new FakeTemporal(), cwd: fixture.root, caseRepo: fixture.root, stateRoot: fixture.stateRoot, caseAuthority: fixture.caseAuthority });
const launchContext = {
workbenchSessionRef: { sessionId: "ses_caserun_arm2d", actorId: "usr_arm2d" },
@@ -376,3 +376,22 @@ class MemoryRegistry implements HarnessRLRegistry {
async health() { return { ok: true as const }; }
async close() {}
}
class JsonbMemoryRegistry extends MemoryRegistry {
async createRun(input: StartCaseRunInput) {
const record = await super.createRun(input);
if (!record.launchContext) return record;
const context = record.launchContext;
return {
...record,
launchContext: {
hwpodId: context.hwpodId,
...(context.subjectRef ? { subjectRef: context.subjectRef } : {}),
workbenchSessionRef: {
actorId: context.workbenchSessionRef.actorId,
sessionId: context.workbenchSessionRef.sessionId,
},
},
};
}
}
+5 -1
View File
@@ -209,7 +209,11 @@ function requiredLaunchText(value: unknown, field: string) {
}
function sameLaunchContext(left: CaseRunLaunchContext | null, right: CaseRunLaunchContext | null) {
return JSON.stringify(left) === JSON.stringify(right);
if (left === null || right === null) return left === right;
return left.workbenchSessionRef.sessionId === right.workbenchSessionRef.sessionId
&& left.workbenchSessionRef.actorId === right.workbenchSessionRef.actorId
&& left.hwpodId === right.hwpodId
&& (left.subjectRef ?? "") === (right.subjectRef ?? "");
}
function finiteNumber(value: unknown): number | null {