Skip to content

[code-improvement] code-quality: reject invalid exec response timeouts - #172

Merged
Pedro Henrique Penna (ppenna) merged 4 commits into
devfrom
code-improvement/control-session-timeout-35663903111-57fffca35f92f2f8
Sep 22, 2026
Merged

Pedro Henrique Penna (ppenna) merged 4 commits into
devfrom
code-improvement/control-session-timeout-35663903111-57fffca35f92f2f8

Conversation

@ppenna

Copy link
Copy Markdown
Contributor

Scope

Named improvement category: code-quality.

ControlSession.exec previously accepted zero, negative, and NaN response timeouts until after it had sent the managed exec request. Invalid host input could therefore launch a guest workload and only then fail while waiting for its response. The guard now rejects those values before generating or transmitting the request, and the regression test verifies that the peer receives no bytes.

The prepared baseline was green, and live dev had no completed CI run for its current HEAD, so no failing-check scope applied. Category weighting selected code-quality (weight 5). Searches of open issues, active pull requests, and prior code-improvement outcomes found no matching timeout change or rejected proposal. A separate release-metadata candidate was discarded because it overlapped active PR #124.

Patch

  • scripts/nvx_tools/control_session.py: validate the managed exec response timeout before sending.
  • scripts/test_control_session.py: cover zero, negative, and NaN values and assert no request bytes are sent.

Size: 2 files, 23 added plus deleted lines (23 additions, 0 deletions).

Validation

All commands passed:

  • python3 -m unittest scripts/test_control_session.py -v (4 tests)
  • python3 -m compileall -q scripts
  • python3 -m unittest scripts/test_performance.py scripts/test_nvx_tools.py scripts/test_microvm_tests.py scripts/test_development_release.py -v
  • python3 -m ruff check scripts
  • python3 -m pyright --pythonplatform Linux
  • python3 -m pyright --pythonplatform Windows
  • python3 -m ruff format --check scripts
  • python3 .github/skills/nvx-host-connect/scripts/test_hosts.py -v
  • python3 scripts/nvx.py --help
  • python3 scripts/nvx.py test-openvmm-unit --help
  • python3 scripts/nvx.py test-openvmm --help
  • python3 scripts/nvx.py test-microvm --help
  • python3 scripts/nvx.py benchmark --help
  • git diff --check

No dependency, public API, CLI, ABI, package-format, gitlink, or OpenVMM change was made.

Generated by code-improvement · copilot · gpt56 · 156.2 AIC · ⌖ 24.8 AIC · ⊞ 15.9K · ◷

  • expires on Oct 5, 2026, 10:50 PM UTC

Validate the host response timeout before sending a managed guest exec request, preventing invalid timeout values from launching work before failing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 22:50

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Positive infinity remains accepted, allowing a request to be sent with no finite response deadline.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds early validation for managed exec response timeouts to prevent transmitting requests with invalid deadlines.

Changes:

  • Rejects zero, negative, and NaN response timeouts.
  • Tests that rejected calls transmit no bytes.
File Description
scripts/​nvx_tools/​control_session.py Adds pre-send timeout validation.
scripts/​test_control_session.py Covers invalid timeout rejection and socket behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/nvx_tools/control_session.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 23:14

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

The positive-infinity rejection introduced by the guard lacks regression coverage.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Comment thread scripts/test_control_session.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 23:17

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The validation correctly prevents side effects and is covered by focused regression tests.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@ppenna
Pedro Henrique Penna (ppenna) marked this pull request as ready for review September 21, 2026 23:26
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 22, 2026 00:17

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The focused validation correctly handles invalid values before transmission and is adequately tested.

Review effort: Balanced
Findings: None

@ppenna
Pedro Henrique Penna (ppenna) merged commit 3b2234f into dev Sep 22, 2026
24 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the code-improvement/control-session-timeout-35663903111-57fffca35f92f2f8 branch September 22, 2026 00:53
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