Repository navigation
Reject non-finite --min-age in cleanup-grid-sessions.py - #5883
Merged
Merged
Conversation
Eugene (OEvgeny)
marked this pull request as ready for review
October 17, 2026 04:34
Eugene (OEvgeny)
requested review from
William Wong (compulim),
Chris Whitten (cwhitten) and
TJ Durnford (tdurnford)
as code owners
October 17, 2026 04:34
Eugene (OEvgeny)
enabled auto-merge (squash)
October 17, 2026 04:34
William Wong (compulim)
approved these changes
Oct 17, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused validation change addresses the unsafe inputs, with reported verification confirming rejection before grid access and preserved valid behavior.
No open issues 🎉
What changed in this PR
Hardens the Selenium Grid cleanup script so invalid age thresholds cannot cause unintended session cleanup.
Changes:
- Rejects non-finite and negative
--min-agevalues before contacting the grid. - Provides a clearer validation error while preserving valid inputs and defaults.
| File | Description |
|---|---|
.github/skills/webchat-html-tests/scripts/cleanup-grid-sessions.py |
Adds finite, nonnegative age validation using math.isfinite(). |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Not required, development only.
Description
Follow-up to #5880, from this review comment.
cleanup-grid-sessions.py --min-ageusestype=float, so it acceptsnanandinf. The old check only rejected negative values:--min-age nanpassed, and becauseage < nanis always false, the script deleted every session with a known start time, including young sessions of other runs on a shared grid.--min-age inf(or1e400) passed and kept every session, which is never what the caller wants.The script now rejects any value that is not a finite number of seconds, zero or more, before it contacts the grid.
Specific Changes
cleanup-grid-sessions.py: validate--min-agewithmath.isfinite()in addition to the negative check, with the error--min-age must be a finite number of seconds, zero or moreVerified against a fake grid status server on a local port (one 10-second-old session, one 1000-second-old session, one with unknown start time), logging every request:
nan,NaN,inf,-inf,Infinity,1e400,-1,-0.5: exit code 2 with the error, no HTTP request0,400,400 --dry-run,--dry-run, and no option: same output and requests as beforeI have added tests and executed them locally
I have updated
CHANGELOG.mdI have updated documentation
Review Checklist
z-index)package.jsonandpackage-lock.jsonreviewed