Skip to content

fix(sessions): hide onboard warm-up session from list and export#5533

Open
rluo8 wants to merge 3 commits into
NVIDIA:mainfrom
rluo8:fix/5511-warmup-cleanup
Open

fix(sessions): hide onboard warm-up session from list and export#5533
rluo8 wants to merge 3 commits into
NVIDIA:mainfrom
rluo8:fix/5511-warmup-cleanup

Conversation

@rluo8

@rluo8 rluo8 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

nemoclaw onboard runs a throwaway scope-upgrade warm-up that persists an internal nemoclaw-onboard-warmup-* session. On a freshly-onboarded sandbox that session is the only entry, so nemoclaw <name> sessions list reported 1 conversation and sessions export bundled a "ping" the user never sent. This filters that internal session out of the NemoClaw user-facing surfaces — sessions list, sessions list --json, and sessions export.

Related Issue

Fixes #5511

Changes

  • src/lib/actions/sandbox/warmup-session.ts (new): single source of truth — WARMUP_SESSION_ID_PREFIX + isWarmupSessionId.
  • src/lib/actions/sandbox/sessions/passthrough.ts: capture sessions list and filter internal warm-up sessions from both human-table output (filterWarmupSessionsListText, anchored on the id: field) and --json (filterWarmupSessionsListJson, tolerant balanced-JSON parse reusing parseSessionIndex; fails closed — errors rather than emitting unfiltered output if it can't parse but a warm-up id is present). stdout is filtered; OpenClaw's stderr is preserved on its own stream.
  • src/lib/actions/sandbox/sessions/export.ts: exclude warm-up sessions from "export all" (explicit --keys still honored); harden parseSessionIndex with balanced-JSON extraction for multi-line payloads.
  • src/lib/adapters/openshell/client.ts + runtime.ts: opt-in includeStreams option exposing separate stdout/stderr on the capture result (additive, backward-compatible).
  • src/lib/actions/sandbox/auto-pair-warmup.ts: reference the shared prefix in --session-id only — no change to warm-up timing/behavior.
  • Tests: passthrough.test.ts (new), client.test.ts (new), and updates to export.test.ts / auto-pair-warmup.test.ts.

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)

Verification

  • [√] PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • [√] Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • [√] Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • [√] Tests added or updated for new or changed behavior
  • [√] No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • 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: rluo8 ruluo@nvidia.com

Summary by CodeRabbit

Release Notes

  • New Features

    • Warm-up sessions are now automatically filtered from session listings and excluded from exports.
  • Bug Fixes

    • Improved parsing of session list output to handle malformed or noisy JSON data.
  • Tests

    • Added comprehensive test coverage for warm-up session filtering and export behavior.

Signed-off-by: Rui Luo <ruluo@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 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: 672e53e8-2cad-4cdc-b3cf-e5a9992e2e02

📥 Commits

Reviewing files that changed from the base of the PR and between a6e664d and 28da5be.

📒 Files selected for processing (10)
  • src/lib/actions/sandbox/auto-pair-warmup.test.ts
  • src/lib/actions/sandbox/auto-pair-warmup.ts
  • src/lib/actions/sandbox/sessions/export.test.ts
  • src/lib/actions/sandbox/sessions/export.ts
  • src/lib/actions/sandbox/sessions/passthrough.test.ts
  • src/lib/actions/sandbox/sessions/passthrough.ts
  • src/lib/actions/sandbox/warmup-session.ts
  • src/lib/adapters/openshell/client.test.ts
  • src/lib/adapters/openshell/client.ts
  • src/lib/adapters/openshell/runtime.ts

📝 Walkthrough

Walkthrough

A new warmup-session.ts module introduces WARMUP_SESSION_ID_PREFIX and isWarmupSessionId(). sessions/export.ts uses these to filter warmup entries during export-all and adds a balanced-JSON scanner for noisy CLI output. sessions/passthrough.ts adds filterWarmupSessionsListJson and filterWarmupSessionsListText and updates runSessionsPassthrough to capture and sanitize sessions list output. The OpenShell capture layer gains an includeStreams option to expose raw stdout/stderr.

Changes

Warmup Session Filtering

Layer / File(s) Summary
Warmup session ID constant and predicate
src/lib/actions/sandbox/warmup-session.ts, src/lib/actions/sandbox/auto-pair-warmup.ts, src/lib/actions/sandbox/auto-pair-warmup.test.ts
New module exports WARMUP_SESSION_ID_PREFIX and isWarmupSessionId(). auto-pair-warmup.ts replaces a hardcoded prefix with the shared constant and exports WARMUP_SCRIPT. Tests add a describe block asserting prefix presence and script content.
OpenShell capture: includeStreams option
src/lib/adapters/openshell/client.ts, src/lib/adapters/openshell/runtime.ts, src/lib/adapters/openshell/client.test.ts
CaptureOpenshellOptions / CaptureOpenshellResult gain includeStreams / stdout / stderr. A rawStreams() helper populates these in sync and async paths. RunnerOptions and all three capture wrappers forward the new option.
Balanced-JSON scanner and export-time warmup exclusion
src/lib/actions/sandbox/sessions/export.ts, src/lib/actions/sandbox/sessions/export.test.ts
balancedJsonCandidates() replaces the old candidate-extraction in parseSessionIndex. The export-all path skips isWarmupSessionId entries. Tests cover noisy JSON tolerance, unknown-wrapper rejection, and warm-up filtering scenarios.
sessions list passthrough warmup filtering
src/lib/actions/sandbox/sessions/passthrough.ts, src/lib/actions/sandbox/sessions/passthrough.test.ts
Exports filterWarmupSessionsListJson and filterWarmupSessionsListText. runSessionsPassthrough captures sessions [list] output, removes warmup entries from JSON/text, fails closed if parsing fails with a leaking prefix, and falls back to direct exec for other verbs. 299-line test suite covers all branches.

Sequence Diagram(s)

sequenceDiagram
  participant User as User CLI
  participant runSessionsPassthrough
  participant captureOpenshell
  participant filterWarmupSessionsListJson
  participant filterWarmupSessionsListText

  User->>runSessionsPassthrough: nemoclaw <name> sessions list [--json]
  runSessionsPassthrough->>captureOpenshell: sandbox exec openclaw sessions list
  captureOpenshell-->>runSessionsPassthrough: { output, stdout, stderr, exitCode }
  alt exitCode != 0
    runSessionsPassthrough-->>User: write stderr, process.exit(exitCode)
  else --json mode
    runSessionsPassthrough->>filterWarmupSessionsListJson: filter(output)
    filterWarmupSessionsListJson-->>runSessionsPassthrough: filtered JSON | null
    alt null and WARMUP_SESSION_ID_PREFIX in raw output
      runSessionsPassthrough-->>User: parse error + process.exit(1)
    else
      runSessionsPassthrough-->>User: write filtered (or raw) JSON
    end
  else text mode
    runSessionsPassthrough->>filterWarmupSessionsListText: filter(output)
    filterWarmupSessionsListText-->>runSessionsPassthrough: text with warmup rows removed
    runSessionsPassthrough-->>User: write filtered text
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5323: Modifies runSandboxScopeWarmupRun and the embedded warmup script in auto-pair-warmup.ts, which this PR also changes to use the shared WARMUP_SESSION_ID_PREFIX constant.

Suggested labels

bug-fix, area: cli, v0.0.66

Suggested reviewers

  • cv

🐇 A warmup ghost crept into the list,
Pretending to be a session it missed!
With a prefix so shared and a predicate keen,
I've filtered the phantom — now nothing's unseen.
No more phantom pings where real chats should gleam! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% 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 summarizes the main change: filtering/hiding onboard warm-up sessions from user-facing surfaces (list and export operations).
Linked Issues check ✅ Passed All primary objectives from #5511 are met: warm-up sessions are hidden from sessions list output, excluded from sessions export, and internal session artifacts are treated as non-user conversations.
Out of Scope Changes check ✅ Passed All changes directly support the linked objective. Infrastructure changes (includeStreams option) are necessary support for filtering implementation and are minimal, focused additions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@rluo8 rluo8 added the v0.0.66 Release target label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.0.66 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ubuntu 24.04][CLI&UX] nemoclaw <name> sessions export includes onboard warmup session — fresh sandbox appears to have 1 conversation instead of 0

2 participants