Skip to content

Bound every Python-side test wait by the suite's deadline - #1778

Merged
max-sixty merged 3 commits into
mainfrom
agent-aa002f5051bf05ac7
Oct 5, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-aa002f5051bf05ac7

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

#1755 raised STATED_TIMEOUT to 60s as the suite's one hang bound, but about 230 Python-side waits still fixed their own literal deadline (3-120s), sized to how long the work took where each was written. On a loaded runner those fail a correct product.

  • Every hang bound on work that should complete takes STATED_TIMEOUT, or COMPOSITE_TIMEOUT (twice it) for the subprocesses that took 90-120s: a nested pytest run, a preview building and serving a page, a hook launched through uv. Browser-side Python polls in the render harness and the read-state test take SERVED_TIMEOUT_MS. Waits whose expiry said nothing now name the missing fact, and bare joins assert that their thread finished.
  • test_a_python_side_wait_takes_the_suites_deadline reads tests/ and rejects a literal deadline on the standard library's blocking waits, wait_for, and monotonic() + N. One test_render_gate.py site is listed while another change holds that file.
  • Three waits that waited out an absence now wait on a decided outcome. The re-vendor serialization helper and the concurrent-undo test used 2s and 1s windows; they now see the taker waiting on the held lock through interact_support.lock_contention, which tries a blocking flock without blocking first and states the refusal. The Codex observer fixture used a 0.1s recv to catch an approval reply; it now reads everything the observer sends until it closes the connection.
  • test_concurrent_page_init_serializes_creation checked calls == 1 right after the second init announced itself, before it reached the lock, so it passed with the page lock made shared. It now holds the first creation until the second is found waiting on the page's lock or seen creating. With the lock shared (LOCK_SH in page_locked), the old test passes and the new one fails ("the second init began creating while the first held the page").
  • The cold SessionEnd test bounds the hook with the suite's deadline rather than the harness's 3s: the transaction stays held for the run, so a hook that waited on it would never return.

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

max-sixty and others added 2 commits October 4, 2026 17:07
#1755 raised `STATED_TIMEOUT` to 60s as the suite's one hang bound, but
about 230 Python-side waits still fixed their own literal deadline (3-120s),
sized to how long the work took where each was written. On a loaded runner
those fail a correct product.

- Every hang bound on work that should complete takes `STATED_TIMEOUT`, or
  `COMPOSITE_TIMEOUT` (twice it) for the subprocesses that took 90-120s: a
  nested pytest run, a preview building and serving a page, a hook launched
  through uv. Browser-side Python polls in the render harness and read-state
  test take `SERVED_TIMEOUT_MS`. Waits whose expiry said nothing now name the
  missing fact, and bare joins assert that their thread finished.
- `test_a_python_side_wait_takes_the_suites_deadline` reads tests/ and rejects
  a literal deadline on the standard library's blocking waits, `wait_for`,
  and `monotonic() + N`. One `test_render_gate.py` site is listed while
  another change holds that file.
- Three waits that waited out an absence now wait on a decided outcome. The
  re-vendor serialization helper and the concurrent-undo test used 2s and
  1s windows; they now see the taker waiting on the held lock through
  `interact_support.lock_contention`, which tries a blocking `flock` without
  blocking first and states the refusal. The Codex observer fixture used a
  0.1s `recv` to catch an approval reply; it now reads everything the
  observer sends until it closes the connection.
- `test_concurrent_page_init_serializes_creation` checked `calls == 1` right
  after the second init announced itself, before it reached the lock, so it
  passed with the page lock made shared. It now holds the first creation
  until the second is found waiting on the page's lock or seen creating. With
  the lock shared, the old test passes and the new one fails ("the second
  init began creating while the first held the page").
- The cold SessionEnd test bounds the hook with the suite's deadline rather
  than the harness's 3s: the transaction stays held for the run, so a hook
  that waited on it would never return.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 5, 2026
# Conflicts:
#	tests/conftest.py
#	tests/interact_support.py
#	tests/test_interact_layer.py
#	tests/test_interact_session.py
@leaf-agent

Copy link
Copy Markdown
Collaborator

The first test attempt failed in two test_native_anchor_scroll_retains_local_motion_proof cases: the watcher reported an anchored textarea moving without input after the test's scroll. The same two cases passed in isolated runs on this PR and current main, and the failed job's rerun passed the full test job. The approval stands; the retry needed no change to this PR.

@max-sixty
max-sixty merged commit 23a69aa into main Oct 5, 2026
5 of 6 checks passed
@max-sixty
max-sixty deleted the agent-aa002f5051bf05ac7 branch October 5, 2026 02:09
max-sixty added a commit that referenced this pull request Oct 5, 2026
…he shift watch a pre-scroll pose (#1790)

Two tests failed under load and passed alone. Each failure traced to a
definite cause, and neither fix is a retry or a longer wait.


**`test_a_user_move_no_carrier_will_pick_up_messages_its_claude_code_session`**

This test failed four times in loaded local runs, each time at `auth,
user = messages("s1")` with `TypeError: cannot unpack non-iterable
NoneType`. The comment posted after the "watcher" let go of its lease
reached no one, because `wait_is_live` still read the lease as held.

A flock belongs to the open file, and every copy of the descriptor
shares it. The test holds the wait lease in the same process that runs
the page server. The comment posted under the lease starts a
thread-title `claude` subprocess about 6 ms before the test closes the
lease. On macOS, CPython forks to start that subprocess, so the child
holds a copy of the lease descriptor until its exec closes it.
`lease.close()` closed only the parent's copy. If the forked child is
held across the close, the test fails every time with the same error.
The presence cache was not involved: the nudge decision reads presence
fresh.

The fix is at the primitive. `release_lease` now unlocks before it
closes, which releases the open file whatever copies remain. Tests
release their leases through `release_lease` instead of closing the
descriptor. Any process that holds a lease and starts subprocesses had
the same window, for example a page server releasing its lease while a
title subprocess is starting. `flocked`, `page_locked` and the
interaction log also unlock before they close. Those locks are blocking,
so the window only delayed the next taker until the child's exec, and
none of them gave a wrong answer.


`test_a_released_lease_is_free_while_a_child_still_holds_its_descriptor`
passes a lease descriptor to a live child and checks that the released
lease reads free. It fails when `release_lease` only closes.

**`test_native_anchor_scroll_retains_local_motion_proof[*-]`**

This failed on attempt 1 of #1778, and in two other CI runs since #1705
rewrote it, with `textarea#field moved without input`. It is unrelated
to #1751's resize ownership: the resize branch never ran. A traced CI
run showed that the motion came from the test's setup scroll, not from
the typing gesture. The page scrolled before the watch's first frame, so
the watch's first pose already showed the anchor scrolled while the
anchored field had not moved yet. Chrome moved the field one frame later
and reported that as a layout shift whose only source was the field. The
watch credits a portal's catch-up to scrolling only from a pose taken
before the scroll. It had no such pose, so it reported the move, which
was correct.

The test now paints a frame before it scrolls. The watch registers its
frame callback at document start, ahead of any callback the page adds,
so that frame gives the watch the pre-scroll pose. In an A/B on CI
runners under the same load, the old order failed 2 of 648 copies and
the fixed order failed 0 of 648. An earlier traced run had failed 2 of
432 copies.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 5, 2026
…ase its lease unlocked

#1778 allowlisted answer_ready.wait(10) while this file was held; it now takes
STATED_TIMEOUT and the allowlist goes. The state-wait test releases its waiter
lease with release_lease, which #1790 made unlock before closing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent pushed a commit that referenced this pull request Oct 5, 2026
…f-hour limit (#1807)

#1778 moved Python-side waits onto `STATED_TIMEOUT`. Browser waits kept
literal millisecond deadlines sized to an unloaded run
(`to_have_text(...,
timeout=10_000)`, `wait_for_function(..., timeout=3000)`), and every
bare
`expect` kept Playwright's five-second default.

`render_harness` now makes `SERVED_TIMEOUT_MS` the default of every
`expect` and
of every page it prepares, so a browser wait names a deadline only where
it
spans a page handover (`HANDOVER_DEADLINE_MS`). Of the 72 literal
browser
deadlines outside the files another change is rewriting, 38 hang bounds
on one
fact drop their deadline, 32 waits across a replay, a reload or a
restarted
server take `HANDOVER_DEADLINE_MS`, and two whose expiry is their
subject name
their length. Three helpers lose a literal default deadline nothing
overrode.

Three waits that depended on speed now wait on what the page states: the
dead
release counts the replacement document's probe rounds instead of
sleeping
four seconds, the probe-in-flight test holds the round until the page
presents
instead of racing a two-second sleep against a 600 ms timer, and the
read
receipt waits on `wait_for` instead of 100 polls of 20 ms.

`test_a_wait_takes_the_suites_deadline` replaces the Python-side check:
any
`timeout` or `timeout_ms` a call passes or a helper defaults, a page's
default
deadline, and the existing first-argument and `monotonic()` forms. It
holds a
count per file for the six render files another change is rewriting.


`test_widget_quality.py::test_an_export_first_paints_its_widgets_at_their_presented_boxes`
hung until the six-hour job limit on two CI runs (37234497522,
37243845311).
No call in it can be bounded where it is made: `page.evaluate` and
`browser.new_page` take no deadline, and Playwright enforces the ones it
takes
in its driver. pytest's `faulthandler_timeout` with exit now ends any
test
still running after 30 minutes, printing every thread's stack, and xdist
reports it as crashed and carries on.


> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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