From 9685ba4254b1cade839967620b8e58c57fc54911 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 15:11:41 +0000 Subject: [PATCH 1/2] Initial plan From d5d90a37521f76f81c093887a14dba5ad1077afc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 15:17:08 +0000 Subject: [PATCH 2/2] fix: resolve A001 linter errors and remove suppression from pyproject.toml Agent-Logs-Url: https://github.com/GitHubSecurityLab/seclab-taskflow-agent/sessions/fcbe7b59-b518-4185-a679-b6cf70c6a3bb Co-authored-by: kevinbackhouse <4358136+kevinbackhouse@users.noreply.github.com> --- pyproject.toml | 1 - .../mcp_servers/codeql/jsonrpyc/__init__.py | 33 +++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f6de0e4..95185e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,7 +177,6 @@ ignore = [ "TRY003", # Raise with inline message strings # Backwards-compatibility suppressions for existing code - "A001", # Variable shadows built-in "A002", # Argument shadows built-in "A004", # Import shadows built-in "FBT001", # Boolean positional arg diff --git a/src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/__init__.py b/src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/__init__.py index 8d14d96..0cd3e51 100644 --- a/src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/__init__.py +++ b/src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/__init__.py @@ -148,9 +148,8 @@ def request( # add the id when given if id is not None: # encode string ids - if isinstance(id, str): - id = json.dumps(id) - req += f',"id":{id}' + encoded_id = json.dumps(id) if isinstance(id, str) else id + req += f',"id":{encoded_id}' # add parameters when given if params is not None: @@ -182,12 +181,11 @@ def response(cls, id: str | int | None, result: Any, /) -> str: raise RPCInvalidRequest(str(e)) # encode string ids - if isinstance(id, str): - id = json.dumps(id) + encoded_id = json.dumps(id) if isinstance(id, str) else id # build the response string try: - res = f'{{"jsonrpc":"2.0","id":{id},"result":{json.dumps(result)}}}' + res = f'{{"jsonrpc":"2.0","id":{encoded_id},"result":{json.dumps(result)}}}' except Exception as e: raise RPCParseError(str(e)) @@ -233,11 +231,10 @@ def error( err_data += "}" # encode string ids - if isinstance(id, str): - id = json.dumps(id) + encoded_id = json.dumps(id) if isinstance(id, str) else id # start building the error string - err = f'{{"jsonrpc":"2.0","id":{id},"error":{err_data}}}' + err = f'{{"jsonrpc":"2.0","id":{encoded_id},"error":{err_data}}}' return err @@ -426,22 +423,22 @@ def call( is_notification = callback is None and block <= 0 # create a new id for requests expecting a response - id = -1 + req_id = -1 if not is_notification: self._i += 1 - id = self._i + req_id = self._i # register the callback if callback is not None: - self._callbacks[id] = callback + self._callbacks[req_id] = callback # store an empty result for the meantime if block > 0: - self._results[id] = self.EMPTY_RESULT + self._results[req_id] = self.EMPTY_RESULT # create the request params = params if params else {"args": args, "kwargs": kwargs} - req = Spec.request(method, id=id, params=params) + req = Spec.request(method, id=req_id, params=params) print(f"-> {req}") msg = f"Content-Length: {len(req)}\r\n\r\n{req}" self._write(msg) @@ -449,9 +446,9 @@ def call( # blocking return value behavior if block > 0: while True: - if self._results[id] != self.EMPTY_RESULT: - result = self._results[id] - del self._results[id] + if self._results[req_id] != self.EMPTY_RESULT: + result = self._results[req_id] + del self._results[req_id] if isinstance(result, Exception): raise result return result @@ -462,7 +459,7 @@ def call( raise TimeoutError("RPC Request timed out") time.sleep(block) - return id + return req_id def _handle(self, msg: str) -> None: """