Skip to content

test(e2e): harden full inference probe - #8269

Merged
senthilr-nv merged 2 commits into
mainfrom
agent/harden-security-posture-model-probe
Aug 5, 2026
Merged

test(e2e): harden full inference probe#8269
senthilr-nv merged 2 commits into
mainfrom
agent/harden-security-posture-model-probe

Conversation

@apurvvkumaria

@apurvvkumaria apurvvkumaria commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stabilize the full E2E sandbox inference probe after the OpenClaw
security-posture lane received a successful Nemotron completion containing
The instead of the requested integer 42. The same job passed when rerun at
the same SHA, which identifies a live model-output flake rather than a product,
runner, credential, policy, or routing failure.

The probe now uses deterministic sampling where the model supports it, gives
reasoning models a larger bounded reply budget, retries one valid but
semantically wrong completion, and preserves structured completion evidence.
Runner types, workflow definitions, schedules, and E2E cadence are unchanged.

Failure Evidence

Changes

  • Replace the shell curl | python projection with direct curl argv so
    command/HTTP failures remain unambiguous and the raw response remains in the
    normal redacted shell artifacts.
  • Request temperature: 0 for models using max_tokens, use the shared token
    field resolver for incompatible model families, and bound attempts at 512
    then 1024 reply tokens.
  • Retry only a structurally valid successful response whose selected answer
    does not contain integer 42. Transport, HTTP/auth/policy, invalid JSON, and
    invalid completion-shape failures remain immediate.
  • Record a versioned per-attempt summary with outcome, token budget, exit code,
    parse error, answer match, model, finish_reason, content,
    reasoning_content, and usage.
  • Add fast support coverage for the observed The response, reasoning-budget
    truncation, strict failures, bounded exhaustion, unique artifacts, response
    parsing, and the existing whitespace-tolerant 4\n2 behavior.

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:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: This changes an internal live-E2E
    probe and its diagnostics; CLI/API/configuration and supported user behavior
    do not change.
  • 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: Independent Codex Desktop review found
    no correctness, credential, redaction, retry-masking, or security blocker.
    ShellProbe redaction remains authoritative for command output and
    ArtifactSink re-redacts the structured summary.
  • Non-success, skipped, or missing CI check accepted by maintainer — check
    name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: The diff is test-only and changes no user-facing behavior,
    configuration, runner type, workflow cadence, or supported surface. Naming,
    test titles, and diagnostic fields clearly describe the internal retry
    boundary.
  • Agent: Codex Desktop

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
  • Targeted behavior tests pass for the current change set — 13/13 focused
    inference-probe tests and 3/3 shared answer-assertion tests passed.
  • Applicable broad gate passed — not applicable; this is a scoped live-E2E
    probe change with focused fast coverage. typecheck:cli, semantic E2E phase,
    project membership, title style, source-shape, test-size, mock-parity, Biome,
    repository, and secret-scan checks passed.
  • 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: Apurv Kumaria akumaria@nvidia.com

Summary by CodeRabbit

  • Tests
    • Added comprehensive end-to-end inference coverage for request construction, response parsing, retries, answer validation, and failure classification.
    • Improved diagnostics with structured evidence artifacts, bounded output, and clearer outcome reporting.
    • Added validation for model-specific behavior, reasoning-content fallbacks, metadata preservation, and retry eligibility.
    • Included the new probe tests in the fast test suite.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 4, 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: 2846c686-b485-463b-8621-f30f14207d12

📥 Commits

Reviewing files that changed from the base of the PR and between 00a84fd and d4471a2.

📒 Files selected for processing (3)
  • test/e2e/live/full-e2e-inference-probe.ts
  • test/e2e/live/full-e2e.test.ts
  • test/e2e/support/full-e2e-inference-probe.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/live/full-e2e.test.ts

📝 Walkthrough

Walkthrough

The PR adds a shared inference probe for model-specific requests, response parsing, bounded retries, failure classification, integer-42 matching, and evidence generation. The live E2E test uses the probe, and support tests cover its behavior.

Changes

Inference probe

Layer / File(s) Summary
Request and response contracts
test/e2e/live/full-e2e-inference-probe.ts
Defines probe contracts, builds model-specific non-streaming requests, parses response content and reasoning fallbacks, and serializes bounded usage evidence.
Retry execution and live integration
test/e2e/live/full-e2e-inference-probe.ts, test/e2e/live/full-e2e.test.ts
Runs token-budget retries, classifies command, response, and semantic outcomes, writes evidence artifacts, and validates the final probe result.
Probe validation coverage
test/e2e/support/full-e2e-inference-probe.test.ts, test/e2e/mock-parity.json
Tests request construction, parsing, retries, failure classification, answer matching, evidence limits, and fast-test registration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant full-e2e.test.ts
  participant runFullE2eInferenceProbe
  participant sandbox inference command
  participant inference.local
  full-e2e.test.ts->>runFullE2eInferenceProbe: start inference probe
  runFullE2eInferenceProbe->>sandbox inference command: execute generated request
  sandbox inference command->>inference.local: send non-streaming inference request
  inference.local-->>sandbox inference command: return completion response
  sandbox inference command-->>runFullE2eInferenceProbe: return command result
  runFullE2eInferenceProbe-->>full-e2e.test.ts: return outcome and evidence
