Skip to content

refactor(e2e): migrate agent-turn-latency to shared inference adapter (#5745) - #8619

Merged
cv merged 3 commits into
NVIDIA:mainfrom
wakqasahmed:fix/agent-turn-latency-migration-5745
Aug 8, 2026
Merged

refactor(e2e): migrate agent-turn-latency to shared inference adapter (#5745)#8619
cv merged 3 commits into
NVIDIA:mainfrom
wakqasahmed:fix/agent-turn-latency-migration-5745

Conversation

@wakqasahmed

@wakqasahmed wakqasahmed commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

agent-turn-latency-helpers.ts and agent-turn-latency.test.ts derived their own model, provider, and expected route via ad hoc NEMOCLAW_* env inspection, duplicating logic the shared E2E inference adapter (#5745) already centralizes. This migrates both to route through the adapter instead.

Changes

  • env(), installSandbox(), cleanupTurnSandbox(s)(), route(), openclawTurn(), and waitHermesHealth() now take an AgentTurnInference value (the adapter's env/expectedRouteProvider/model/mode/provider/redactionValues) instead of a bare apiKey plus locally computed MODEL/PROVIDER/EXPECTED_ROUTE_PROVIDER.
  • The test now skips itself when the adapter resolves to hermetic mock mode, since a real latency measurement is meaningless against a loopback stub. Select internal-nvidia or public-nvidia via NEMOCLAW_E2E_INFERENCE_MODE to run it for real; e2e.yaml sets NEMOCLAW_E2E_INFERENCE_MODE=internal-nvidia for this job accordingly.
  • Progress-support unit tests exercise the same helpers with a small fakeInference() stand-in instead of a bare secret string.

No behavior change for callers already setting NEMOCLAW_E2E_USE_HOSTED_INFERENCE; this only removes the duplicated model/provider/route derivation.

Test plan

  • npx vitest run --project e2e-support test/e2e/support/agent-turn-latency-progress.test.ts — 8/8 passed
  • npm run validate:pr equivalent hooks (pre-commit, commit-msg, pre-push) all passed locally, including CLI/plugin TypeScript checks

Signed-off-by: Waqas Ahmed wakqasahmed@protonmail.com

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated live latency checks to use the configured hosted inference endpoint for more representative measurements.
    • Mock inference runs are now skipped during live latency measurements.
    • Expanded coverage for inference configuration, routing, credentials, health checks, and redaction.
    • Improved validation of sandbox setup, retries, failure handling, cleanup, and endpoint health monitoring.

…NVIDIA#5745)

agent-turn-latency-helpers.ts and agent-turn-latency.test.ts derived their
own model, provider, and expected route from ad hoc NEMOCLAW_* env
inspection, duplicating logic the shared E2E inference adapter (NVIDIA#5745)
already centralizes. Route both through the adapter instead:

- env(), installSandbox(), cleanupTurnSandbox(s)(), route(), openclawTurn(),
  and waitHermesHealth() now take an AgentTurnInference value (the adapter's
  env/expectedRouteProvider/model/mode/provider/redactionValues) instead of
  a bare apiKey and locally computed MODEL/PROVIDER/EXPECTED_ROUTE_PROVIDER.
- The test skips itself when the adapter resolves to hermetic `mock` mode,
  since a real latency measurement is meaningless against a loopback stub;
  select `internal-nvidia` or `public-nvidia` via NEMOCLAW_E2E_INFERENCE_MODE
  to run it for real. e2e.yaml sets NEMOCLAW_E2E_INFERENCE_MODE=internal-nvidia
  for this job accordingly.
- Progress-support unit tests exercise the same helpers with a small
  fakeInference() stand-in instead of a bare secret string.

No behavior change for callers already setting NEMOCLAW_E2E_USE_HOSTED_INFERENCE;
this only removes the duplicated model/provider/route derivation.

Signed-off-by: Waqas Ahmed <wakqasahmed@protonmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 8, 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: df8e1325-46c2-45d4-aa2d-f3d3d35435d2

📥 Commits

Reviewing files that changed from the base of the PR and between 038ab4d and f2d599d.

📒 Files selected for processing (2)
  • test/e2e/fixtures/inference-adapter.ts
  • test/e2e/live/agent-turn-latency.test.ts

📝 Walkthrough

Walkthrough

The agent-turn latency E2E test now consumes injected inference adapter configuration. Helpers use adapter-provided environments and redaction values. The workflow selects internal NVIDIA inference mode, and support tests use a reusable fake inference fixture.

Changes

Agent turn latency inference integration

Layer / File(s) Summary
Inference configuration and helper propagation
test/e2e/live/agent-turn-latency-helpers.ts
Helpers accept AgentTurnInference for environment construction, sandbox lifecycle operations, routing, turns, health checks, and redaction.
Adapter-driven live latency flow
.github/workflows/e2e.yaml, test/e2e/live/agent-turn-latency.test.ts, test/e2e/fixtures/inference-adapter.ts
The E2E job selects internal-nvidia mode. The latency test uses the inference fixture for model, provider, routing, validation, cleanup, and turns. normalizeMode is exported for mode detection.
Support test fixture migration
test/e2e/support/agent-turn-latency-progress.test.ts
Progress tests use a reusable fake inference configuration for installation, retry, failure, and cleanup cases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: area: inference

Suggested reviewers: cv, jyaunches

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the migration of the agent-turn-latency E2E tests to the shared inference adapter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed after a partial review · low confidence · 0 blockers · 0 warnings · 0 suggestions

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

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • justified — real latency measurement at test/e2e/live/agent-turn-latency.test.ts:36: Keep the term because the contrast explains why mock mode is skipped.
  • justified — test-definition boundary at test/e2e/live/agent-turn-latency.test.ts:41: Keep the term because it distinguishes two test skip mechanisms.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite against this exact revision.

Recommended E2E: cloud-inference, cloud-onboard, security-posture, agent-turn-latency, inference-routing, network-policy

1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Add a workflow-boundary test for the latency inference mode

  • Location: .github/workflows/e2e.yaml:2887
  • Category: tests
  • Problem: The workflow sets the agent-turn-latency job to internal-nvidia mode, but no workflow-boundary test asserts that job-specific setting.
  • Impact: A later workflow edit can remove or change the mode, causing the canonical latency job to register the test as skipped instead of measuring hosted inference latency.
  • Recommendation: Add a workflow-boundary assertion that agent-turn-latency has NEMOCLAW_E2E_INFERENCE_MODE set to internal-nvidia.
  • Verification: Read the agent-turn-latency job environment from e2e.yaml in its existing workflow-boundary test harness and confirm the assertion fails after changing the value to mock.
  • Test coverage: A workflow-boundary test that reads e2e.yaml and fails when agent-turn-latency does not set NEMOCLAW_E2E_INFERENCE_MODE to internal-nvidia.
  • Evidence: .github/workflows/e2e.yaml:2887 sets NEMOCLAW_E2E_INFERENCE_MODE to internal-nvidia for agent-turn-latency. test/e2e/live/agent-turn-latency.test.ts:42 skips the test when normalizeMode(process.env) is mock. test/e2e/support/trusted-hermes-swap-workflow-boundary.test.ts:517-552 validates the job's trusted swap boundary but not its inference-mode environment.

Workflow run details

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

wakqasahmed and others added 2 commits August 8, 2026 15:52
…dary

codebase-growth-guardrails flagged the mode skip added in the prior commit:
it was an `if` inside the test body, which the guardrail requires to be a
skipIf/runIf boundary instead. Move it there, matching the existing
runIssue4434LiveTest pattern in issue-4434-tui-unreachable-inference.test.ts:
resolve NEMOCLAW_E2E_INFERENCE_MODE once at module scope via the adapter's
own normalizeMode() (now exported instead of duplicated) and gate the test
with `test.skipIf(...)`. Biome's reformat of the now-differently-wrapped
test() call accounts for most of the diff noise.

Signed-off-by: Waqas Ahmed <wakqasahmed@protonmail.com>

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@cv
cv merged commit e16b5d4 into NVIDIA:main Aug 8, 2026
5 of 6 checks passed
@github-actions github-actions Bot added the v0.0.106 Release target label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.0.106 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants