* fix(system): increase process list limit and improve Docker detection for openEuler
Root cause analysis for issue #1453:
1. Process list limit too low: The `head -n 200` pipeline capped the process
list at 200 entries, causing the displayed count to mismatch `ps aux | wc -l`
on systems with many processes (common on openEuler servers with Docker,
databases, etc.). Increased limit from 200 to 2000 for both Linux/SSH
(ps) and Windows (PowerShell) backends.
2. Docker detection failure on openEuler 24.03: The capability probe only
relied on `docker info >/dev/null 2>&1`, which can fail even when Docker
is running due to:
- SSH exec channel environment differences vs interactive shell
- Docker socket permission variations in non-interactive sessions
- Different socket path configurations on openEuler
Added a fallback: if `docker info` fails but the Docker socket exists at
`/var/run/docker.sock`, Docker is still detected as available. This
matches the behavior of other SSH terminal clients.
* fix(system): also add Docker socket fallback to fallback probe script for consistency
* fix(system): remove hardcoded process list limit, add capability probe TTL, auto-reprobe on tab switch
Three remaining issues from PR #1455:
1. Remove hardcoded `head -n 2000` / `Select-Object -First 2000`
process list limits — virtual list handles rendering efficiently.
2. Add 60-second TTL to sessionCapabilitiesStore cache. `get()` returns
undefined for expired entries, forcing re-probe on next access.
`set()` always refreshes `probedAt`. Export CAPABILITIES_TTL_MS
constant for future tuning.
3. Auto-trigger capability re-probe when switching to Docker/Tmux tab
whose tool was previously reported unavailable — handles the case
where Docker/Tmux was installed after the last probe.
* fix: replace Docker socket -S check with -r for permission accuracy; sync capabilities TTL with process refresh interval
- Change [ -S /var/run/docker.sock ] to [ -r /var/run/docker.sock ] in
both the main capability probe script and the POSIX fallback (electron bridge).
-r verifies the socket exists AND the current user has read permission,
preventing false-positive Docker detection that leads to failed Docker ops.
- Remove hardcoded CAPABILITIES_TTL_MS (60s) from sessionCapabilitiesStore.
Store now computes expiresAt internally in set(ttlMs) and checks it in get()
without requiring a parameter at call sites.
- useSessionCapabilities and useSystemCapabilitiesWarmup accept a
capabilitiesTtlMs parameter derived from
terminalSettings.systemManagerProcessRefreshInterval (default 3s → 3 000ms).
- SystemManagerSidePanel passes the TTL from terminalSettings to the hook.
- TerminalLayerTabBridge passes TTL from stableRef settings to warmup hook.
- Fix missing refreshCapabilities destructuring in SystemManagerSidePanel.
* fix: restore process list safety cap (head -n 2000 / -First 2000)
Codex review flagged that removing the process list cap entirely could cause
timeout/maxBuffer issues on process-dense hosts. Restore head -n 2000 (POSIX)
and -First 2000 (Windows) as a safety guard with comments clarifying this is
NOT a functional limit — monitored processes still show accurate metrics.
* fix: hoist useRef/useEffect before early returns to fix React hook order violation
The useRef and useEffect for tab-switch re-probe were placed after early returns
for missing/disconnected sessions. When a session later connects, React discovers
new hooks that weren't registered before, causing hook order violation crashes.
Moved both hooks immediately after the resolvedTab computation, before any early
return path, satisfying React's Rules of Hooks.
* fix: change Docker detection from OR to AND (CLI + socket)
Both capability detection and fallback probe now require:
- docker CLI is on PATH (command -v docker)
- docker.sock is readable ([ -r /var/run/docker.sock ])
Previously used OR logic (docker info || socket readable),
which could report hasDocker=true even when docker CLI
was unavailable (e.g., non-login SSH shell).
Fixes#1453
* fix(system-monitor): prefer docker info, fallback to CLI+socket
Co-authored-by: Codex <codex@anthropic.com>
Changes:
- Line 12: Replace strict CLI+socket check with docker info first,
falling back to CLI+socket check only if docker info fails.
- Line 139: Same fix in the fallback probe script.
This handles DOCKER_HOST, Docker contexts, and rootless Docker.
* fix: notify subscribers when TTL expires in sessionCapabilitiesStore.get()
When capabilitiesBySessionId.get() finds an expired entry, it deletes the
entry but did not notify session subscribers. This caused components to
stale capabilities until the next successful set() call.
Now get() calls notifySession() on expiry, matching the notification
behavior already present in delete().