Loading

Suggested reviewers: senthilr-nv, aasthajh

🚥 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 and concisely describes the hardening changes to the full E2E inference probe.
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/harden-security-posture-model-probe

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

@apurvvkumaria
apurvvkumaria marked this pull request as ready for review August 4, 2026 23:30
@github-actions

github-actions Bot commented Aug 4, 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 differ; normalized E2E selections match; severity counts match.
1 terminology difference from the second opinion

Advisory only. These are normalized differences from the primary terminology receipt.

  • deterministic sampling at test/e2e/support/full-e2e-inference-probe.test.ts:29: selected only by the second-opinion lane as define.

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

2 semantic terminology decisions

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

  • established — reply budget at test/e2e/support/full-e2e-inference-probe.test.ts:29: Keep `reply budget`; it matches established inference-probe terminology.
  • define — semantic mismatch at test/e2e/live/full-e2e-inference-probe.ts:56: Define this outcome where it is exposed beyond the local type and tests; retain the current distinct classification.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-inference, cloud-onboard, security-posture, full-e2e, inference-routing, network-policy

Workflow run details

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

@github-code-quality

github-code-quality Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit d4471a2 in the agent/harden-securit... branch remains at 96%, unchanged from commit 2b18817 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit d4471a2 in the agent/harden-securit... branch remains at 81%, unchanged from commit 4e49bf1 in the main branch.

Show a code coverage summary of the most impacted files.
File main 4e49bf1 agent/harden-securit... d4471a2 +/-
src/lib/domain/.../connect-env.ts 97% 89% -8%
src/lib/policy/...ne-exclusion.ts 96% 92% -4%
src/lib/private-networks.ts 93% 90% -3%
src/lib/sandbox...rce-identity.ts 87% 87% 0%
src/lib/tunnel/services.ts 76% 76% 0%

Updated August 05, 2026 01:41 UTC

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/live/full-e2e.test.ts`:
- Around line 497-501: Update the sandbox inference evidence flow around
fullE2eInferenceProbeEvidence and artifacts.writeJson to project only an
allowlisted set of evidence fields, apply captureLimitBytes to potentially
unbounded content, reasoning_content, and usage data, and enforce a total byte
limit before storage. Pass the bounded projection to writeJson while preserving
the existing artifact name and inference-attempt evidence.

In `@test/e2e/support/full-e2e-inference-probe.test.ts`:
- Around line 109-115: Expand the assertions for fullE2eInferenceProbeEvidence
in the successful probe case to verify the complete artifact contract, including
schemaVersion, attempt identifiers, token budgets, exit codes, model, reasoning
content, usage, and serialized parseError for both attempts. Add a
response-failure result through the public serializer boundary and assert its
parseError is retained.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2d45ee97-7707-4c43-b18d-4d66c2d249c4

📥 Commits

Reviewing files that changed from the base of the PR and between 87fcfe4 and 00a84fd.

📒 Files selected for processing (4)
  • test/e2e/live/full-e2e-inference-probe.ts
  • test/e2e/live/full-e2e.test.ts
  • test/e2e/mock-parity.json
  • test/e2e/support/full-e2e-inference-probe.test.ts

Comment thread test/e2e/live/full-e2e.test.ts
Comment thread test/e2e/support/full-e2e-inference-probe.test.ts Outdated
@apurvvkumaria apurvvkumaria self-assigned this Aug 4, 2026
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@senthilr-nv senthilr-nv added chore Build, CI, dependency, or tooling maintenance area: e2e End-to-end tests, nightly failures, or validation infrastructure area: inference Inference routing, serving, model selection, or outputs labels Aug 5, 2026

@senthilr-nv senthilr-nv 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.

Reviewed at d4471a2. Focused probe tests, shared answer assertions, CLI type-checking, and E2E mock/live parity pass. No blocking correctness, security, or product-scope findings.

@senthilr-nv
senthilr-nv enabled auto-merge (squash) August 5, 2026 01:24
@senthilr-nv
senthilr-nv merged commit 15b0c55 into main Aug 5, 2026
129 of 136 checks passed
@senthilr-nv
senthilr-nv deleted the agent/harden-security-posture-model-probe branch August 5, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure area: inference Inference routing, serving, model selection, or outputs chore Build, CI, dependency, or tooling maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants