Load previous conversation by id (CLI) (#10156)

This commit is contained in:
Engel Nyst
2025-08-07 23:09:20 +02:00
committed by GitHub
parent 11d12c5a01
commit 73a7c7786d
4 changed files with 15 additions and 2 deletions

View File

@@ -129,12 +129,13 @@ async def run_session(
conversation_instructions: str | None = None,
session_name: str | None = None,
skip_banner: bool = False,
conversation_id: str | None = None,
) -> bool:
reload_microagents = False
new_session_requested = False
exit_reason = ExitReason.INTENTIONAL
sid = generate_sid(config, session_name)
sid = conversation_id or generate_sid(config, session_name)
is_loaded = asyncio.Event()
is_paused = asyncio.Event() # Event to track agent pause requests
always_confirm_mode = False # Flag to enable always confirm mode
@@ -705,6 +706,7 @@ After reviewing the file, please ask the user what they would like to do with it
task_str,
session_name=args.name,
skip_banner=banner_shown,
conversation_id=args.conversation,
)
# If a new session was requested, run it

View File

@@ -770,6 +770,12 @@ def get_parser() -> argparse.ArgumentParser:
type=str,
default='',
)
parser.add_argument(
'--conversation',
help='The conversation id to continue',
type=str,
default=None,
)
parser.add_argument(
'--eval-ids',
default=None,

View File

@@ -139,13 +139,14 @@ def test_help_message(capsys):
'--selected-repo SELECTED_REPO',
'--override-cli-mode OVERRIDE_CLI_MODE',
'--log-level LOG_LEVEL',
'--conversation CONVERSATION',
]
for element in expected_elements:
assert element in help_output, f"Expected '{element}' to be in the help message"
option_count = help_output.count(' -')
assert option_count == 21, f'Expected 21 options, found {option_count}'
assert option_count == 22, f'Expected 22 options, found {option_count}'
def test_selected_repo_format():

View File

@@ -359,6 +359,7 @@ async def test_main_without_task(
mock_args.llm_config = None
mock_args.name = None
mock_args.file = None
mock_args.conversation = None
mock_parse_args.return_value = mock_args
# Mock config
@@ -412,6 +413,7 @@ async def test_main_without_task(
None,
session_name=None,
skip_banner=False,
conversation_id=None,
)
@@ -553,6 +555,7 @@ async def test_main_with_session_name_passes_name_to_run_session(
mock_args.llm_config = None
mock_args.name = test_session_name # Set the session name
mock_args.file = None
mock_args.conversation = None
mock_parse_args.return_value = mock_args
# Mock config
@@ -606,6 +609,7 @@ async def test_main_with_session_name_passes_name_to_run_session(
None,
session_name=test_session_name,
skip_banner=False,
conversation_id=None,
)