The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): adopted legacy sessions keep the profile's toolsets
kshitijk4poord4ab9fc18be5
diff --git a/gateway/session_local_migration.py b/gateway/session_local_migration.pyindex 0f8ab11b025..1a60b41080b 100644--- a/gateway/session_local_migration.py+++ b/gateway/session_local_migration.py@@ -101,7 +101,8 @@ def adopt_legacy_session(authority, actor, row):params, api_mode = legacy_launch_params(row)params['source'] = LEGACY_CREATION_SOURCES.get(row['source'], row['source'])private = {}- policy = build_policy(params, _load_gateway_config(), private_secrets=private)+ # The row's saved folder is no fresh client pick: an adopted session keeps the profile's toolsets.+ policy = build_policy(params, _load_gateway_config(), private_secrets=private, workspace_posture=False)if api_mode:config = json.loads(policy.config_json)config.setdefault('model', {})['api_mode'] = api_modediff --git a/tests/gateway/test_legacy_session_migration.py b/tests/gateway/test_legacy_session_migration.pyindex af9c21e9a7c..0bdc0098fa8 100644--- a/tests/gateway/test_legacy_session_migration.py+++ b/tests/gateway/test_legacy_session_migration.py@@ -17,7 +17,9 @@ async def test_legacy_history_adoption_is_native_owned_atomic_and_retryable(tmp_from hermes_state_runtime import RuntimeStoreErrormonkeypatch.setenv('HERMES_HOME', str(tmp_path))- config = {'platform_toolsets': {'cli': []}}+ # A code folder under focus: the row's saved cwd must not adopt it into the coding posture.+ (tmp_path / 'pyproject.toml').write_text('[project]\nname = "old"\n')+ config = {'platform_toolsets': {'cli': []}, 'agent': {'coding_context': 'focus'}}monkeypatch.setattr(run, '_load_gateway_config', lambda: config)store = SessionStore(tmp_path / 'sessions', GatewayConfig())db = store._db@@ -57,6 +59,7 @@ async def test_legacy_history_adoption_is_native_owned_atomic_and_retryable(tmp_assert db.get_session('old-cli')['parent_session_id'] == original['parent_session_id']policy = runner.adapters[Platform.LOCAL].policies[ref.session_id]assert policy.model == 'old-model' and policy.cwd == str(tmp_path)+ assert not policy.coding_posture and 'coding' not in policy.toolsetsconfig['platform_toolsets']['cli'] = ['terminal']authority.sessions.clear()await authority.attach(native, ref)diff --git a/website/docs/developer-guide/gateway-local-sessions.md b/website/docs/developer-guide/gateway-local-sessions.mdindex 737539d3454..b665c9b2295 100644--- a/website/docs/developer-guide/gateway-local-sessions.md+++ b/website/docs/developer-guide/gateway-local-sessions.md@@ -74,8 +74,9 @@ OpenAI API-to-local session affinity; those remain separate integration paths.the client-surface toolsets (`project`, `desktop_ui`, `catalog`). GUI policy isindependent of `HERMES_DESKTOP` and of the attaching viewer's identity. Without explicit`toolsets`, the gateway applies the coding posture (`agent.coding_context: focus` in a- code workspace, `agent/coding_context.py`) from the session's `cwd` on every interactive- surface; clients never send it as a pick.+ code workspace, `agent/coding_context.py`) from a client-supplied `cwd`, decided once at+ creation; clients never send it as a pick. `source: tool`, Kanban workers and migrated+ legacy rows keep the profile's toolsets.- Optional flat creation fields: `cwd` (existing absolute gateway-local directory),`model` (nonempty model identifier on the daemon's configured provider), and `toolsets`(explicit array of established toolset names, including an empty array). Unknown or