Repository navigation
Description
The work
Add structured diagnostics when Connect times out waiting for tunnel response headers in apps/connect/src/tunnel-do.ts. Preserve the existing 30-second timeout and HTTP 504 behavior.
Capture enough context to correlate a failed request with tunnel health: request hostname, method and pathname; stream identifier; elapsed time and timeout threshold; tunnel ready state and whether it remains the current tunnel; pending request count; and target port when present. Exclude query strings, cookies, authorization headers and request bodies.
Why now
The reporter intermittently sees HTTP 504 in the mobile app and reports needing to quit and restart. We could not correlate a failing phone request with a gateway event. The gateway response-header timeout currently returns 504 without recording the request or tunnel state, leaving a concrete observability gap.
The original production incident remains unverified: its exact failing URL, native app build and gateway event were not captured, and the saved Cloudflare login returned HTTP 401. This task enables diagnosis; it does not claim that this timeout path caused the reported failures or that logging fixes them.
Evidence
- At investigation base
b1f94e0795e14f98e0ccdbdb860830f5f32ebfbe, the timeout callback callsfailHttpStreamwith status504and messagetimed out waiting for the tunnel client, without a diagnostic event. - The closest controlled reproduction is the existing targeted-request test: accept a request on an open mock tunnel, withhold response headers, advance the clock 30 seconds, and observe 504. This establishes the code path, not the user's production cause.
- Superseded draft Log Connect gateway timeout diagnostics #3992 contains a minimal implementation and focused regression coverage. Remote CI passed at
e4a659aba1ff084e1fff14f31fb77c36e8f59ed0. Nothing was merged or deployed. - An isolated iOS fault-injection run showed that foregrounding leaves the injected error visible, while Try again restored the page without restarting. This did not reproduce the reported restart requirement; committing that fixture is outside this task.
- Originating BB investigation (owner access required).
Related reports cover different established symptoms: #3407 concerns remote preview/host command timeouts; #2065 concerns tunnel-admission HTTP 500 retries; #3791 concerns truncated startup assets and native authentication recovery; #3964 concerns indefinitely pending browser requests. No shared root cause with this incident is established.
Acceptance criteria
- A response-header timeout emits one structured event with the diagnostic context above before returning the existing 504.
- Query strings, cookies, authorization headers and request bodies are absent from the event.
- Focused regression coverage exercises a withheld response and verifies the event, sensitive-value exclusion, and unchanged 504 behavior.
- Successful requests, timeout duration, response bodies and tunnel protocols retain their existing behavior.
- Remote CI passes. Document how to find the event in gateway logs when the change is deployed, so a future occurrence can be correlated.
- Keep this limited to gateway diagnostics and focused coverage; no mobile recovery changes or committed iOS reproduction infrastructure.
BB-Thread-ID: thr_ee42j9tr34
AGENT GENERATED
Activity
bb-slop-cop commentedon Sep 22, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied Type Task, Priority Medium, Effort Low, and labels
remote,connect. All values were missing; final classification verified.This is contained gateway observability work to support investigation of an unverified incident. Reproduction reporting and a pull request were skipped because the final Type is Task.