Skip to content

playwright: per-request HTTP timeout so a wedged host fails fast (E1)#182

Merged
borisbat merged 1 commit into
masterfrom
bbatkin/transport-request-timeout
Jun 5, 2026
Merged

playwright: per-request HTTP timeout so a wedged host fails fast (E1)#182
borisbat merged 1 commit into
masterfrom
bbatkin/transport-request-timeout

Conversation

@borisbat

@borisbat borisbat commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Why

E1 from the integration-test sync investigation. On #118's windows-latest run, test_imgui_synth_ctrl_shortcuts wedged for 159s and tripped:

imgui_playwright.das:1404: daslang-live timed out (>120s)

i.e. it ran all the way to the popen watchdog (DEFAULT_TEST_TIMEOUT_SEC = 120) instead of failing fast.

Mechanism: the live-API client used dasHV's convenience GET/POST, which inherit libhv's default (effectively unbounded) response timeout. The host serves the live API on the GLFW main thread that also advances frames (see the header note in imgui_transport.das). So when a synth command wedges that thread, the host stops answering and stops rendering, and the client blocks on the POST with no timeout — the body can't make progress and the whole subprocess runs to the 120s watchdog. A mute 2-minute hang with no useful diagnostic.

What

Add http_get / http_post helpers in imgui_transport built on dasHV's existing request(req) rail (which exposes HttpRequest.timeout), with a hard per-request timeout (DEFAULT_REQUEST_TIMEOUT_SEC = 10s), and route every client call through them:

  • live_api_transport's POST /command (every command + snapshot poll)
  • wait_until_ready's GET /status
  • get_text (→ reload / reset / read_status)
  • post_signal (POST /shutdown / /reload / /reset)

Now a wedged host yields a null / status==0 reply in ~10s, so the wait_until budgets actually bound the failure and the diagnostic is legible instead of a silent 120s hang.

Scope / non-goals

  • Client-side only — no host or daslang change. Uses dasHV's existing request(req) rail, so no dasHV add was needed; the convenience GET/POST stay as-is.
  • This makes wedges fail fast and legibly; it does not fix the cause of the windows synth wedge (that's E2) or the test_docking_basic crash (0xC0000409, deferred). Both become much easier to diagnose once the harness fails in seconds rather than minutes.

Validation

  • compile_check (through consuming tests) ✓, lint 0 issues ✓, das-fmt verify ✓.
  • Functional validation is the ci: fix Windows caching + re-enable windows-latest #118 rebase on CIwindows-latest headless is the env where the wedge reproduces. The local harness needs a Release daslang-live this dev box doesn't currently have, so a local end-to-end smoke wasn't possible; the change is functionally equivalent to the old path plus a timeout (both go through libhv requests::request).

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Playwright/live-API client transport to apply a hard per-request HTTP timeout, so integration tests fail fast (≈10s) when the host wedges and stops responding, instead of hanging until the overall popen watchdog (120s).

Changes:

  • Add http_get / http_post helpers in imgui_transport that set HttpRequest.timeout per request.
  • Route live API calls in imgui_playwright (readiness polling, text fetches, and control signals) through these timeout-bounded helpers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
widgets/imgui_transport.das Introduces HttpReply, http_get, and http_post wrappers that set per-request timeouts and are used by live_api_transport.
widgets/imgui_playwright.das Switches readiness polling, simple GETs, and signal POSTs to use the new timeout-bounded transport helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread widgets/imgui_transport.das Outdated
Comment thread widgets/imgui_transport.das Outdated
The live-API client (live_api_transport's POST /command, plus wait_until_ready /
get_text / post_signal) used dasHV's convenience GET/POST, which inherit libhv's
default (effectively unbounded) response timeout. The host serves the live API on
the GLFW main thread that also advances frames, so when a synth command wedges that
thread the host stops answering AND stops rendering — and the client blocks on the
POST with no timeout, running the test body all the way to the 120s popen watchdog
(DEFAULT_TEST_TIMEOUT_SEC) instead of failing in seconds.

Seen on #118 windows-latest: test_imgui_synth_ctrl_shortcuts wedged for 159s and
tripped "daslang-live timed out (>120s)".

Add http_get / http_post helpers in imgui_transport that build an HttpRequest via the
existing request() rail with a hard per-request timeout (DEFAULT_REQUEST_TIMEOUT_SEC =
10s, clamped to 1..65535 so misuse can't wrap the uint16 field), and route every client
call through them. A wedged host now yields a null / status-0 reply in ~10s, so the
wait_until budgets actually bound the failure and the diagnostic is legible instead of
a mute 120s hang.

Client-side only — no host or daslang change. The convenience GET/POST stay as-is; this
uses dasHV's existing request(req) rail (HttpRequest.timeout). The new public http_get /
http_post are grouped under "Raw HTTP" in utils/imgui2rst.das to satisfy the
Uncategorized doc gate. Functional validation is the #118 rebase on CI (the
windows-headless env where the wedge reproduces).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@borisbat borisbat force-pushed the bbatkin/transport-request-timeout branch from e0e41e2 to e26a957 Compare June 5, 2026 23:15
@borisbat borisbat requested a review from Copilot June 5, 2026 23:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@borisbat borisbat merged commit e1c73e5 into master Jun 5, 2026
6 checks passed
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.

2 participants