Skip to content

Hosted journey state polling fails with a connection reset #4521

Closed

Description

@leaf-agent

The hosted journey in publish-site run 40596480831 failed at 22:57:33 UTC on October 27 while polling GET /examples/triage-board/api/state: Playwright raised APIRequestContext.get: read ECONNRESET. The traceback is run_journey → ask_until_answered → await_turn → BrowserEnd.state → read_state. Public release verification had already passed at 22:56:39; the journey did not finish verifying the agent's answer.

This state-polling failure has appeared before in #3416, which was closed as transient. The current evidence does not establish whether these resets share a cause or where this reset occurred. Investigate the transport and state-reading boundary before adding retries or weakening the journey.

Evidence for investigation
  • Run: gh run view 40596480831 --log-failed, commit d0fb1f6adc32450560db027eed8e8e96f67976cd, release b9c270e593e4138648d6a7cf46433d8629f48869c26c894dfa2cd5eee5a50706.
  • Cloudflare Observability query using worker/README.md, window 2026-10-27 22:57:28–22:57:38 UTC, filter $metadata.service=leaf-website, returned 81 records with abr_level=1. The returned records contain successful state invocations through 22:57:33.037 (01M5ZSAJVD0000000000000002), with status 200 and outcome ok; none of these records has metadata level error. This does not identify which request reset or prove a platform fault.
  • The component-filtered query for 22:56–22:58 also shows the hosted turn continuing model/tool work after the journey exited. It does not establish successful journey completion.
  • The preceding completed publish run 40591361778 passed. The next run 40598683864 was still in progress during triage. No older deployment was rerun.
  • Hosted journey reload fails when Durable Object storage resets #3989 tracks explicit Durable Object storage-reset errors. The current records do not establish that diagnosis here. Retry a reset website activation in the hosted agent pass #3334 concerns activation recovery; this failure is later state polling during an active turn.

Cause of a failure tracked in #4520.

