Skip to content

fix: make cleaner-agent mid-build usage thresholds configurable - #165

Draft
openswe-shared-services[bot] wants to merge 2 commits into
masterfrom
open-swe/cleaner-agent-inode-threshold
Draft

openswe-shared-services[bot] wants to merge 2 commits into
masterfrom
open-swe/cleaner-agent-inode-threshold

Conversation

@openswe-shared-services

@openswe-shared-services openswe-shared-services Bot commented Sep 17, 2026

Copy link
Copy Markdown

Why

Triage of CCS-61 / CF-2350 (justpark-inc build failures from inode exhaustion on reused dind volumes) found that cleaner/cleaner-agent.sh — the loop that runs continuously during a build to reclaim disk/inodes — hardcodes its trigger thresholds to 0.9 and never looks at DISK_USAGE_THRESHOLD/INODES_USAGE_THRESHOLD, even though those are documented, chart-configurable env vars and the pre-build docker-clean.sh check honors them correctly. So an account/pipeline that needs the mid-build cleaner to be more aggressive (lower threshold) has no way to configure that — it always waits for 90%.

Separately, functions.sh's check_inodes_usage_threshold() falls back to DISK_USAGE_THRESHOLD (not INODES_USAGE_THRESHOLD) when called without an explicit threshold argument — a latent copy-paste bug, currently masked because every caller passes an explicit arg.

What changed

  • cleaner/config: added CLEANER_AGENT_DISK_USAGE_THRESHOLD / CLEANER_AGENT_INODES_USAGE_THRESHOLD (default 0.9, same as before) as the dedicated, overridable knobs for cleaner-agent.sh's mid-build loop, distinct from the pre-build DISK_USAGE_THRESHOLD/INODES_USAGE_THRESHOLD (default 0.8).
  • cleaner/cleaner-agent.sh: removed the hardcoded START_DISK_USAGE_THRESHOLD/START_INODES_USAGE_THRESHOLD locals and reads the new config values instead.
  • cleaner/functions.sh: fixed check_inodes_usage_threshold()'s no-arg fallback to use INODES_USAGE_THRESHOLD.
  • cleaner/README.md: documented the new/existing threshold env vars and their defaults.

Behavior for every account is unchanged unless someone sets CLEANER_AGENT_DISK_USAGE_THRESHOLD/CLEANER_AGENT_INODES_USAGE_THRESHOLD explicitly (defaults keep the previous 0.9).

Testing

  • bash -n on all three modified scripts.
  • Sourced config + functions.sh and called check_inodes_usage_threshold with no arg to confirm it now reads INODES_USAGE_THRESHOLD (0.8) instead of DISK_USAGE_THRESHOLD.

Related

  • Linear CCS-61 (triage-agent test copy) / CF-2350 (live ticket) — this is one hypothesis from that triage; it doesn't by itself confirm the two failing example builds crossed this threshold (Grafana data for those wasn't available), so please treat as a targeted configurability fix, not a guaranteed resolution.

Made by Open SWE · anthropic:claude-sonnet-5 (medium)

Security Report — codefresh/dind

Fixed CVEs: 0

Fixed issues: 0

cleaner-agent.sh hardcoded its mid-build disk/inode thresholds to 0.9,
ignoring any DISK_USAGE_THRESHOLD/INODES_USAGE_THRESHOLD override set via
the Runtime Environment spec, unlike the pre-build docker-clean.sh check.
Introduce separate CLEANER_AGENT_DISK_USAGE_THRESHOLD/
CLEANER_AGENT_INODES_USAGE_THRESHOLD config entries (default 0.9, kept
higher than the pre-build 0.8 default) so accounts can tune when the
continuous mid-build cleaner steps in.

Also fix check_inodes_usage_threshold()'s no-arg fallback, which
defaulted to DISK_USAGE_THRESHOLD instead of INODES_USAGE_THRESHOLD.
Comment thread cleaner/functions.sh Outdated

check_inodes_usage_threshold(){
local THRESHOLD=${1:-${DISK_USAGE_THRESHOLD}}
local THRESHOLD=${1:-${INODES_USAGE_THRESHOLD}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bad naming

Comment thread cleaner/functions.sh Outdated

check_inodes_usage_threshold(){
local THRESHOLD=${1:-${DISK_USAGE_THRESHOLD}}
local THRESHOLD=${1:-${INODES_USAGE_THRESHOLD}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@open-swe this is a bad naming

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to DISK_THRESHOLD/INODES_THRESHOLD in 552199a.

check_disk_usage_threshold() and check_inodes_usage_threshold() both
declared a local variable named THRESHOLD, which review flagged as
confusing/bad naming given the two functions sit side by side and
handle different units. Rename to DISK_THRESHOLD/INODES_THRESHOLD.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants