[feature] CRW-11940: Expose CLI Activity Tracker configuration as environment variables - #376
Conversation
|
@vrubezhny: This pull request references CRW-11940 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Hi! I'm che-ai-assistant — I help with your pull requests. I check for new comments every 10m0s, so there may be a short delay before I respond. Available commands:
|
be68c5b to
5b19ba4
Compare
|
CheCode Editor images for the PR are published ✨ Editor amd64: quay.io/che-incubator-pull-requests/che-code:pr-779-amd64 |
5b19ba4 to
2d1aec0
Compare
Opened to create a CheCode editor image to test: - eclipse-che/che-machine-exec#376 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
…ironment variables DevWorkspace idling and better user activity tracking for long-running CLIs is expected to be configured on the CheCluster CR level. This change exposes CLI Watcher .noidle config parameters as environment variables so cluster/DevWorkspace administrators can configure CLI Watcher behavior without forcing users to create .noidle config files. - Add 6 env vars: CLI_ACTIVITY_TRACKER_ENABLED, CLI_ACTIVITY_TRACKER_CHECK_PERIOD, CLI_ACTIVITY_TRACKER_ACTIVITY_WINDOW, CLI_ACTIVITY_TRACKER_GRACE_PERIOD, CLI_ACTIVITY_TRACKER_MAX_PROCESS_AGE, CLI_ACTIVITY_TRACKER_VERBOSE - Env vars act as admin ceilings: .noidle can only tighten (shorten) timing params, never loosen beyond admin-set values - CLI_ACTIVITY_TRACKER_ENABLED is admin-only; .noidle 'enabled' is deprecated - CLI_ACTIVITY_TRACKER_VERBOSE promotes activity-detection details from Debug to Info level without requiring LOG_LEVEL=debug app-wide; admin/env-only, no .noidle equivalent - Comprehensive logging of every resolved parameter with source and any rejected overrides - CLI Watcher works without .noidle file when env vars are set - Fix repeated/incorrect config-removal logging when no .noidle file has ever existed - Fix false-positive interactive classification in the atime fallback: process state and /proc/<pid>/fd mtime were non-specific (true for almost any blocked or young process), causing non-interactive commands like `sleep` to be misclassified as interactive for their first ~5 minutes; classification now relies solely on the wchan signal - Add a CPU-usage based fallback for activity-freshness checks (hasTTYActivity), used when TTY atime hasn't advanced past process start (e.g. noatime devpts mounts), which previously had no fallback at all and would report "never active" forever - Detect and warn at startup if devpts is mounted noatime, since that degrades activity detection to the CPU-usage fallback - Rewrite CLI-WATCHER.md with admin ConfigMap/DevWorkspace examples, adaptive defaults formulas, and admin testing scenarios Issue: https://redhat.atlassian.net/browse/CRW-11940 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com> Assisted-By: Claude Opus 4.6 <noreply@anthropic.com> Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
2d1aec0 to
8a5ecbd
Compare
Opened to create a CheCode editor image to test: - eclipse-che/che-machine-exec#376 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Note: This PR is based on #363 (CLI Watcher core implementation). The changes described below are additions on top of that PR.
This PR adds administrator-level configuration support for the CLI Watcher via environment variables, enabling cluster-wide control through the CheCluster CR without requiring users to create
.noidleconfig files.What does this PR do?
CLI_ACTIVITY_TRACKER_ENABLED,CLI_ACTIVITY_TRACKER_CHECK_PERIOD,CLI_ACTIVITY_TRACKER_ACTIVITY_WINDOW,CLI_ACTIVITY_TRACKER_GRACE_PERIOD,CLI_ACTIVITY_TRACKER_MAX_PROCESS_AGE,CLI_ACTIVITY_TRACKER_VERBOSE.noidlecan only tighten (shorten) timing params, never loosen beyond admin-set valuesCLI_ACTIVITY_TRACKER_VERBOSEpromotes activity-detection details (which process was detected, why it does/doesn't prevent idling) from Debug to Info level, without requiringLOG_LEVEL=debugfor the whole application. Admin/env-only — no.noidleequivalent..noidlefile when env vars are set.noidlefile has ever existed/proc/<pid>/fdmtime were non-specific signals (true for almost any blocked or young process), causing non-interactive commands likesleepto be misclassified as interactive for their first ~5 minutes of life. Classification now relies solely on thewchansignal, verified against a live workspacenoatimedevpts mounts). Previously this check had no fallback at all and would silently report "never active" forever in that scenariodevptsis mountednoatime, since that degrades activity detection to the CPU-usage fallbackCLI-WATCHER.mdwith CheCluster CR configuration, admin ConfigMap/DevWorkspace examples, adaptive defaults formulas, corrected fallback-detection documentation, and admin testing scenariosBreaking change
CLI Watcher enablement is now exclusively controlled by the
CLI_ACTIVITY_TRACKER_ENABLEDenvironment variable (set by the administrator via CheCluster CR or ConfigMap). Theenabledfield in.noidleis deprecated and ignored — if present, a deprecation warning is logged and the value is disregarded. Users who previously enabled the watcher via.noidlemust ask their cluster administrator to setCLI_ACTIVITY_TRACKER_ENABLED=true.What issues does this PR fix or reference?
How to test this PR?
See testing scenarios in
timeout/CLI-WATCHER.md— covers env var configuration, ceiling enforcement,.noidleinteraction, and hot-reload behavior.