fix(cli,gateway): strip outer brackets/quotes from /resume args + accept session IDs#31929
Merged
Conversation
Contributor
🔎 Lint report:
|
…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.
429367d to
3c3ead4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
<>,[],"",''from/resumeargs before lookup. Applies to BOTH the CLI and the gateway.get_session(name)first, then falls back toresolve_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.py—AUTHOR_MAPentry mappingclaw@openclaw.aito@wanwan2qqfor the attribution check.Validation
/resume <abc123>abc123/resume <abc123>abc123/resume <bare_id>(no title)get_session()fallback/resume <half(unmatched)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
28040a80fauthored byClaw Assistant <claw@openclaw.ai>). The original branch was based on a many-months-oldmainand a direct cherry-pick would have reverted 3,153 unrelated files (-812k LOC) including the entire/resumenumbered-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 currentmain, with the original commit attributed viagit commit --author=.Original PR #10215 will be closed pointing to this one.
Infographic
https://v3b.fal.media/files/b/0a9b9966/y_UcrmJ7uynVfpyXQm8lo_9jbA5Xab.png