Skip to content

updated tunnel api responses#479

Open
kcoopermiller wants to merge 2 commits intomainfrom
feature/tunnelapi
Open

updated tunnel api responses#479
kcoopermiller wants to merge 2 commits intomainfrom
feature/tunnelapi

Conversation

@kcoopermiller
Copy link
Copy Markdown
Member

@kcoopermiller kcoopermiller commented Mar 27, 2026

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 TunnelClient to match updated Tunnel API responses by reading tunnel payloads from a top-level data field in create_tunnel, get_tunnel, list_tunnels, and bulk_delete_tunnels.

Updates the CLI tunnel list status rendering by dropping special formatting for the DISCONNECTED state.

Written by Cursor Bugbot for commit 092876c. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

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"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

data = await self._handle_response(response, "list tunnels")
tunnels = []
for t in data.get("tunnels", []):
for t in data["data"]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant