Skip to content

Commit b3a4197

Browse files
committed
Repair cross-runtime observation and SessionConfiguration fixtures
1 parent 8ea53f1 commit b3a4197

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

‎packages/test-agent/src/SessionConfiguration.test.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<TestAgent.Scenario session="defaults" src="./SessionConfiguration.defaults.md" models={catalog} />
77
<TestAgent.Scenario session="unavailable" src="./SessionConfiguration.unavailable.md" models={null} />
88

9-
<Test name="configuration and dependent effort memory share one session">
9+
<Test name="configuration and dependent effort memory share one session" timeout="60s">
1010
<Agent name="reviewer">
1111
<Session name="review"><Prompt as="restored">restored</Prompt></Session>
1212
<AssertStringIncludes actual={restored} expected="small low" />

‎packages/test-agent/tests/session-configuration.test.ts‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,29 @@ function* runConfiguration(
138138
});
139139
}
140140

141+
function configurationSucceeded(run: {
142+
result: Result<Json>;
143+
output: string;
144+
results: readonly TestResult[];
145+
}): void {
146+
if (!run.result.ok || run.results.some((entry) => entry.status !== "pass")) {
147+
throw new Error(JSON.stringify({
148+
error: run.result.ok ? undefined : { message: run.result.error.message, stack: run.result.error.stack },
149+
output: run.output,
150+
results: run.results,
151+
}, (_key, value) => value instanceof Error ? { message: value.message, stack: value.stack } : value, 2));
152+
}
153+
}
154+
141155
describe(
142156
"Session configuration through TestAgent",
143157
{ sanitizeOps: false, sanitizeResources: false },
144158
() => {
145159
it("runs configured Sessions and nested declarations through the source CLI and ACPX worker", function* () {
146160
const cli = yield* runCli(["test", DOC], RUN).join();
147-
expect(cli.code).toBe(0);
161+
if (cli.code !== 0) {
162+
throw new Error(`SessionConfiguration CLI exited ${cli.code}\nstdout:\n${cli.stdout}\nstderr:\n${cli.stderr}`);
163+
}
148164
expect(cli.stdout).toContain("review deep");
149165
expect(cli.stdout).not.toContain("ERROR");
150166
});
@@ -163,7 +179,7 @@ describe(
163179
it("retains named native identity, isolates Tests, and replays without a worker", function* () {
164180
const stream = new InMemoryStream();
165181
const live = yield* runConfiguration(stream, cliBase());
166-
expect(live.result.ok).toBe(true);
182+
configurationSucceeded(live);
167183
expect(live.results.map((entry) => entry.status)).toEqual([
168184
"pass",
169185
"pass",
@@ -189,7 +205,7 @@ describe(
189205
const replay = yield* runConfiguration(stream, [
190206
"/nonexistent/xmd-configuration-must-not-spawn",
191207
]);
192-
expect(replay.result.ok).toBe(true);
208+
configurationSucceeded(replay);
193209
expect(replay.results.map((entry) => entry.status)).toEqual(
194210
live.results.map((entry) => entry.status),
195211
);

0 commit comments

Comments
 (0)