Skip to content

The agent that grows with you

fix: preserve REST mutation success response shape

Tekniumc1882a690ef7
diff --git a/hermes_cli/web_server_sessions.py b/hermes_cli/web_server_sessions.py
index 4f7d82631c1..41e729cc32a 100644
--- a/hermes_cli/web_server_sessions.py
+++ b/hermes_cli/web_server_sessions.py
@@ -117,7 +117,8 @@ async def _mutate_session_request(request, profile, session_id, *, request_id,
if expected_generation is not None:
params['expected_generation'] = expected_generation
try:
- return await mutate_session(authority, actor, SessionRef(authority.profile_id, session_id), params)
+ result = await mutate_session(authority, actor, SessionRef(authority.profile_id, session_id), params)
+ return {'ok': True, **result}
except RuntimeStoreError as exc:
status = {'permission_denied': 403, 'profile_mismatch': 403, 'not_found': 404,
'invalid_params': 400, 'runtime_draining': 503}.get(exc.reason, 409)
diff --git a/tests/hermes_cli/test_session_mutation_http.py b/tests/hermes_cli/test_session_mutation_http.py
index e565fbd9d70..a6ffb65f631 100644
--- a/tests/hermes_cli/test_session_mutation_http.py
+++ b/tests/hermes_cli/test_session_mutation_http.py
@@ -60,6 +60,7 @@ async def test_http_and_ws_clients_compete_for_one_revision(tmp_path, monkeypatc
first = await client.patch('/api/sessions/session-fixture?token=fixture-token', json=body, headers={'Authorization': 'Bearer fixture-token'})
assert first.status_code == 200, first.text
assert first.json()['revision'] == 1
+ assert first.json()['ok'] is True
import websockets
async with websockets.connect(f'ws://127.0.0.1:{port}/ws?token=fixture-token') as ws:
await ws.send(json.dumps({'id': 1, 'method': 'session.mutate', 'params': {