Archived
fix(sessions): guard, gate, and test session reload
Build on the original Reload action with the fixes raised in review: - Server reload() now refuses to run on archived (read-only) sessions and when the session has work in progress, mirroring archive(), so a reload can no longer silently abort an in-flight agent run. - Add a sessions.reload runtime capability; the client gates both the reloadSession call and the Reload menu entry on it so the action only appears for machines whose Pi-Web runtime supports it. - reloadSession ignores cached-new and archived sessions. - Add server (PiSessionService + routes) and client (SessionController) tests covering reload success, the active-work guard, archived rejection, route forwarding, capability gating, and error mapping. - Restore alphabetical parser import ordering in clients.ts. - Add a changeset documenting the feature and the sessiond restart note. Note: touches a session daemon code path, so pi-web-sessiond.service must be restarted manually for the server side to take effect.
This commit is contained in:
@@ -561,8 +561,10 @@ export class PiSessionService {
|
||||
}
|
||||
|
||||
async reload(ref: PiSessionLookup): Promise<void> {
|
||||
const active = await this.getActive(ref);
|
||||
await this.closeActive(active.runtime.session.sessionId);
|
||||
await this.assertWritable(ref);
|
||||
const session = await this.getOrOpen(ref);
|
||||
if (this.hasActiveWork(session)) throw new Error("Stop current session activity before reloading");
|
||||
await this.closeActive(session.sessionId);
|
||||
const reopened = await this.getActive(ref);
|
||||
this.publishStatus(reopened.runtime.session);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user