Show foreground applications in Canopy session navigation
Make session navigation and pane headers reflect the application running inside a shell, including Shell → Pi → Shell transitions. Reuse the existing Kwi/service-reported terminal leader PID and read bounded same-user Linux controlling-terminal/foreground-group information in the GUI, rather than terminal-title or output/silence guesses. Keep the wire protocol and daemon unchanged so live services need not restart. Recompute identity on reconnect; preserve saved labels/kinds as launch metadata and never persist process arguments or transient foreground labels. Prefer executable names, recognising Node/Bun-hosted Pi by its exact process name; do not read argv or environment. Resolve Pi correctly when hosted by Node/Bun, with bounded same-user process inspection and conservative fallback for unavailable/unsupported observations. Do not expose full command lines, prompts or credentials, infer agent working/blocked state, or restart/migrate the active Canopy window/service. Use isolated fixtures and the private virtual desktop for tests. Acceptance: actual shell-launched foreground process and offline Pi update live labels and return to Shell on exit; background jobs do not replace the foreground label; reconnect reflects the current application; unavailable process data falls back safely; persisted layout remains unchanged by application observations. Validate backend and rendered UI regression tests and document behaviour/limitations. Verified implementation: committed the preceding launcher/icon work locally on main as 267bdc1 (feature: Add desktop launcher and application icon), without pushing, then created feature/detect-foreground-applications. The live-label feature remains uncommitted. ForegroundApplication.cpp performs same-user, bounded Linux process reads using the existing terminal leader PID and controlling-terminal foreground group. It checks session/group membership and leader/foreground start times, handles a departed pipeline leader via at most 256 direct children, and rejects malformed/oversized/restricted or inconsistent data. It reads stat/exe/children only, not argv/environment. Exact pi/pi-rpc process names identify Node/Bun-hosted Pi; native executable basenames provide conservative generic labels. No daemon/client protocol or upstream patch changes are needed, so existing live services stay compatible. Pane adds a read-only displayName with one-second observation only while running, ready and connected. Sidebar and pane headers use it with plain text and elision; saved labels, kinds and tab names remain unchanged. Loss of availability returns to the saved-label fallback. README documents foreground-vs-owned PID semantics, wrapper/SSH limitations and the absence of agent-activity inference. The active app/service/conversation was not restarted or stopped. Validation: all five CTest suites pass (foreground/workspace/layout/service/snapshot), and the private virtual-KWin suite passes all nine behavioural cases (11 QtTest passes including setup/cleanup). New foreground unit suite has 12 data/behaviour cases (14 including setup/cleanup), covering ordinary foreground/background jobs, Node/Bun/native Pi identities and negative matches, exec-in-place, pipeline leader exit, foreign session membership, PID reuse, malformed/missing/oversized state and child-inspection budgets. Real local-shell tests verify sleep → Shell, ignored background sleep, ignored spoofed Pi terminal title, zero layout-edit signals and identical serialized layout. A real offline Pi launched inside a service-owned shell produces Shell → Pi → Shell; another attached model independently detects the same Pi/root PID, with unchanged saved bytes. Native captures verify both session-list and pane-header Pi/Shell labels using actual offline Pi, without loading user extensions/context, saving a conversation or sending a model prompt. Captures were visually inspected. C++/QML formatting, compiler output, whitespace and private-metadata checks pass. Limitations: Linux-local observation only, about one-second latency; arbitrary interpreter/wrapper identity and remote SSH applications are not guessed. Other wrappers may show node/python/etc.; inaccessible or inconsistent process information uses the saved label. This is application identity, not working/blocked agent state.
Checklist
3 of 3 complete- Show live application names in session navigation/pane headers without changing persisted launch labels or requiring daemon restart.
- Implement bounded foreground application observation with conservative Pi/runtime identification and safe unknown-process fallback.
- Verify actual foreground/background job and offline Pi transitions, reconnect behaviour, rendered UI and unchanged layout persistence.
- Area
- Personal tooling
- Project
- Canopy
- Kind
- Feature
- Task ID
tsk_udbtp7famg- Updated