Commit 5add54d15870

Vincent Demeester <vincent@sbr.pm>
2026-04-23 17:21:47
fix(pi): handle stale extension context in custom-footer render
Wrap both render() functions with try-catch to prevent crash when quitting pi. The extension runner throws when accessing ctx.cwd on a stale session, now gracefully returns empty footer instead.
1 parent bb490a9
Changed files (1)
dots
pi
agent
dots/pi/agent/extensions/custom-footer.ts
@@ -291,6 +291,7 @@ export default function (pi: ExtensionAPI) {
 				},
 				invalidate() {},
 				render(width: number): string[] {
+					try {
 					// Get all info
 					const time = getCurrentTime();
 					const host = hostname();
@@ -355,6 +356,7 @@ export default function (pi: ExtensionAPI) {
 					const footer = components.join(separator);
 
 					return [truncateToWidth(footer, width)];
+					} catch { return [""]; }
 				},
 			};
 		});
@@ -383,6 +385,7 @@ export default function (pi: ExtensionAPI) {
 				},
 				invalidate() {},
 				render(width: number): string[] {
+					try {
 					// Get all info
 					const time = getCurrentTime();
 					const host = hostname();
@@ -441,6 +444,7 @@ export default function (pi: ExtensionAPI) {
 					const footer = components.join(separator);
 
 					return [truncateToWidth(footer, width)];
+					} catch { return [""]; }
 				},
 			};
 		});