TEMP: log context distros/sessions + OSC7-reported cwd for diagnosis

This commit is contained in:
megaproxy 2026-05-28 23:14:03 +01:00
parent 50766c3fdd
commit bbe827af22
2 changed files with 21 additions and 2 deletions

View file

@ -770,7 +770,20 @@ export default function App() {
} }
contextFetchingRef.current = true; contextFetchingRef.current = true;
try { try {
setContextSessions(await getPaneContext(Array.from(distros))); const sessions = await getPaneContext(Array.from(distros));
// TEMP diagnostic — remove once the context bar is confirmed working.
console.log(
"[ctx] distros",
[...distros],
"→",
sessions.length,
"sessions:",
sessions.map(
(s) =>
`${s.cwd} | ${s.contextTokens}tok | ${Math.round((Date.now() - s.lastActiveMs) / 1000)}s ago`,
),
);
setContextSessions(sessions);
} catch (e) { } catch (e) {
console.warn("getPaneContext failed:", e); console.warn("getPaneContext failed:", e);
} finally { } finally {

View file

@ -190,7 +190,13 @@ export default function LeafPane({ leaf }: { leaf: LeafNode }) {
// which is the (often unset) spawn cwd and doesn't follow `cd`. // which is the (often unset) spawn cwd and doesn't follow `cd`.
const [liveCwd, setLiveCwd] = useState<string | null>(null); const [liveCwd, setLiveCwd] = useState<string | null>(null);
const onPaneCwd = useCallback( const onPaneCwd = useCallback(
(cwd: string) => setLiveCwd((cur) => (cur === cwd ? cur : cwd)), (cwd: string) =>
setLiveCwd((cur) => {
if (cur === cwd) return cur;
// TEMP diagnostic — remove once the context bar is confirmed working.
console.log("[ctx] pane reported cwd via OSC7:", cwd);
return cwd;
}),
[], [],
); );