Skip to content

Commit db62cb8

Browse files
committed
Fix re-host project match: rows store the repo slug, not a path
hostedSessionIds compared the registered project against the instance's worktree PATH, but registerChatSession stores detectRepo's slug (sysread/thatch) - the comparison never matched and the reload re-hosting never fired. Compare against the same repo identity the registration wrote.
1 parent 16ad505 commit db62cb8

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎src/chat.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,13 +1333,14 @@ export function hostedSessionIds(options: {
13331333
resumedSessions: Iterable<string>;
13341334
registeredRows: Pick<ChatSessionRow, "session_id" | "project">[];
13351335
hostScope: "process" | "server";
1336-
worktree: string;
1336+
/** The project identity rows are registered under (detectRepo's slug). */
1337+
project: string;
13371338
exclude: Iterable<string>;
13381339
}): string[] {
13391340
const hosted = [...options.statusKeys, ...options.resumedSessions];
13401341
if (options.hostScope === "server") {
13411342
for (const row of options.registeredRows) {
1342-
if (row.project === options.worktree) hosted.push(row.session_id);
1343+
if (row.project === options.project) hosted.push(row.session_id);
13431344
}
13441345
}
13451346
const excluded = new Set(options.exclude);

‎src/runtime.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export async function createRuntime(input: {
288288
resumedSessions: resumedSessions,
289289
registeredRows: db.listChatSessions(),
290290
hostScope: caps.hostScope,
291-
worktree,
291+
project: repo,
292292
exclude: childToParent.keys(),
293293
}),
294294
deliver: async (sessionID, senders, count) => {

‎tests/state-persistence.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe("hostedSessionIds (reload re-hosting)", () => {
261261
resumedSessions: [],
262262
registeredRows: rows,
263263
hostScope: "server",
264-
worktree: "/repo",
264+
project: "/repo",
265265
exclude: [],
266266
});
267267
// The reload wiped the event-fed map; the registered row of THIS
@@ -276,7 +276,7 @@ describe("hostedSessionIds (reload re-hosting)", () => {
276276
resumedSessions: ["ses_resumed"],
277277
registeredRows: rows,
278278
hostScope: "process",
279-
worktree: "/repo",
279+
project: "/repo",
280280
exclude: [],
281281
});
282282
expect(hosted.sort()).toEqual(["ses_resumed", "ses_seen"]);
@@ -288,7 +288,7 @@ describe("hostedSessionIds (reload re-hosting)", () => {
288288
resumedSessions: [],
289289
registeredRows: rows,
290290
hostScope: "server",
291-
worktree: "/repo",
291+
project: "/repo",
292292
exclude: ["ses_child"],
293293
});
294294
expect(hosted).toEqual(["ses_seen", "ses_same_project"]);

0 commit comments

Comments
 (0)