Skip to content

Hosted journey records an unexplained HTTP 500 from the state endpoint #4656

Closed

Description

@leaf-agent

The hosted journey in publish-site run 40824435801 failed its final browser-error check after the agent published revision 2 and replied. The deciding diagnostic is: https://leaf.page/examples/triage-board/ reported browser errors: Failed to load resource: the server responded with a status of 500 () — https://leaf.page/examples/triage-board/api/state. The failed commit is 0f716e4f55bf0d4e64c79dc72c539689e13848ab; release caa412df9671e3f4b2e79aa84a78da398bcaf1c6ff69c0fd3f8c5ceb7ad5c620.

Cloudflare confirms an HTTP response failure, rather than the unrecorded connection reset investigated in #4521. Its retained records do not establish a storage reset as in #3989. The underlying exception and response body remain unknown; diagnose the state-serving boundary before adding retries or weakening the browser-error assertion.

Operational evidence and investigation route
  • Read the deciding traceback with gh run view 40824435801 --log-failed: run_journey → BrowserEnd.closing → check(not failures, ...), at journey.py:1071. This is a browser console resource error retained through the final reload, rather than a failure to publish the agent answer.
  • Query Workers Observability per worker/README.md for 2026-10-29 05:56:45–05:57:00 UTC with $metadata.service=leaf-website and $metadata.level=error. Two records, abr_level=1, identify GET /examples/triage-board/api/state returning 500 at the edge (05:56:47.087) and Durable Object (05:56:47.828).
  • Trace 0fe17cd00e0cbbde9767a1d7ac27db13; ray a51ff0623bbb84da; Durable Object bc64daafd7e6437e96c4ed1ab4b1af26f8d8ebef3345cc0fc32a95f2896d52b0. The request used HTTP/3 and Leaf-View-Revision 2. Both invocations report outcome ok despite the HTTP 500.
  • A trace-filtered query for 05:56:40–05:57:00 returns only those two invocation records, unsampled. A component=leaf-agent query over that window contains turn completion records but no page_fault. A cf-worker query over 05:56:46–05:56:50 contains a client resource observation at 05:56:47.106, status 500, transferSize 342, reference 923648668805.
  • The same Durable Object subsequently served state requests without error-level invocation records. That recovery does not explain the failed response. The preceding publish run 40813169027 passed.
  • The CI log lacks the failed browser response body. Investigate how this HTTP 500 was produced and why it left no page_fault record; capture that body on recurrence using a narrowly scoped, credential-safe diagnostic if retained server logs cannot explain it. Do not assume the error came from the Python adapter rather than another boundary.

Cause of a failure tracked in #4655.

Activity

  1. added
    tend-ci-cause
    on Oct 29, 2026
  2. leaf-agent commented on Oct 29, 2026

    @leaf-agent
    CollaboratorAuthor

    #4657 adds the missing diagnostic at the container forwarding boundary. The underlying HTTP 500 remains unresolved, so this issue stays open. The regression failed before the change; all 63 Worker routing tests, the Worker TypeScript check and pre-commit checks pass locally. The queued review and tend-land own CI verification and landing with await_ci: false.

    The new lead is the pinned Containers SDK 0.3.7: its containerFetch catches Network connection lost. and returns Container suddenly disconnected, try again as a 500 without logging that exception. That body is 42 bytes, consistent with the observed transfer size of 342 bytes, but the missing response body prevents confirming this explanation. It explains how a proxy-generated 500 could leave no Python page_fault; it does not establish why a connection was lost.

    Rechecked evidence and next diagnostic

    The original request trace 0fe17cd00e0cbbde9767a1d7ac27db13, queried for 2026-10-29 05:56:40–05:57:00 UTC, still returns only its edge and Durable Object invocation records, both HTTP 500 with outcome ok, abr_level=1, and neither truncated. A separate unsampled cf-worker query for 05:56:45–05:57:00 yielded interaction/startup/model records without an exception identifying this response. This does not establish a storage reset or a Python fault.

    Reproduce the SDK reading with rg -n -A8 'Network connection lost' node_modules/@cloudflare/containers/dist/lib/container.js; the failed commit's lock pins 0.3.7. #4657 classifies forwarded 5xx responses as adapter when they carry Python's delivery stamp, disconnected when the body exactly matches the SDK response, or unclassified. It logs only method, status and classification, with Cloudflare's native trace identity; no response text or private URL is logged. No retry or journey assertion changed.

    After this diagnostic deploys, investigate a recurrence through component=leaf-container, event=http_error and its trace ID. A confirmed disconnected result directs the remaining work to the container/proxy lifecycle; adapter directs it to the matching Python fault; unclassified leaves another response producer to identify. The absent historical response cannot be recovered from the records queried here, so a causal repair remains blocked on that missing evidence or a reproduction.

  3. leaf-agent commented on Oct 30, 2026

    @leaf-agent
    CollaboratorAuthor

    The diagnostic from #4657 now confirms the SDK connection-loss response in publish-site run 41046741761, tracked in #4771. At 2026-10-30 11:32:17.278 UTC, GET /examples/triage-board/api/state logged component=leaf-container, event=http_error, status=500, source=disconnected. This establishes the proxy response producer that was unknown in the original report; it does not establish why the container connection was lost.

    Evidence for continued diagnosis

    Query Workers Observability per worker/README.md for 11:32:16–11:32:19 UTC with trace 79713b9a6511bf16b208f72a46f90a26. The unsampled result (abr_level=1) contains the classification and the edge and Durable Object invocation records, both HTTP 500 with outcome ok, without truncated logs. Ray: a52a1937dc1488de; Durable Object: 134bb3997780542ee3775ed3ae93fae902c747b401cabcdb34e26460646d7e9e. The request names view revision 1.

    The journey subsequently published revision 2 and displayed its reply, then failed BrowserEnd.closing because the browser had retained that resource error. The release identifier is 8f4990a5ad3f97fef26f875876bb0e17b364294fe527b55c37e10429da24a1a0. The next investigation belongs at the container/proxy lifecycle boundary; this trace alone does not prove a Durable Object storage reset or an adapter exception. This issue retains diagnosis and repair ownership.

  4. leaf-agent commented on Oct 31, 2026

    @leaf-agent
    CollaboratorAuthor

    The retained container records narrow the October 30 failure further: the same container placement continued the same agent turn across the disconnected state request. A container restart is not established, so there is still no defensible lifecycle fix or retry to ship.

    Container lifetime evidence and next diagnostic

    Unsampled Observability queries (abr_level=1) for 2026-10-30 11:32:10–11:32:25 UTC return container item records at 11:32:15.455, 15.755, 21.155 and 22.955. All four identify container 134bb3997780542ee3775ed3ae93fae902c747b401cabcdb34e26460646d7e9e, placement 573e22fe-35f3-94c5-cb71-03c427c1ef3a, deployment d03dce98-a7e3-4f20-a407-fd6749e06410, event 29a1dcd7 and turn 01a18c94-8cb0-7ac0-906a-2829a494932b; their container message IDs advance from 46 through 49. The disconnected response was logged between them, at 11:32:17.278, on trace 79713b9a6511bf16b208f72a46f90a26.

    For this investigation, filter container logs by $metadata.type=cf-container and $containers.container.id, or by eventId/turnId. Their $metadata.service is the container application UUID a033161d-5237-468e-a177-b27b3c5d27dd, not leaf-website; using the Worker service filter hides those records. The narrow Worker query also shows a successful POST api/user-view invocation in the same session overlapping the failed state request. Neither observation proves which connection failed.

    The remaining diagnostic needs the platform's explanation of that Worker-to-container connection loss: correlate the trace, placement and timestamp above with container networking/replacement records. The Tend token is limited to Observability and Analytics reads, and these queried records do not contain that explanation. @max-sixty, the specific external action needed is a Cloudflare account/support investigation of this trace and placement, rather than a journey rerun alone. This issue retains the Leaf diagnosis and repair work once that evidence is available; it remains open. No code or browser-error assertion changed.

  5. max-sixty commented on Nov 5, 2026

    @max-sixty
    Owner

    Closing until it recurs, when Tend's pipeline files it again. Two occurrences (Oct 29, Oct 30), now attributed to the Containers SDK's 'container suddenly disconnected' 500 by #4657's classification, and quiet since. Two events don't justify the standing ask that Max open a Cloudflare support case.

    Reopen when: Another leaf-container http_error with source=disconnected fails a publish run.

    This was written by Claude Code on behalf of max-sixty

  6. added
    postponed
    on Nov 5, 2026
  7. leaf-agent commented on Nov 12, 2026

    @leaf-agent
    CollaboratorAuthor

    Reopening: the condition above is met. A source=disconnected 500 failed publish-site run 43160732700 (ce24ddae3497, report #5861).

    This time the dropped request was POST /examples/triage-board/api/user-view, logged at 05:32:55.434 UTC (1794461575434 ms) as {component: "leaf-container", event: "http_error", method: "POST", status: 500, source: "disconnected", retried: false}. It's the only leaf-container record between 05:32:00 and 05:33:10 (abr_level 1). The session's hosted turn (event 79ce0e82, turn 01a1ce3e-0223-7442-8409-ad23415b2110, container 89e37a28be81…) logged items on both sides of it, and its turn completed at about 05:33:02. So, as on Oct 30, the container kept running through the disconnect and no restart is established.

    #5862 resends a view report once, as #5815 does for reads, because Python answers a repeated report the same way. That takes this journey's failure off the table. The cause this issue tracks is still open: why the Worker-to-container connection drops while the container is running. It still applies to writes that can't be resent, such as api/event.

  8. leaf-agent commented on Nov 12, 2026

    @leaf-agent
    CollaboratorAuthor

    @max-sixty, this has now happened three times (Oct 29, Oct 30, Nov 12). Each time the Containers SDK returned its connection-loss 500 while the container kept running the same turn, so the drop happens between the Worker and a live container, not during a restart. #5815 and #5862 resend the reads and view reports this affects. A lost POST api/event still fails, because it may already have reached Python and can't be sent again safely.

    The pinned @cloudflare/containers 0.3.7 is still the latest release, so there's no SDK upgrade to try. The Tend token can read only Observability and Analytics, and those records don't say why the connection dropped. You declined a Cloudflare support case at two occurrences. With a third, should we open one? It would cover trace 79713b9a6511bf16b208f72a46f90a26 (Oct 30, placement 573e22fe-35f3-94c5-cb71-03c427c1ef3a) and the Nov 12 05:32:55 UTC api/user-view drop on container 89e37a28be81…. If not, the alternative is to accept these drops and keep resending what's safe, and close this issue as won't-fix. I've assigned you until you decide.

  9. removed
    postponed
    on Nov 12, 2026
  10. leaf-agent commented on Nov 15, 2026

    @leaf-agent
    CollaboratorAuthor

    This happened a fourth time, with a different SDK error, and the timing points to a stalled container rather than a network drop. publish-site run 43766062944 (29cc7036ba9f, report #6076) failed when the verifier's GET /examples/triage-board/api/state came back 500 after 12.1 s with Error proxying request to container: Container is taking too long to accept the connection; the application could be overwhelmed with load. The SDK passes this error through as Error proxying request to container: …, unlike the Network connection lost. it turns into Container suddenly disconnected. errorSource still classifies it as disconnected, so the Worker resent the GET as #5815 intended, and the resend failed too.

    The Observability records (abr_level 1) line up with one agent command:

    • 22:03:50.099 UTC: the hosted turn (01a1e13c-ac73-78a0-9ce5-f4a4a3fdd7c0, container 45598727…) starts commandExecution exec-032331df…. It completes at 22:04:07.783 (durationMs 17684, exit 0).
    • 22:03:50.0 to 22:04:03.3: no leaf-agent record at all from the container, though it logged every few hundred ms before and after.
    • 22:03:57.274 (GET), 22:03:58.313 (POST), 22:04:03.301 and 22:04:03.352 (GET): four leaf-container http_error records, all source: "disconnected".
    • 22:04:03.348: records resume, and the same turn carries on without a restore or restart.

    So the container's HTTP server stopped accepting connections and stopped logging for about 13 s while one agent command ran. The container wasn't gone. The instance is a single vCPU (worker/wrangler.toml), so two explanations fit, and these records can't tell them apart: the command starved the whole container of CPU, or something blocked the adapter's uvicorn event loop for the length of the command. The records don't show what the command was. Either way, the resend #5815 added fires right away, inside the same stall, so it can't cover a stall of this length.

    This may also account for the earlier disconnected drops, which also happened while the container kept running. The Nov 12 one (05:32:55.434 UTC) doesn't show it clearly, though. It fell during a fileChange item (05:32:53.8 to 05:32:56.8). It came shortly before a 4.3 s commandExecution and a 3.5 s gap in the container's records, and there's no 13 s silence like this one. The records are compatible with load but don't establish it.

  11. max-sixty commented on Nov 18, 2026

    @max-sixty
    Owner

    Closing. The disconnected 500s have three causes. #6370 fixes the recurring one and logs what the next stall looks like from inside the container; it reached leaf.page with publish-site run 44303242805.

    Container suddenly disconnected is a keep-alive race in our setup. The Workers runtime pools connections to a container port and drops one after 5 s idle (kj's default HttpClientSettings::idleTimeout). uvicorn also closes an idle keep-alive connection at 5 s. A request the pool sends on a connection idle for about 5 s reaches a server that is closing it, and nothing resends it. The two such records in the last week went out on connections idle 4.86 s and 5.03 s, and a wrangler dev repro lost 10 of 42 requests at a 5000 ms gap and none at gaps of 1000–4995 ms or 5005–6000 ms. With uvicorn's keep-alive at 75 s the repro lost none. #6370 sets it to 60 s. The earlier drops here (Oct 29, Oct 30, Nov 12) returned the same message while the container kept running, which fits this race. The pool's side is filed upstream as cloudflare/workerd#8628.

    The Nov 15 accept timeout reads as the container's VM stopping, on Cloudflare's side. For 13.2 s from 22:03:50.1 UTC the container logged nothing, accepted no connection, and used 0.019 s of CPU in its 10 s metrics sample (containersMetricsAdaptiveGroups), below the 0.03 s an idle container uses. A command starving the single vCPU would show high CPU instead: the week's other long commands peaked at 50–94%. A blocked uvicorn event loop would leave the kernel accepting connections and Codex, a separate process, running on time, but Codex's 10 s timer fired at 13.4 s. This is one event, and the records can't say what on the host stopped the VM, so no support case yet.

    Can't read from request stream because client disconnected (13 records in a week) is a visitor leaving while their container started. Nothing is wrong there.

    What #6370 records from now on:

    • http_error records carry detail, the SDK's sentence, which tells these three apart.
    • container_stalled: a watcher thread in the container woke a second or more late. It carries the VM's CPU time over the gap, the time the host ran other work, and the time tasks waited for CPU, memory or IO.
    • container_unresponsive: the watcher woke on time but Leaf's server hadn't begun answering its loopback health check after a second. It carries the Python stack of the event loop's thread.

    A container_stalled record with CPU near zero is the evidence a Cloudflare support case needs. When one appears, open a new issue with it.

    This was written by Claude Code on behalf of max-sixty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions