feat(cli): route sessions delete to hermes sessions delete on Hermes sandboxes, like sessions export/list already do
Problem Statement
nemoclaw
This is inconsistent with its two sibling verbs in the same command group, which already dispatch by agent kind instead of refusing:
sessions list — passthrough.ts reads registry.getSandbox(name)?.agent and runs hermes sessions list in-sandbox for Hermes sandboxes. sessions export — fixed in #5526 (fix(sandbox/sessions): route export by agent kind, closing #5515) for exactly this failure mode: it used to unconditionally invoke OpenClaw's export and abort with exit 127 on Hermes. exportSandboxSessions now reads registry.getSandbox(name)?.agent and, on hermes, runs hermes sessions export in-sandbox and downloads the resulting JSONL instead. delete (and reset) are the only two sessions-admin verbs still hard-refusing instead of routing. There's no technical gap to route around: Hermes ships a real, native hermes sessions delete <session_id> [--yes] command that operates directly on its own SQLite session store and needs no OpenClaw gateway token at all (confirmed via hermes sessions --help / hermes sessions delete --help on a live sandbox). sessions export's Hermes branch already proves the same SQLite-backed session store is reachable this way end-to-end.
Scope note: I'm intentionally not asking to change sessions reset. #7588 keeping reset refused (pointing users at list/export) has a reasonable basis that doesn't obviously apply to delete: there's no Hermes-native command that maps onto OpenClaw's "reset" concept, whereas Hermes already has a same-named, same-shaped native delete.
Desired Behavior
Before:
$ nemoclaw my-hermes sessions delete 20260727_130357_cb2b61 Refusing to invoke 'sessions.delete' for sandbox 'my-hermes': it uses the 'hermes' agent, which does not expose the OpenClaw gateway admin RPCs. These commands only support the OpenClaw agent. List Hermes sessions with: nemoclaw my-hermes sessions list Export a Hermes session with: nemoclaw my-hermes sessions export <keys...> After: the command detects the sandbox's registered agent is hermes and runs hermes sessions delete <session_id> --yes inside the sandbox — the same dispatch-by-agent shape sessions export's Hermes branch already uses — and reports success/failure the way NemoClaw already reports other Hermes passthrough results.
Concrete example: nemoclaw my-hermes sessions list already shows native Hermes session IDs (20260727_130357_cb2b61, 20260727_121145_238595, ...). Today there is no way to act on that list — sessions delete on any of those IDs just refuses. After this change, nemoclaw my-hermes sessions delete 20260727_130357_cb2b61 should actually remove that row from Hermes's session store, the same way sessions export already downloads Hermes's native JSONL instead of refusing.
Constraints and Non-goals
Not asking to change sessions reset — see scope note above. Its current refusal can stay as-is.
Hermes-native session IDs (YYYYMMDD_HHMMSS_hex, e.g. 20260727_130357_cb2b61) are a different namespace from OpenClaw's canonical agent:
Implementation Idea
Non-binding, based on reading the current main source:
deleteSandboxSession in src/lib/actions/sandbox/sessions/delete.ts currently goes straight to OpenClaw key validation and callOpenclawGateway. Mirroring what exportSandboxSessions already does (from #5526): read registry.getSandbox(sandboxName)?.agent first; on "hermes", skip the OpenClaw key validation/canonicalization and instead run hermes sessions delete <session_id> --yes in-sandbox (execSandbox/captureOpenshell — the same primitives passthrough.ts already uses for list), then report success/failure. Non-hermes and legacy-undefined agents keep the existing OpenClaw gateway path unchanged.
Alternatively, passthrough.ts already has a generic, agent-aware dispatcher (runSessionsPassthrough, with a verb parameter and Hermes-specific help-text templating already wired for arbitrary verbs) — only its exported SessionsPassthroughVerb type currently narrows this to "list". Widening that type to include "delete" and routing the CLI's sessions delete handler through it for Hermes sandboxes might need less new code than replicating export.ts's approach from scratch, since the agent-detection and in-sandbox dispatch plumbing is already there.
Category
Feature
Checklist
- [x] I searched existing issues and this is not a duplicate
- [x] I described the problem and desired behavior
✨ Thanks for the detailed report. The reproduction steps and environment are clear. Maintainers will investigate routing sessions delete by agent kind for Hermes sandboxes, consistent with sessions list and export.
Related open PRs:
- #5526 fix(sandbox/sessions): route export by agent kind
- #7588 fix(cli): refuse sessions admin RPCs on non-OpenClaw agents
Related open issues: