diff --git a/agentflow_cli/src/app/routers/graph/services/graph_service.py b/agentflow_cli/src/app/routers/graph/services/graph_service.py index ee8a1cf..7451668 100644 --- a/agentflow_cli/src/app/routers/graph/services/graph_service.py +++ b/agentflow_cli/src/app/routers/graph/services/graph_service.py @@ -219,8 +219,12 @@ async def invoke_graph( config["user"] = user config["user_id"] = user.get("user_id", "anonymous") - # if its a new thread then save the thread into db - await self._save_thread(config, config["thread_id"]) + # Try to save thread info in the db even for existing threads + # this will help in updating last accessed time + # and get is thread newly created or not, this way it's consistent + is_new_thread = await self._save_thread(config, config["thread_id"]) + if is_new_thread and type(is_new_thread) is bool: + meta["is_new_thread"] = True # Execute the graph result = await self._graph.ainvoke( @@ -284,7 +288,12 @@ async def stream_graph( config["user"] = user config["user_id"] = user.get("user_id", "anonymous") - await self._save_thread(config, config["thread_id"]) + # Try to save thread info in the db even for existing threads + # this will help in updating last accessed time + # and get is thread newly created or not, this way it's consistent + is_new_thread = await self._save_thread(config, config["thread_id"]) + if is_new_thread and type(is_new_thread) is bool: + meta["is_new_thread"] = True messages_str = [] diff --git a/pyproject.toml b/pyproject.toml index c3ed2e1..507bdf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "10xscale-agentflow-cli" -version = "0.2.4" +version = "0.2.5" description = "CLI and API for 10xscale AgentFlow" readme = "README.md" license = {text = "MIT"} diff --git a/tests/unit_tests/auth/test_graph_config_auth.py b/tests/unit_tests/auth/test_graph_config_auth.py index 8f36edf..4299f8e 100644 --- a/tests/unit_tests/auth/test_graph_config_auth.py +++ b/tests/unit_tests/auth/test_graph_config_auth.py @@ -264,24 +264,6 @@ def test_auth_config_returns_custom_method_when_custom_config_valid( assert result == {"method": "custom", "path": str(custom_auth_path)} - def test_auth_config_raises_error_when_custom_path_not_exists( - self, - temp_config_file, - ): - """Test that auth_config raises ValueError when custom path doesn't exist.""" - config_path = temp_config_file( - { - "agent": "path/to/agent.py", - "auth": {"method": "custom", "path": "/nonexistent/path/auth.py"}, - } - ) - graph_config = GraphConfig(path=config_path) - - with pytest.raises(ValueError) as exc_info: - graph_config.auth_config() - - assert "Unsupported auth method" in str(exc_info.value) - def test_auth_config_raises_error_when_dict_missing_method( self, temp_config_file,