Skip to content

test(e2e): wait for portable gateway serve record - #9379

Merged
cv merged 4 commits into
mainfrom
agent/fix-portable-gateway-launch-race
Aug 18, 2026
Merged

test(e2e): wait for portable gateway serve record#9379
cv merged 4 commits into
mainfrom
agent/fix-portable-gateway-launch-race

Conversation

@prekshivyas

@prekshivyas prekshivyas commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

An injected gateway record failure can return before the asynchronous gateway process records its serve command. The regression test now waits for that required command. It still validates the launch-record PID, active process, and cleanup behavior.

Related Issue

Related to #9208.

Changes

  • Use bounded Vitest polling for the expected generate-certs and serve sequence.
  • Keep the launch-record PID, active-process, and cleanup assertions after the command sequence appears.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run --project e2e-support test/e2e/support/portable-profile-systemctl-shim.test.ts --reporter=verbose passed 36/36 on f33c18283.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Prekshi Vyas prekshiv@nvidia.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when handling gateway cleanup failures by ensuring required activity is recorded before results are validated.
  • Tests
    • Increased stability across gateway startup, cleanup-failure, and launch-failure scenarios.
    • Added consistent waiting and log verification to reduce timing-related test failures and produce more dependable validation results.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
@prekshivyas prekshivyas self-assigned this Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d6b180c2-0f47-48cb-911a-6f1eb47d51af

📥 Commits

Reviewing files that changed from the base of the PR and between a3219fa and 4aaa3ff.

📒 Files selected for processing (1)
  • test/e2e/support/portable-profile-systemctl-shim.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/support/portable-profile-systemctl-shim.test.ts

Included review availability: Your plan includes up to 12 reviews per rolling hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

Gateway tests now poll asynchronous command logs for expected generate-certs and serve records before validating log contents and process state.

Changes

Gateway log readiness

Layer / File(s) Summary
Poll gateway command log
test/e2e/support/portable-profile-systemctl-shim.test.ts
Reusable helpers parse JSONL command records and poll for expected commands. Gateway lifecycle, cleanup-failure, and launch-record failure tests use the helpers before validation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 4aaa3

This PR makes the gateway regression test wait for the asynchronous serve record before validating process and cleanup behavior; no actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: waiting for the portable gateway serve record in the E2E test.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-portable-gateway-launch-race

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit abaf903 in the agent/fix-portable-g... branch remains at 96%, unchanged from commit c4c987d in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit abaf903 in the agent/fix-portable-g... branch remains at 83%, unchanged from commit c4c987d in the main branch.

Show a code coverage summary of the most impacted files.
File main c4c987d agent/fix-portable-g... abaf903 +/-
src/lib/cua/bounded-file.ts 94% 84% -10%
src/lib/cua/run...ime-manifest.ts 91% 84% -7%
src/lib/state/o...d-checkpoint.ts 91% 87% -4%
src/lib/onboard...nt-authority.ts 79% 75% -4%
src/lib/state/p...l-retirement.ts 84% 86% +2%
src/lib/onboard...press-resume.ts 79% 82% +3%
src/lib/onboard...file-builder.ts 91% 95% +4%
src/lib/onboard...der/snapshot.ts 75% 83% +8%
src/lib/shields...ate-mutation.ts 70% 78% +8%
src/lib/securit...ntial-filter.ts 84% 96% +12%

Updated August 18, 2026 04:23 UTC

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized terminology decisions match; normalized E2E selections match; severity counts match.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: None

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

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

Could this race fix also remove the repeated gateway-command parser? This file reads, trims, splits, and parses scope.gatewayCommandLog at lines 658, 753, and 814 of the latest PR commit. Extracting readGatewayCommands and a waitForGatewayCommands helper would let this test receive the parsed generate-certs and serve sequence without the outer mutable commands variable. Reusing the helper at the other two call sites should make the fix neutral or negative in lines of code while keeping the same assertions.

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

LOC Reduction / Codebase Simplicity Review\n\nRequesting changes because repeats the same JSONL parser at three call sites. Extract and , reuse them for each assertion, and remove the mutable outer variable. The fix can preserve its behavior with less repeated test machinery.

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

LOC Reduction / Codebase Simplicity Review

Why this blocks

  • test/e2e/live/openclaw-portable-lifecycle.test.ts repeats the same gatewayCommandLog JSONL parser at three call sites.
  • The wait path also relies on a mutable outer variable.

Refactor direction

  • Extract readGatewayCommands for parsing.
  • Extract waitForGatewayCommands for the polling contract.
  • Reuse both helpers for all three assertions.

Expected result

  • Preserve the race fix while removing repeated parsing and mutable test state.
  • Bring the change toward neutral or negative test LOC.

@jyaunches
jyaunches dismissed their stale review August 18, 2026 02:35

Superseded by the correctly rendered structured LOC Reduction / Codebase Simplicity Review.

@jyaunches
jyaunches dismissed their stale review August 18, 2026 03:33

Resolved by commit 4aaa3ff; the repeated JSONL parser and mutable outer state were replaced with shared bounded read/wait helpers.

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

LOC Reduction / Codebase Simplicity Review

Re-reviewed latest PR commit 4aaa3ff95ab29b8d8e705bea242815b701c9ed5f. The revision resolves my prior change request.

test/e2e/support/portable-profile-systemctl-shim.test.ts:363-380 now owns the JSONL parser and bounded wait in readGatewayCommands and waitForGatewayCommands. The three assertions reuse those helpers at lines 677, 764, and 817. The repeated parsers and mutable outer command state are gone, and the complete PR is +22/-18.

I found no new blocking LOC or codebase-simplicity issue. This comment closes only the prior simplicity review; it is not an approval of other review dimensions.

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed exact commit 4aaa3ff95ab29b8d8e705bea242815b701c9ed5f; all 36 focused E2E-support tests passed locally.

No actionable findings. The bounded vi.waitFor now waits for the complete ordered command sequence and returns the parsed records, while the existing launch-record PID, live-process, failure, and cleanup assertions remain intact.

GitHub does not permit an author to approve their own pull request, so this is a completed review comment rather than an approval.

@cv
cv merged commit e55d76d into main Aug 18, 2026
50 checks passed
@cv
cv deleted the agent/fix-portable-gateway-launch-race branch August 18, 2026 06:44
@github-actions github-actions Bot added the v0.0.110 Release target label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.0.110 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants