Skip to content

fix(cloudflare): fetch tunnel connections from dedicated endpoint after API removal - #8623

Closed
The-AarushiSingh wants to merge 4 commits into
simstudioai:mainfrom
The-AarushiSingh:fix/cloudflare-tunnel-connections
Closed

The-AarushiSingh wants to merge 4 commits into
simstudioai:mainfrom
The-AarushiSingh:fix/cloudflare-tunnel-connections

Conversation

@The-AarushiSingh

Copy link
Copy Markdown

fixes #8616

Cloudflare removed the connections array from cfd_tunnel get/list responses (EOL 2026-10-05).

  • get_tunnel: secondary GET .../cfd_tunnel/{id}/connections and flatMap connector.conns
  • list_tunnels: stop promising connections (always null) to avoid N+1 and stay honest

icecrasher321 and others added 4 commits October 5, 2026 00:52
…he-top-options-compare (simstudioai#8612)

* docs(library): update agentic-ai-coding-tools-what-they-are-and-how-the-top-options-compare

* Pi Babysit: address PR simstudioai#8612 feedback

---------

Co-authored-by: Sim Pi Agent <pi@sim.ai>
…imstudioai#8613)

* feat(library): How do you build an AI bot for Discord without code?

* Pi Babysit: address PR simstudioai#8613 feedback

---------

Co-authored-by: Sim Pi Agent <pi@sim.ai>
…ead of extra E2B round trips (simstudioai#8621)

* perf(sandbox): grant the run_code session lease in the reconnect instead of extra E2B round trips

Reused Mothership workbench calls made five E2B control-plane requests:
list, connect, getInfo + setTimeout on acquire (the set always fired), and
getInfo on release. Connect now asks for max(5 min, remaining, lease), the
handle records the deadline it requested, and acquisition/release skip the
provider while that lower bound covers the request. Final deadlines are
unchanged; unrequested deadlines are still read back.

* test(sandbox): model connect as setting the deadline so a dropped preserve is caught
@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@The-AarushiSingh is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Updates sandbox session lifetime tracking and Cloudflare tunnel API calls.

The PR should not merge until the new Cloudflare connections request respects workflow cancellation.

Findings

  1. P1 Connections request ignores cancellation ▶
  2. P2 Connection failures are hidden ▶
  3. P2 Deduplication storage is unspecified ▶
  4. P2 Connection parsing lacks tests ▶

Summary

The PR moves single-tunnel connection retrieval to Cloudflare's dedicated endpoint and makes list results report no connection data. It also optimizes E2B session leases and adds substantial library content. The new connections request needs cancellation and failure visibility; the Discord polling guide needs an explicit durable deduplication step.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Get tunnel] --> B[Cloudflare tunnel endpoint]
  B --> C[Dedicated connections endpoint]
  C --> D[Flatten connector conns]
  D --> E[Tunnel output]
Loading

Reviews (1) · Last reviewed commit: "fix(cloudflare): fetch tunnel connection..."

Comment on lines +70 to +73
const connectionsRes = await fetch(connectionsUrl, {
method: 'GET',
headers: cloudflareHeaders(params.apiKey),
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Connections request ignores cancellation

If a workflow is cancelled or its deadline expires while Cloudflare's connections request is pending, this new fetch has neither the execution signal nor a timeout. Unlike the initial tunnel request, it can keep cloudflare_get_tunnel pending after cancellation. Pass the signal supplied to transformResponse and bound the request.

Comment on lines +74 to +82
const connectionsData = await connectionsRes.json()
if (connectionsData?.success && Array.isArray(connectionsData.result)) {
connections = connectionsData.result.flatMap(
(connector: { conns?: unknown[] }) => connector.conns ?? []
)
}
} catch {
connections = null
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Connection failures are hidden

If Cloudflare rejects the connections request or it fails, the tool still reports success with connections: null and provides no reason. That makes a permissions or API failure hard to distinguish from unavailable connection data. Preserve a warning or error for the secondary lookup so users can diagnose it.

Comment on lines +165 to +170
4. Filter out bot-authored messages, empty requests, disallowed users, and message IDs that have already been processed.
5. Add the model step and write a system instruction defining the bot's role, boundaries, tone, and escalation policy.
6. Add approved context or retrieval when the bot must answer from private or specialized information.
7. Add safety and routing checks after generation.
8. Add the Discord Send Message action and map the answer to the approved channel or thread.
9. Record the source message ID only after the response path reaches its intended result, with a recovery policy for failures.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Deduplication storage is unspecified

These steps require processed message IDs to survive between scheduled runs, but the guide does not say where to store them. Sim's Variables block lasts only for one execution, while each poll retrieves recent messages again. Readers following the steps with workflow variables could therefore send repeated replies to the same message. Specify a durable store and how to read and update it.

Comment on lines +75 to +78
if (connectionsData?.success && Array.isArray(connectionsData.result)) {
connections = connectionsData.result.flatMap(
(connector: { conns?: unknown[] }) => connector.conns ?? []
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Connection parsing lacks tests

The new flattening of connector responses has no regression test, and the existing Cloudflare tests cover block parameter defaults rather than this response. A response-shape mistake or silently empty connections result could go unnoticed. Add focused tests for successful connector data and a failed secondary request.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@The-AarushiSingh

Copy link
Copy Markdown
Author

Superseded by #8624, retargeted to staging with only the Cloudflare fix.

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.

[BUG] Cloudflare get_tunnel / list_tunnels always return connections: null since 2026-10-05

3 participants