Activity

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

    @leaf-agent
    CollaboratorAuthor

    The successful state invocations near the reset belong to two different transports. The latest success at 22:57:33 is browser HTTP/3 traffic; it does not show that the journey's APIRequestContext.get reached the Worker. I’m leaving this open: the available evidence narrows the investigation to the HTTP/1.1 transport but does not establish a safe repository fix.

    Transport evidence and remaining gap

    I repeated the Observability query for 2026-10-27 22:57:28–22:57:38 UTC, filtering $metadata.service=leaf-website: 81 records, abr_level=1, below the 100-record limit.

    • HTTP/1.1 state polling last appears at 22:57:31.553, trace 39dc27ae21b14e1e8244863d4a9e4bdf, ray a5154cdb1f254a77. Both its edge and Durable Object invocations report status 200 and outcome ok.
    • The later state read at 22:57:32.959 (edge) / 22:57:33.037 (Durable Object), trace 7a283789419c65c2f7a63e8c2f6fafc7, uses HTTP/3 and browser fetch headers. Both transports reach the same Durable Object and name the failing run's release and layer. Cookies are redacted, so they cannot independently identify the client.
    • The returned window contains no later HTTP/1.1 state invocation. This supports a failure before a recorded Worker invocation; it does not identify whether the reset originated in the runner, an intermediary, or Cloudflare's ingress, and invocation logs cannot rule out an unrecorded request.
    • The failed run also logged APIRequestContext.get: read ECONNRESET at 22:50:25 on /api/view?revision=1&through_seq=2, during release verification. That is evidence of another affected endpoint, rather than a demonstrated state-reader-specific defect.

    At the failed run's commit, read_state fails inside the request call, before HTTP-status checking or JSON decoding. No state assertion or agent-answer check produced this diagnostic. The preceding passing publish and the evidence from #3416 do not establish that this recurrence is resolved.

    @max-sixty: locating this reset needs transport evidence absent from the retained run: Cloudflare ingress diagnostics for the failing connection, or client socket diagnostics captured during a recurrence. The decision needed is whether to obtain Cloudflare-side diagnostics or authorize adding narrowly scoped, credential-safe client transport capture to publish-site (a control-plane change). I have not added retries or changed the journey's success checks.

  3. max-sixty commented on Oct 28, 2026

    @max-sixty
    Owner

    add whatever diagnostics we need; don't we already have Cloudflare logs?

  4. leaf-agent commented on Oct 28, 2026

    @leaf-agent
    CollaboratorAuthor

    Yes—we already have Cloudflare Workers Observability logs; those are the server-side records queried above. They did not expose the client connection that reset without a matching recorded Worker invocation.

    Added the missing client capture in #4604. During public release verification and the hosted journey, Playwright's Node driver will log UTC timestamps, socket reuse/lifecycle, peer addresses and ports, TLS negotiation, durations, status and Cloudflare ray IDs. Successful responses can be joined to Cloudflare's logs by ray ID; failures without a response retain socket evidence. These records go into the existing CI job log, excluding URLs, credentials, bodies and general header dumps.

    The real-driver test passed for socket reuse and a forced connection reset, with planted credentials excluded from the output; a separate local HTTPS probe verified TLS records. CI passed on b73937d3a.

    The PR awaits your control-plane review: repository policy says, “Changes to workflows, Tend's configuration, CODEOWNERS, or agent instructions require the control-plane owner's fresh approval.” This issue stays open for the next recurrence and diagnosis; the capture does not establish the reset's cause.

  5. leaf-agent commented on Oct 29, 2026

    @leaf-agent
    CollaboratorAuthor

    New recurrence from #4711: publish-site run 40950044395 failed at 2026-10-29 20:52:15 UTC in the same await_turn → state → read_state polling path, with APIRequestContext.get: read ECONNRESET on /examples/triage-board/api/state.

    The client capture added in #4604 now supplies new evidence: request 18 on socket 1 returned HTTP 200 at 20:52:13.221 UTC, ray a5250fbe0f5c3409-BNA, after 12,907 ms. Request 19 reused that socket at 20:52:15.225 and failed with ECONNRESET after 27 ms, without a response or ray ID; the socket then closed with hadError: true. This establishes a reset on a reused connection, but does not identify which peer or intermediary caused it. The preceding successful ray and this narrow time window provide the server-log correlation point missing from the earlier recurrence.

    This issue remains the diagnosis owner; no retry or success-check change is justified by this evidence alone.

  6. leaf-agent commented on Oct 31, 2026

    @leaf-agent
    CollaboratorAuthor

    Cloudflare correlation now confirms that request 18 completed successfully through both Worker invocations; it still does not locate request 19's reset. The next diagnostic needs Cloudflare ingress/connection records, beyond the Workers Observability records available here. @max-sixty: please obtain those records through Cloudflare support for the connection following ray a5250fbe0f5c3409-BNA, at 2026-10-29 20:52:15.225–20:52:15.252 UTC, from publish run 40950044395. This issue retains the engineering follow-up once that evidence is available.

    Server correlation and diagnostic limit

    Queried Workers Observability for 2026-10-29 20:52:12–20:52:18 UTC, filtering $metadata.service=leaf-website. It returned 28 records with abr_level=1, below the 100-record limit.

    • The preceding successful HTTP/1.1 poll has ray a5250fbe0f5c3409, trace b5d184a59af5d0546361c0e02f7f3be7, and invocation records 01M64PYH810000000000000002 and 01M64PYH8B0000000000000008. Both report HTTP 200 and outcome ok; their wall times are 12,819 and 12,869 ms. This matches the client's request 18 response at 20:52:13.221 UTC after 12,907 ms.
    • The other state invocation records in this query use HTTP/3. There is no matching HTTP/1.1 invocation for request 19 in the returned window. This is consistent with a reset before a recorded Worker invocation, but cannot rule out missing invocation telemetry or identify the resetting peer.
    • The retained client log establishes socket reuse and the 27 ms reset without a response; Workers logs establish the preceding successful request's execution. Neither supplies ingress TCP connection history. A retry or state-reader change would not establish the cause from this evidence.
  7. leaf-agent commented on Nov 4, 2026

    @leaf-agent
    CollaboratorAuthor

    New recurrence from #5382: publish-site run 41876972316 on b1c7255d2a43b383bd1649e08f56a467e04a32ba failed at 17:57:09 UTC on November 4. The failure is in the same await_turn → state → read_state path: APIRequestContext.get: Failed after 2 attempt(s): Error: read ECONNRESET on /examples/triage-board/api/state.

    This run shows something the earlier recurrences didn't: a freshly opened connection reset too, not only a reused keep-alive socket. Stale-socket reuse alone can't explain this failure.

    • Request 26 reused socket 1 at 17:57:01.102. It reset after 3,144 ms without a response; in publish-site failing on main (push) #4711's recurrence the reset came after 27 ms.
    • Playwright retried on a new socket 2. TCP connected to 172.67.171.165:443 and TLS 1.3 negotiated (authorized: true) by 17:57:04.573. Request 27 then reset after 5,315 ms, again without a response or ray ID.
    • Workers Observability for 17:56:58–17:57:12 UTC ($metadata.service=leaf-website, 32 records, abr_level=1) records the preceding HTTP/1.1 state poll, request 25, at 17:56:59.079 (edge) and 17:56:59.195 (Durable Object), both status 200 and outcome ok. No HTTP/1.1 state invocation appears for requests 26 or 27. In that window, the browser's HTTP/3 /api/news and /api/state requests to the same page succeeded, apart from two /api/news long polls that ended canceled after about 8.6 s.

    So for the third time the reset happens before any recorded Worker invocation, and this time on a connection whose handshake had just succeeded. That points at the path between the runner and the Worker (Cloudflare ingress or an intermediary) rather than at read_state or the Worker's state handler. It still doesn't identify which peer sent the reset.

    Client socket timeline (from the run log)
    • Request 25, socket 1, reused: sent 17:56:58.919, 200 after 179 ms, ray a5557f9c6fc02c62-DFW
    • Request 26, socket 1, reused: sent 17:57:01.102; socket-error ECONNRESET at 17:57:04.246 (3,144 ms); socket closed with hadError: true
    • Socket 2: connect at 17:57:04.533, tls at 17:57:04.573
    • Request 27, socket 2, new: sent 17:57:04.499; request-error ECONNRESET at 17:57:09.814 (5,315 ms)
    • Earlier polls on socket 1 had slow but successful responses: request 16 took 32,586 ms (ray a5557dd5d8a32c62-DFW) and request 20 took 19,582 ms (ray a5557ecb99422c62-DFW)

    This issue still owns the diagnosis. The Cloudflare ingress records requested on October 31 remain the missing evidence; ray a5557f9c6fc02c62-DFW and the window 17:57:01–17:57:10 UTC on November 4 give a second, more recent connection to look up.

  8. max-sixty commented on Nov 5, 2026

    @max-sixty
    Owner

    Max's decision from the backlog triage: go ahead with this repair.

    Repair: Treat a connection reset that arrives before the Worker records any request as transport noise the state poll retries through, keeping #4604's socket log.

    What decides it: In all three cases the reset came before any Worker invocation, which places it between the runner and Cloudflare's edge. The symptom shows only in CI, so it doesn't need a Cloudflare support case.

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

  9. leaf-agent commented on Nov 5, 2026

    @leaf-agent
    CollaboratorAuthor

    Opened #5412 for this repair: the state read now retries through up to five connection resets, with Playwright's backoff doubling from 250 ms, so a read rides through about eight seconds of resets. #4604's socket log is unchanged. Merging it will close this issue.

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