Skip to content

fix(cli,gateway): strip outer brackets/quotes from /resume args + accept session IDs#31929

Merged
teknium1 merged 3 commits into
mainfrom
fix/resume-strip-brackets
May 25, 2026
Merged

fix(cli,gateway): strip outer brackets/quotes from /resume args + accept session IDs#31929
teknium1 merged 3 commits into
mainfrom
fix/resume-strip-brackets

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

/resume <abc123> now works exactly like /resume abc123 — the angle brackets from the usage hint no longer trip the lookup. The gateway also accepts bare session IDs (it was title-only before).

Two related fixes in one PR:

  1. Strip outer <>, [], "", '' from /resume args before lookup. Applies to BOTH the CLI and the gateway.
  2. Gateway tries get_session(name) first, then falls back to resolve_session_by_title(name). Before this, the gateway could only resume by title, so /resume <session_id> always returned "Session not found" even when the ID was valid.

Changes

  • cli.py — bracket-stripping block in _handle_resume_command, between argument extraction and the empty-target guard.
  • gateway/run.py — bracket-stripping block in _handle_resume_command, plus the session-ID-first lookup branch.
  • tests/cli/test_cli_resume_command.py — bracketed-target resolves, mismatched-bracket passes through verbatim.
  • tests/gateway/test_resume_command.py — bracketed gateway lookup, bare-session-ID resolution.
  • scripts/release.pyAUTHOR_MAP entry mapping claw@openclaw.ai to @wanwan2qq for the attribution check.

Validation

Before After
CLI /resume <abc123> "Session not found" resumes session abc123
Gateway /resume <abc123> "Session not found" resumes session abc123
Gateway /resume <bare_id> (no title) "Session not found" resumes via get_session() fallback
CLI /resume <half (unmatched) passes through verbatim passes through verbatim (unchanged)

Targeted tests: 101/101 passing across tests/cli/test_cli_resume_command.py, tests/cli/test_resume_display.py, tests/cli/test_cli_init.py, tests/gateway/test_resume_command.py.

Salvage notes

Surgical reapply of PR #10215 by @wanwan2qq (commit 28040a80f authored by Claw Assistant <claw@openclaw.ai>). The original branch was based on a many-months-old main and a direct cherry-pick would have reverted 3,153 unrelated files (-812k LOC) including the entire /resume numbered-selection work, the recap wire-up, and the full-title fix that landed just hours ago. The substantive change (~22 LOC of bracket stripping + session-ID lookup) was reapplied by hand onto current main, with the original commit attributed via git commit --author=.

Original PR #10215 will be closed pointing to this one.

Infographic

resume-strip-brackets

https://v3b.fal.media/files/b/0a9b9966/y_UcrmJ7uynVfpyXQm8lo_9jbA5Xab.png

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/resume-strip-brackets vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9136 on HEAD, 9136 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4872 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery labels May 25, 2026
Claw Assistant and others added 3 commits May 25, 2026 01:23
…ept session IDs in gateway

The /resume usage hint shows '<session_id_or_title>' which a few users have
typed verbatim, including the angle brackets. Strip outer <>, [], "", and ''
from the argument before lookup so '/resume <abc123>' works the same as
'/resume abc123'. Mirrors the new bracket-stripping in the CLI handler.

Also let the gateway resolve a bare session ID. Previously the gateway only
called resolve_session_by_title, so '/resume <session_id>' always returned
'Session not found' even for valid IDs. Try get_session() first, fall back
to title resolution second.

Surgical reapply of PR #10215 (branch was based on a many-months-old main
and reverted ~3100 unrelated files; original commit by claw@openclaw.ai
preserved via --author).
- CLI: bracketed/quoted target resolves; mismatched single bracket passes through unchanged.
- Gateway: bracketed session ID resolves; bare untitled session ID resolves via get_session() fallback.
@teknium1 teknium1 force-pushed the fix/resume-strip-brackets branch from 429367d to 3c3ead4 Compare May 25, 2026 08:23
@teknium1 teknium1 merged commit 2e0ac31 into main May 25, 2026
26 checks passed
@teknium1 teknium1 deleted the fix/resume-strip-brackets branch May 25, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants