From 63dd66b70561c103c4ddb4e507548aa8a56b26e6 Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:41:05 +0100 Subject: [PATCH 1/6] add debug log --- rasa/utils/endpoints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rasa/utils/endpoints.py b/rasa/utils/endpoints.py index 821cdbffa3e9..1bdd250cad67 100644 --- a/rasa/utils/endpoints.py +++ b/rasa/utils/endpoints.py @@ -149,6 +149,7 @@ async def request( headers.update(kwargs["headers"]) del kwargs["headers"] + logger.debug(f"OSS request headers: {headers}") url = concat_url(self.url, subpath) sslcontext = None From e18b361403031a4b5cd9c5d7c07ede5642dc790d Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:01:37 +0100 Subject: [PATCH 2/6] update headers --- rasa/utils/endpoints.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rasa/utils/endpoints.py b/rasa/utils/endpoints.py index 1bdd250cad67..85ded294de4b 100644 --- a/rasa/utils/endpoints.py +++ b/rasa/utils/endpoints.py @@ -149,6 +149,9 @@ async def request( headers.update(kwargs["headers"]) del kwargs["headers"] + if self.headers: + headers.update(self.headers) + logger.debug(f"OSS request headers: {headers}") url = concat_url(self.url, subpath) From 32b05872370df8a5e76cfc309bf7a8daf81f03ea Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:34:23 +0100 Subject: [PATCH 3/6] make dev release --- .github/workflows/nightly_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly_release.yml b/.github/workflows/nightly_release.yml index c7639d0cbf16..e1cd14c209af 100644 --- a/.github/workflows/nightly_release.yml +++ b/.github/workflows/nightly_release.yml @@ -4,6 +4,7 @@ on: # Runs every weekday at 1am - cron: 0 1 * * 1-5 workflow_dispatch: + pull_request: jobs: From 850b30e6ae94f1654705bd6a27027f9f9f8dcbb5 Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:39:06 +0100 Subject: [PATCH 4/6] fix numpy import error --- rasa/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rasa/plugin.py b/rasa/plugin.py index cdbf5f0230d9..21b265f77a7c 100644 --- a/rasa/plugin.py +++ b/rasa/plugin.py @@ -6,7 +6,6 @@ import pluggy from rasa.cli import SubParsersAction -from rasa.engine.storage.storage import ModelMetadata from rasa.shared.core.trackers import DialogueStateTracker from rasa.shared.nlu.training_data.message import Message @@ -14,6 +13,7 @@ from rasa.core.brokers.broker import EventBroker from rasa.core.tracker_store import TrackerStore from rasa.engine.graph import SchemaNode + from rasa.engine.storage.storage import ModelMetadata from rasa.shared.core.domain import Domain from rasa.utils.endpoints import EndpointConfig @@ -95,7 +95,7 @@ def init_telemetry(endpoints_file: Optional[Text]) -> None: @hookspec # type: ignore[misc] def mock_tracker_for_evaluation( - example: Message, model_metadata: Optional[ModelMetadata] + example: Message, model_metadata: Optional["ModelMetadata"] ) -> Optional[DialogueStateTracker]: """Generate a mocked tracker for NLU evaluation.""" From 61c05effab0882b0fadd267868bdc13c5ff3db79 Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:41:25 +0100 Subject: [PATCH 5/6] fix typing imports --- rasa/plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rasa/plugin.py b/rasa/plugin.py index 21b265f77a7c..b7d5fce5c2aa 100644 --- a/rasa/plugin.py +++ b/rasa/plugin.py @@ -6,8 +6,6 @@ import pluggy from rasa.cli import SubParsersAction -from rasa.shared.core.trackers import DialogueStateTracker -from rasa.shared.nlu.training_data.message import Message if TYPE_CHECKING: from rasa.core.brokers.broker import EventBroker @@ -15,6 +13,8 @@ from rasa.engine.graph import SchemaNode from rasa.engine.storage.storage import ModelMetadata from rasa.shared.core.domain import Domain + from rasa.shared.core.trackers import DialogueStateTracker + from rasa.shared.nlu.training_data.message import Message from rasa.utils.endpoints import EndpointConfig @@ -95,8 +95,8 @@ def init_telemetry(endpoints_file: Optional[Text]) -> None: @hookspec # type: ignore[misc] def mock_tracker_for_evaluation( - example: Message, model_metadata: Optional["ModelMetadata"] -) -> Optional[DialogueStateTracker]: + example: "Message", model_metadata: Optional["ModelMetadata"] +) -> Optional["DialogueStateTracker"]: """Generate a mocked tracker for NLU evaluation.""" From 4beed16f1871bc2386a93f955d09156592412725 Mon Sep 17 00:00:00 2001 From: Anca Lita <27920906+ancalita@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:01:44 +0100 Subject: [PATCH 6/6] add changelog, cleanup --- .github/workflows/nightly_release.yml | 1 - changelog/12904.bugfix.md | 1 + rasa/utils/endpoints.py | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 changelog/12904.bugfix.md diff --git a/.github/workflows/nightly_release.yml b/.github/workflows/nightly_release.yml index e1cd14c209af..c7639d0cbf16 100644 --- a/.github/workflows/nightly_release.yml +++ b/.github/workflows/nightly_release.yml @@ -4,7 +4,6 @@ on: # Runs every weekday at 1am - cron: 0 1 * * 1-5 workflow_dispatch: - pull_request: jobs: diff --git a/changelog/12904.bugfix.md b/changelog/12904.bugfix.md new file mode 100644 index 000000000000..da070b945e51 --- /dev/null +++ b/changelog/12904.bugfix.md @@ -0,0 +1 @@ +Refresh headers used in requests (e.g. action server requests) made by `EndpointConfig` using its `headers` attribute. diff --git a/rasa/utils/endpoints.py b/rasa/utils/endpoints.py index 85ded294de4b..5e1032778e6b 100644 --- a/rasa/utils/endpoints.py +++ b/rasa/utils/endpoints.py @@ -152,7 +152,6 @@ async def request( if self.headers: headers.update(self.headers) - logger.debug(f"OSS request headers: {headers}") url = concat_url(self.url, subpath) sslcontext = None