The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): /memory with a quote in its argument is classified, not an internal error
unsupportedpastelsf2fe6f5ef30f
diff --git a/gateway/session_commands.py b/gateway/session_commands.pyindex 6bcb2323be6..bf5dd885037 100644--- a/gateway/session_commands.py+++ b/gateway/session_commands.py@@ -60,13 +60,20 @@ def _first_token(arg):return ''+def _first_word(arg):+ """The first whitespace-separated word, as main's CLI and messaging /memory handler split it:+ a quote later in the line belongs to the argument (`/memory pending it's`)."""+ words = arg.split(None, 1)+ return words[0].lower() if words else ''++# The read-only argument forms of a read command whose other subcommands write: ``/usage reset``# redeems a credit, ``/suggestions accept|catalog`` schedules cron jobs delivering to this# (non-messaging) chat. The review queues read like main's CLI: only the first word counts._READ_ARGUMENTS = {'skills': lambda arg: _first_token(arg) in {'', 'pending', 'diff'},'usage': lambda arg: not arg.strip(),- 'memory': lambda arg: _first_token(arg) in {'', 'pending'},+ 'memory': lambda arg: _first_word(arg) in {'', 'pending'},'suggestions': lambda arg: not arg.strip(),'kanban': lambda arg: _first_token(arg) in _KANBAN_READS,}@@ -77,7 +84,7 @@ _READ_ARGUMENTS = {# `approval` updates their config.yaml switch, as main's CLI wrote it)._CONTROL_ARGUMENTS = {'skills': lambda arg: _first_token(arg) in {'approve', 'apply', 'reject', 'deny', 'drop', 'approval', 'mode'},- 'memory': lambda arg: _first_token(arg) in {'approve', 'apply', 'reject', 'deny', 'drop', 'approval', 'mode'},+ 'memory': lambda arg: _first_word(arg) in {'approve', 'apply', 'reject', 'deny', 'drop', 'approval', 'mode'},}diff --git a/tests/gateway/test_session_memory_review.py b/tests/gateway/test_session_memory_review.pyindex ed1b823dae4..a39a4586d5e 100644--- a/tests/gateway/test_session_memory_review.py+++ b/tests/gateway/test_session_memory_review.py@@ -42,6 +42,15 @@ def test_memory_has_no_diff_like_the_cli(tmp_path, monkeypatch):assert command_verdict('memory', 'diff x') == 'refused'[email protected](('arg', 'reach'), [+ ("pending it's", 'read'), ('pending "unclosed', 'read'), ("approve it's", 'control'),+ ("drop 'all", 'control'), ("approval on'", 'control'), ("it's pending", 'refused')])+def test_memory_reads_only_its_first_word_like_the_cli(arg, reach):+ """Main's CLI and messaging handler split /memory on whitespace: an apostrophe or an unclosed+ quote later in the line is the argument's business, never a parse failure of the command."""+ from gateway.session_commands import command_verdict+ assert command_verdict('memory', arg) == reach+def _stage(home, pending_id, content):folder = home / 'pending' / 'memory'folder.mkdir(parents=True, exist_ok=True)