Skip to content

[feature] CRW-11940: Expose CLI Activity Tracker configuration as environment variables - #376

Open
vrubezhny wants to merge 1 commit into
eclipse-che:mainfrom
vrubezhny:feature/cli-watcher-env-vars-and-flags
Open

[feature] CRW-11940: Expose CLI Activity Tracker configuration as environment variables#376
vrubezhny wants to merge 1 commit into
eclipse-che:mainfrom
vrubezhny:feature/cli-watcher-env-vars-and-flags

Conversation

@vrubezhny

@vrubezhny vrubezhny commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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 .noidle config files.

What does this PR do?

  • Adds 6 environment variables for admin-level CLI Watcher configuration: 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_VERBOSE promotes activity-detection details (which process was detected, why it does/doesn't prevent idling) from Debug to Info level, without requiring LOG_LEVEL=debug for the whole application. Admin/env-only — no .noidle equivalent.
  • CLI Watcher works without .noidle file when env vars are set
  • Comprehensive logging of every resolved parameter with source and any rejected overrides
  • Fixed repeated/incorrect "config file removed" logging when no .noidle file has ever existed
  • Fixed false-positive interactive classification in the atime fallback: process state and /proc/<pid>/fd mtime were non-specific signals (true for almost any blocked or young process), causing non-interactive commands like sleep to be misclassified as interactive for their first ~5 minutes of life. Classification now relies solely on the wchan signal, verified against a live workspace
  • Added a CPU-usage based fallback for activity-freshness checks, used when TTY atime hasn't advanced past process start (e.g. noatime devpts mounts). Previously this check had no fallback at all and would silently report "never active" forever in that scenario
  • CLI Watcher now detects and warns at startup if devpts is mounted noatime, since that degrades activity detection to the CPU-usage fallback
  • Rewrite CLI-WATCHER.md with CheCluster CR configuration, admin ConfigMap/DevWorkspace examples, adaptive defaults formulas, corrected fallback-detection documentation, and admin testing scenarios

Breaking change

CLI Watcher enablement is now exclusively controlled by the CLI_ACTIVITY_TRACKER_ENABLED environment variable (set by the administrator via CheCluster CR or ConfigMap). The enabled field in .noidle is deprecated and ignored — if present, a deprecation warning is logged and the value is disregarded. Users who previously enabled the watcher via .noidle must ask their cluster administrator to set CLI_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, .noidle interaction, and hot-reload behavior.

@openshift-ci-robot

openshift-ci-robot commented Aug 1, 2026

Copy link
Copy Markdown

@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.

Details

In response to this:

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 .noidle config files.

What does this PR do?

  • Adds 5 environment variables for admin-level CLI Watcher configuration: 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
  • Env vars act as admin ceilings: .noidle can only tighten (shorten) timing params, never loosen beyond admin-set values
  • CLI Watcher works without .noidle file when env vars are set
  • Comprehensive logging of every resolved parameter with source and any rejected overrides
  • Rewrite CLI-WATCHER.md with CheCluster CR configuration, admin ConfigMap/DevWorkspace examples, adaptive defaults formulas, and admin testing scenarios

Breaking change

CLI Watcher enablement is now exclusively controlled by the CLI_ACTIVITY_TRACKER_ENABLED environment variable (set by the administrator via CheCluster CR or ConfigMap). The enabled field in .noidle is deprecated and ignored — if present, a deprecation warning is logged and the value is disregarded. Users who previously enabled the watcher via .noidle must ask their cluster administrator to set CLI_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, .noidle interaction, and hot-reload behavior.

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.

@tolusha

tolusha commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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:

  • /che-ai-assistant generate-che-doc — Generate a documentation PR based on this PR's changes
  • /che-ai-assistant ok-pr-review — Run a comprehensive PR review (summary, code review, deep review, impact analysis)
  • /che-ai-assistant ok-pr-readiness — Ensure PR has validation steps
  • /che-ai-assistant check-pr-test-failures — Analyze failing CI checks, identify root causes, and suggest fixes
  • /che-ai-assistant update-che-e2e-tests — Update Eclipse Che e2e tests
  • /che-ai-assistant claude — Run a free-form instruction on this PR
  • /che-ai-assistant help — Show this help message

@vrubezhny

Copy link
Copy Markdown
Contributor Author

@vrubezhny
vrubezhny force-pushed the feature/cli-watcher-env-vars-and-flags branch from 5b19ba4 to 2d1aec0 Compare August 12, 2026 18:05
vrubezhny added a commit to vrubezhny/che-code that referenced this pull request Aug 12, 2026
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>
@vrubezhny
vrubezhny force-pushed the feature/cli-watcher-env-vars-and-flags branch from 2d1aec0 to 8a5ecbd Compare August 13, 2026 03:55
vrubezhny added a commit to vrubezhny/che-code that referenced this pull request Aug 13, 2026
Opened to create a CheCode editor image to test:

- eclipse-che/che-machine-exec#376

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants