fix(bridge): restore labels from session history
Hydrate missing runtime names from persisted session metadata so opened and restored conversations no longer remain titled New session.
This commit is contained in:
@@ -177,9 +177,16 @@ test("closing removes desired-open intent, preserves history, and refuses direct
|
||||
await registry.stop();
|
||||
});
|
||||
|
||||
test("restores durable runtime IDs with two-at-a-time concurrency and preserves command isolation", async () => {
|
||||
test("restores durable runtime IDs and history labels with two-at-a-time concurrency", async () => {
|
||||
const paths = await fixture();
|
||||
const firstPath = await sessionFile(paths.sessionRoot, paths.home, "one");
|
||||
await writeFile(
|
||||
firstPath,
|
||||
`${await readFile(firstPath, "utf8")}${JSON.stringify({
|
||||
type: "message",
|
||||
message: { role: "user", content: "Hydrate this session label" },
|
||||
})}\n`,
|
||||
);
|
||||
const secondPath = await sessionFile(paths.sessionRoot, paths.home, "two");
|
||||
const thirdPath = await sessionFile(paths.sessionRoot, paths.home, "three");
|
||||
const firstAdapters = adapterFactory({
|
||||
@@ -195,6 +202,7 @@ test("restores durable runtime IDs with two-at-a-time concurrency and preserves
|
||||
if (!initial.sessionPath)
|
||||
await firstRegistry.closeSessionRuntime(initial.runtimeId);
|
||||
const one = await firstRegistry.openSessionRuntime(paths.home, firstPath);
|
||||
assert.equal(one.label, "Hydrate this session label");
|
||||
const two = await firstRegistry.openSessionRuntime(paths.home, secondPath);
|
||||
const three = await firstRegistry.openSessionRuntime(paths.home, thirdPath);
|
||||
await firstRegistry.stop();
|
||||
@@ -241,6 +249,14 @@ test("restores durable runtime IDs with two-at-a-time concurrency and preserves
|
||||
new Set([one.runtimeId, two.runtimeId, three.runtimeId]),
|
||||
);
|
||||
assert.equal(maxActiveStarts, 2);
|
||||
assert.equal(
|
||||
restored
|
||||
.getWorkspace()
|
||||
.directories[0].runtimes.find(
|
||||
(runtime) => runtime.runtimeId === one.runtimeId,
|
||||
)?.label,
|
||||
"Hydrate this session label",
|
||||
);
|
||||
assert.ok(
|
||||
restored
|
||||
.listAgents()
|
||||
|
||||
Reference in New Issue
Block a user