diff --git a/plugins/acp/acp_plugin_gamesdk/acp_plugin.py b/plugins/acp/acp_plugin_gamesdk/acp_plugin.py index cfeff39b..a4222696 100644 --- a/plugins/acp/acp_plugin_gamesdk/acp_plugin.py +++ b/plugins/acp/acp_plugin_gamesdk/acp_plugin.py @@ -428,6 +428,10 @@ def _respond_job_executable(self, jobId: int, decision: str, reasoning: str, twe try: state = self.get_acp_state() + # Check if job is cancelled + if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]): + return FunctionResultStatus.FAILED, "Cannot respond - this job has been cancelled", {} + job = next( (c for c in state["jobs"]["active"]["asASeller"] if c["jobId"] == jobId), None @@ -514,6 +518,10 @@ def _pay_job_executable(self, jobId: int, amount: float, reasoning: str, tweetCo try: state = self.get_acp_state() + # Check if job is cancelled + if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]): + return FunctionResultStatus.FAILED, "Cannot pay - this job has been cancelled", {} + job = next( (c for c in state["jobs"]["active"]["asABuyer"] if c["jobId"] == jobId), None @@ -607,6 +615,10 @@ def _deliver_job_executable(self, jobId: int, deliverableType: str, deliverable: try: state = self.get_acp_state() + + # Check if job is cancelled + if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]): + return FunctionResultStatus.FAILED, "Cannot deliver - this job has been cancelled", {} job = next( (c for c in state["jobs"]["active"]["asASeller"] if c["jobId"] == jobId),