Context bar: only show for actively-written sessions (gate on recent mtime)

A bash pane sitting in a directory that once had a claude session was
lighting up with that session's stale context. Gate the indicator on the
matched session having been written within the last 10 min, so it tracks
a live claude rather than any dormant transcript in the same dir.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-28 23:06:30 +01:00
parent 02d97d1520
commit 0358128b24

View file

@ -22,6 +22,12 @@ import "./LeafPane.css";
const IDLE_THRESHOLD_MS = 5000;
/** Only show the context indicator when the matched claude session has been
* written recently i.e. claude is actually live in (or just used in) this
* pane's directory. Without this, a plain bash pane sitting in a directory
* that once had a claude session lights up with that session's stale context. */
const CONTEXT_ACTIVE_MS = 10 * 60 * 1000;
/** How far past a viewport edge the cursor must travel before a release is
* treated as "drag pane out of window" instead of "drop on empty space
* inside this window". Picked so an accidental release on the OS titlebar
@ -419,10 +425,16 @@ export default function LeafPane({ leaf }: { leaf: LeafNode }) {
})();
const matchCwd = liveCwd ?? leaf.cwd;
const ctx =
const matchedCtx =
leaf.shellKind === "wsl" && matchCwd
? orch.paneContext.get(matchCwd)
: undefined;
// Suppress stale matches: only surface the bar while the session is actively
// being written (a live claude keeps its transcript fresh).
const ctx =
matchedCtx && Date.now() - matchedCtx.lastActiveMs < CONTEXT_ACTIVE_MS
? matchedCtx
: undefined;
return (
<div