Skip to content

Commit 4e0e7cd

Browse files
committed
Always return prompts of newly activated modes in project activation message
(even if already returned within current session, because clients like Claude Desktop use a single session for everything) Relates to #1370
1 parent f0a3a27 commit 4e0e7cd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/serena/agent.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import requests
2020
import webview
2121
from sensai.util import logging
22+
from sensai.util.helper import mark_used
2223
from sensai.util.logging import LogTime
2324
from sensai.util.string import dict_string
2425

@@ -279,7 +280,17 @@ def get_modes_with_prompts_to_be_provided_for_project_activation(self, session_i
279280
:return: the modes
280281
"""
281282
result = []
282-
if not self._get_session_status(session_id).mode_prompts_provided:
283+
284+
# Note: We always want to provide the prompts of newly activated modes in the activation message
285+
# because some clients (e.g. Claude Desktop) use a single session for all chats.
286+
# Therefore, we view project activation as an "entry action", which must always provide
287+
# all the information that is relevant to the project
288+
# Because of this, we cannot use a condition like this:
289+
# new_mode_prompts_must_be_provided_for_activation = not self._get_session_status(session_id).mode_prompts_provided
290+
new_mode_prompts_must_be_provided_for_activation = True
291+
mark_used(session_id)
292+
293+
if new_mode_prompts_must_be_provided_for_activation:
283294
for mode_name in self._newly_activated_mode_names:
284295
mode = ActiveModes.get_mode_instance(mode_name)
285296
if mode.has_prompt():

0 commit comments

Comments
 (0)