From d9deb23d5400ff7b76fe6677f11a89eb402aa277 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:53:19 +0000 Subject: [PATCH 1/4] Initial plan From 67532726b3023fc1712b425203e71628477a4725 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:55:43 +0000 Subject: [PATCH 2/4] fix: add isinstance check in json_should_be_valid to prevent AttributeError Co-authored-by: Michspirit99 <11279621+Michspirit99@users.noreply.github.com> --- samples/robot_copilot_library.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/robot_copilot_library.py b/samples/robot_copilot_library.py index d9e8a6d..21720f3 100644 --- a/samples/robot_copilot_library.py +++ b/samples/robot_copilot_library.py @@ -195,11 +195,17 @@ def json_should_be_valid(self) -> dict: """Assert that the last response is valid JSON and return the parsed dict.""" try: data = json.loads(self._last_response) - return data except json.JSONDecodeError as e: raise AssertionError( f"Invalid JSON: {e}\n\nRaw:\n{self._last_response[:300]}" ) + + if not isinstance(data, dict): + raise AssertionError( + f"Expected JSON object (dict), but got {type(data).__name__}.\n" + f"Value: {str(data)[:200]}" + ) + return data def json_should_have_keys(self, *keys): """Assert that the parsed JSON contains all specified keys. @@ -208,6 +214,7 @@ def json_should_have_keys(self, *keys): JSON Should Have Keys name age email """ data = self.json_should_be_valid() + # json_should_be_valid() already asserts isinstance(data, dict) missing = set(keys) - set(data.keys()) if missing: raise AssertionError( From fda9df4ccc4604e584c70fbec5d500fd32b6f274 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:56:17 +0000 Subject: [PATCH 3/4] style: remove extra blank line for consistent spacing Co-authored-by: Michspirit99 <11279621+Michspirit99@users.noreply.github.com> --- samples/robot_copilot_library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/robot_copilot_library.py b/samples/robot_copilot_library.py index 21720f3..e3e7178 100644 --- a/samples/robot_copilot_library.py +++ b/samples/robot_copilot_library.py @@ -199,7 +199,7 @@ def json_should_be_valid(self) -> dict: raise AssertionError( f"Invalid JSON: {e}\n\nRaw:\n{self._last_response[:300]}" ) - + if not isinstance(data, dict): raise AssertionError( f"Expected JSON object (dict), but got {type(data).__name__}.\n" From 144b2abca94781ff9070e173729721e0583f3005 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:56:46 +0000 Subject: [PATCH 4/4] style: use consistent 300-char truncation in error messages Co-authored-by: Michspirit99 <11279621+Michspirit99@users.noreply.github.com> --- samples/robot_copilot_library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/robot_copilot_library.py b/samples/robot_copilot_library.py index e3e7178..74309c3 100644 --- a/samples/robot_copilot_library.py +++ b/samples/robot_copilot_library.py @@ -203,7 +203,7 @@ def json_should_be_valid(self) -> dict: if not isinstance(data, dict): raise AssertionError( f"Expected JSON object (dict), but got {type(data).__name__}.\n" - f"Value: {str(data)[:200]}" + f"Value: {str(data)[:300]}" ) return data