Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| return await self._handle_response(response, "bulk delete tunnels") | ||
| data = await self._handle_response(response, "bulk delete tunnels") | ||
| return data["data"] |
There was a problem hiding this comment.
KeyError crash on 204 response in bulk delete
High Severity
bulk_delete_tunnels now accesses data["data"], but _handle_response returns {} for 204 responses (common for DELETE operations) and 404 responses. This will raise a KeyError at runtime. The previous code returned the full data dict directly, which avoided this crash. Other methods like delete_tunnel and get_tunnel handle 404 explicitly before calling _handle_response, but bulk_delete_tunnels does not, and also doesn't guard against 204.
| data = await self._handle_response(response, "list tunnels") | ||
| tunnels = [] | ||
| for t in data.get("tunnels", []): | ||
| for t in data["data"]: |
There was a problem hiding this comment.
KeyError crash on 404 response in list tunnels
Medium Severity
list_tunnels replaced the defensive data.get("tunnels", []) with data["data"], which will raise a KeyError if _handle_response returns {} (as it does for 404 responses). The old code gracefully returned an empty list in this edge case; the new code crashes. Unlike get_tunnel, there is no pre-check for 404 status before accessing the response data.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50037eadb5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| data = await self._handle_response(response, "list tunnels") | ||
| tunnels = [] | ||
| for t in data.get("tunnels", []): | ||
| for t in data["data"]: |
There was a problem hiding this comment.
Iterate nested tunnels list in wrapped response
This loop now assumes data["data"] is a list, but the list endpoint previously returned an object with a tunnels field and this commit otherwise applies a generic {"data": ...} wrapper transformation. In that wrapped shape ({"data": {"tunnels": [...]}}), iterating data["data"] yields dict keys, so the subsequent t["tunnel_id"] access fails and list_tunnels/prime tunnel list breaks at runtime. The iteration should read the nested tunnels array from inside data["data"].
Useful? React with 👍 / 👎.


Note
Medium Risk
Updates the tunnel client to expect a new response shape, so mismatches with the backend could break create/status/list/delete flows. Changes are localized to API response parsing and CLI rendering, with no auth or data model redesign.
Overview
Adjusts
TunnelClientto match updated Tunnel API responses by reading tunnel payloads from a top-leveldatafield increate_tunnel,get_tunnel,list_tunnels, andbulk_delete_tunnels.Updates the CLI
tunnel liststatus rendering by dropping special formatting for theDISCONNECTEDstate.Written by Cursor Bugbot for commit 092876c. This will update automatically on new commits. Configure here.