Skip to content

Move 45 over-budget tests to daily journeys, and stop five waiting out an unanswered title completion - #6732

Merged
leaf-agent merged 3 commits into
mainfrom
tests-over-budget-journeys
Nov 22, 2026
Merged

leaf-agent merged 3 commits into
mainfrom
tests-over-budget-journeys

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Move 45 test functions that ran over their tier's time budget in both of the last two daily runs, November 21 (44896279165) and November 20 (44722728605), into the daily tests/journeys/ tier, as tests/AGENTS.md asks of a test over its directory's budget. 29 come from tests/browser/ (8 s budget), 13 from tests/model/ and 3 from tests/process/ (3 s budget). Each moved function's source is the same at both runs' commits and at this branch's base, and each had a passing over-budget case in both runs. Only when they run changes: the browser tests now run daily instead of on each push to main, and the model and process tests leave a pull request's broad selection for the daily run.

No test body changes. Each function moves to the same relative path under tests/journeys/, imports its helpers from the module it left, and takes that module's pytestmark. notes/browser-support.md now names the new location of test_hosting.py's chart test, and src/leaf/registry/contract.py names the snapshot's actual directory, tests/model/interact_contract/_regtest_outputs/.

Five more tests were over budget in both runs, at about 60 s each. They stay in their tiers, because the suite caused the wait: a comment on a page that a Claude Code session claims starts a thread-title worker, which asks the session for a completion that no hooks module answers in a test, and retire_test_services then joins that worker until inference.TIMEOUT ends the ask. Teardown now answers the sessions' pending completions as failed calls, the way the module reports one, and keeps answering while it joins the title workers, so a worker that asks only after teardown begins is answered too (a regression test in tests/process/test_interact_server.py holds a worker just before its request until teardown joins it); and the five run in under 7 s locally: test_each_case_of_an_event_is_told_what_the_snapshot_shows, test_reply_command_guides_selection_and_followup, test_site_page_accepts_events_across_build_and_container_python_versions, test_every_state_answer_holds_the_served_state_schema and test_a_written_comment_keeps_its_originating_agent.

Two of the moves sit just above 120 s in all three runs read (rows marked ⏱ below), which looks like each waits out a fixed interval. I haven't checked what they wait on; making them faster would let them return to their tier.

Verification: collecting every tier gives the same test ids as the base apart from the tier directory (only test_suite_source.py's per-module cases differ, since they follow the files); --setup-plan resolves every moved case's fixtures; tests/model/test_suite_source.py (1,608 passed), ty check --error-on-warning tests, Ruff and pre-commit pass on the changed files; the moved model and process functions, one browser test from each new journeys module, the five tests kept in their tiers (both regtest snapshots among them), tests/model/interact_contract/test_layer_contract.py and tests/model/test_thread_titles.py pass.

The daily readings behind each move (seconds per case, from leaf-dev suite profile)

Times are the function's over-budget passing cases in each run, as a range where several parameter cases were over. A function moves as one unit. November 19 (44509509454) is shown for context; "—" means no case was over budget that day.

Test, now at From (budget) Nov 21 Nov 20 Nov 19
tests/journeys/controls/test_command_routes.py::test_widget_context_keys_work_without_an_obligation browser (8 s) 11.4 15.8 11.8
tests/journeys/controls/test_command_routes.py::test_widget_owned_inline_hints_follow_reachable_commands browser (8 s) 12.6–14.2 16.4–16.7 12.0–12.1
tests/journeys/controls/test_previews.py::test_a_message_s_parts_follow_its_accepted_edit browser (8 s) 8.1 10.1 8.2
tests/journeys/controls/test_theme_and_device.py::test_a_page_s_reset_leaves_leaf_s_controls_their_faces browser (8 s) 10.8 13.0 9.5
tests/journeys/drafts/test_shared_drafts.py::test_words_typed_on_a_reload_stand_over_the_send_it_cut_short browser (8 s) 10.1 12.1 9.8
tests/journeys/margin/test_card_placement.py::test_the_rail_tab_stop_follows_a_carried_row_back_into_view ⏱ browser (8 s) 121.0 121.9 121.0
tests/journeys/margin/test_card_reply.py::test_a_card_says_new_reply_for_an_answer_past_its_transcript_s_foot browser (8 s) 8.4 9.7 9.1
tests/journeys/margin/test_pins.py::test_a_pass_for_a_change_to_the_rows_seats_them_as_a_whole_pass_would browser (8 s) 10.0 11.1 10.6
tests/journeys/margin/test_scrollers.py::test_rows_follow_a_pane_and_a_shadow_scroller_in_every_engine browser (8 s) 8.1 8.6 12.2
tests/journeys/navigation/test_comment_marks.py::test_marked_words_are_seen_and_told_apart browser (8 s) 9.5 13.5 10.2
tests/journeys/navigation/test_comment_marks.py::test_o_gives_marked_words_their_own_colours_back browser (8 s) 9.3 8.8–12.5 9.6
tests/journeys/startup/test_changes_in_place.py::test_v_marks_what_changed_since_the_latest_version_and_takes_marks_off browser (8 s) 12.6 13.0 12.7
tests/journeys/startup/test_hosting.py::test_a_chart_in_a_sample_off_screen_waits_for_the_reader_and_a_check_shows_it browser (8 s) 16.7 19.7 —
tests/journeys/startup/test_hosting.py::test_a_sample_reached_while_loading_holds_growth_the_reader_did_not_cause browser (8 s) 10.3 11.2 10.9
tests/journeys/startup/test_hosting.py::test_a_sample_starts_its_page_as_it_nears_the_window browser (8 s) 11.9 14.4 12.9
tests/journeys/test_page_inspection.py::test_about_copy_on_plain_http_machine_name browser (8 s) 8.6 9.0 —
tests/journeys/test_public_api.py::test_package_render_checks_every_exercised_output_before_withdrawal browser (8 s) 8.5 8.7–9.6 8.3–8.4
tests/journeys/test_render_anchors.py::test_page_search_reads_a_docs_captions_title_apart_from_its_text browser (8 s) 13.3 8.3–17.3 9.1–13.8
tests/journeys/test_render_application_boundary.py::test_packages_and_panel_share_threads_through_gestures_and_authored_content browser (8 s) 9.4 10.0–11.8 8.3–9.9
tests/journeys/test_render_diff_controls.py::test_file_tree_opens_current_diff_files_by_pointer_and_keyboard browser (8 s) 8.8 9.6–10.8 9.1
tests/journeys/test_render_files.py::test_picking_a_file_under_an_open_panel_brings_it_clear browser (8 s) 9.0 10.1 9.7
tests/journeys/test_render_floating_panel.py::test_a_thread_s_keys_answer_in_its_view browser (8 s) 8.4 10.8 9.4
tests/journeys/test_render_floating_panel.py::test_the_field_reads_a_status_it_cuts_short_whole browser (8 s) 8.1 10.2 8.6
tests/journeys/test_render_gate.py::test_a_handover_waits_while_arrivals_land_and_ends_once_they_stop browser (8 s) 15.2 15.5 15.3
tests/journeys/test_render_gate.py::test_an_unanswered_startup_resource_fails_the_render_gate ⏱ browser (8 s) 120.5–120.6 120.8 120.5–120.6
tests/journeys/test_render_gate.py::test_the_gate_reads_a_sample_far_below_the_window browser (8 s) 9.6 10.5 9.9
tests/journeys/test_render_shift_watch.py::test_a_jump_owns_the_fit_of_the_live_sample_it_brings_near browser (8 s) 10.5 12.3 10.5
tests/journeys/widgets/test_tabs.py::test_a_side_list_longer_than_the_window_keeps_its_tab_and_open_item_in_view browser (8 s) 11.8–18.9 15.6–25.7 12.4–19.9
tests/journeys/widgets/test_workspaces_and_bounds.py::test_a_page_up_in_a_log_a_stream_feeds_leaves_its_end browser (8 s) 8.1–11.1 10.0–13.7 8.4–11.4
tests/journeys/interact_contract/test_authored_markup.py::test_check_advises_an_allocation_leaf_ignores_where_it_stands model (3 s) 3.6 4.7 3.7
tests/journeys/test_interact_anchors.py::test_a_blank_line_that_splits_a_messages_pre_is_refused model (3 s) 10.5 11.8 9.7
tests/journeys/test_interact_anchors.py::test_a_widget_sharing_its_opening_line_is_refused_for_its_paragraph_alone model (3 s) 4.3 5.2 3.7
tests/journeys/test_interact_document.py::test_check_advises_on_a_language_class_nothing_will_colour model (3 s) 3.8 4.9 3.6
tests/journeys/test_interact_layer.py::test_a_layer_that_reads_a_pages_copy_lasts_as_long_as_the_pages_memory model (3 s) 4.2 6.0 5.6
tests/journeys/test_interact_layer.py::test_package_list_describes_each_selectable_package_in_its_own_words model (3 s) 5.3 8.3 —
tests/journeys/test_responses.py::test_an_undeclared_answer_names_what_lets_its_widget_ask model (3 s) 3.7 4.7 4.3
tests/journeys/test_server_lifetime.py::test_a_temporary_server_ends_when_the_process_that_ran_it_exits model (3 s) 3.7 3.7–4.1 3.3
tests/journeys/test_server_lifetime.py::test_server_stop_closes_accepted_keep_alive_connections model (3 s) 3.8 4.4 4.5
tests/journeys/test_server_lifetime.py::test_server_stop_reports_a_server_that_exits_as_soon_as_it_is_disabled model (3 s) 4.7 3.5 3.9
tests/journeys/test_session_lifecycle.py::test_a_prompt_says_why_a_page_did_not_start_and_tries_again model (3 s) 3.2–5.0 3.8–6.9 3.1–5.2
tests/journeys/test_session_lifecycle.py::test_a_prompt_serves_only_a_page_its_session_still_means_to_serve model (3 s) 3.1 4.1 3.4
tests/journeys/test_session_lifecycle.py::test_a_resumed_sessions_first_prompt_serves_its_page_again model (3 s) 3.3–4.4 3.7–6.2 3.2–5.7
tests/journeys/test_interact_server.py::test_a_loopback_serve_says_the_url_opens_only_on_this_machine process (3 s) 3.8 4.3 3.8
tests/journeys/test_interact_server.py::test_sample_capability_authorizes_only_its_live_descendants process (3 s) 3.2 3.6–4.2 —
tests/journeys/website_server/test_saved_records.py::test_a_later_release_restores_a_visitors_page_as_they_left_it process (3 s) 3.6 4.4 3.4
Candidates left in place

Over budget in both runs but not moved, because the function changed between the measured commits and this base:

  • tests/model/test_themes.py::test_a_personal_theme_builds_on_the_reading_look (no longer at that path on the base)
  • tests/model/test_themes.py::test_a_new_page_reads_in_leaf_s_look_unless_it_takes_none

…y journeys

Each moved function ran over its directory's budget (browser 8 s, model and
process 3 s) in both the 2026-11-21 (44896279165) and 2026-11-20 (44722728605)
scheduled ci runs, per leaf-dev suite profile. The browser tests now run daily
instead of on each push to main; the model and process tests leave a pull
request's broad selection for the daily run. No test body changes.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Five of the ⏱ moves aren't slow tests. Each waits out one 60 s deadline the suite causes itself, so moving them to journeys/ hides that cause instead of fixing it. The five are test_each_case_of_an_event_is_told_what_the_snapshot_shows, test_reply_command_guides_selection_and_followup, test_site_page_accepts_events_across_build_and_container_python_versions, test_every_state_answer_holds_the_served_state_schema and test_a_written_comment_keeps_its_originating_agent.

In each of them a comment reaches a page claimed by a Claude Code session, so the page server starts a leaf-thread-title worker. That worker asks the session for a completion through completions.ask. No hooks module runs in a test, so nothing answers, and the ask polls until inference.TIMEOUT (60 s). Then retire_test_services joins the worker at teardown (worker.join(timeout=STATED_TIMEOUT)). A faulthandler dump at 25 s shows the main thread in that join and the worker in completions.py ask. The suite already makes the subprocess harnesses fail at once for the same reason (FAILING_HARNESS_PROGRAMS in tests/conftest.py), but the Claude Code completion route doesn't go through those programs.

This matters most for the snapshot test. It records what the agent is told for each $events clause, and a change to a clause is meant to show up as a diff in that change's own PR. Moved to journeys/, the diff would first show up as a red daily run on main.

Fix: before ending each session, retire_test_services answers that session's pending completions as failed calls (completions.pending / completions.replied), the same way the module reports a failed call. With that change, all five pass in under 3 s locally, and the browser one in about 5 s, so each stays in its own tier. I'll push that fix and move these five back. The other 45 moves, including the two 120 s ones, stand as they are.

…ep five tests in their tiers

Five tests the over-budget move sent to journeys each took about 60 s because a
comment on a page that a Claude Code session claims starts a thread-title worker.
The worker asks the session for a completion that no hooks module answers in a
test, so it waits out `inference.TIMEOUT`, and `retire_test_services` joins it.
Teardown now answers each pending completion as a failed call, the way the module
reports one. With that change the five run in under 7 s locally:

- test_each_case_of_an_event_is_told_what_the_snapshot_shows (model)
- test_reply_command_guides_selection_and_followup (model)
- test_site_page_accepts_events_across_build_and_container_python_versions (model)
- test_every_state_answer_holds_the_served_state_schema (process)
- test_a_written_comment_keeps_its_originating_agent (browser)

They return to their tiers, so a change to an `$events` clause again shows its
snapshot diff in its own pull request.
@leaf-agent leaf-agent changed the title Move 50 tests over their tier's time budget in two daily runs to daily journeys Move 45 over-budget tests to daily journeys, and stop five waiting out an unanswered title completion Nov 22, 2026
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The revised teardown scans pending requests once before stopping servers or joining title workers. A name_thread worker can pause before completions.ask creates its request, resume after that scan, then wait the full inference timeout because teardown never answers the new request. Please make the test harness answer at the completion boundary or keep answering through worker retirement. A focused regression can hold a worker just before request creation until teardown begins.

This was written by Codex on behalf of max-sixty

…rker ends

Teardown answered the pending completions once, before stopping servers. A title
worker that reached `completions.ask` after that scan waited the whole
`inference.TIMEOUT` for a hooks module no test runs. Teardown now answers the
sessions' pending completions between each poll of the join, until every title
worker has ended.

A regression test holds the real Claude Code generator just before it writes its
request and releases it once teardown joins the worker; it records the "test
ended" answer rather than the 60 s timeout.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in ac9973f: retire_test_services now collects the session ids up front and keeps answering their pending completions while it joins title workers. Between join polls it answers again, until every worker has ended or STATED_TIMEOUT passes, so a request written after the first scan still gets the failed reply.

The new test_test_teardown_answers_a_title_completion_asked_while_it_retires holds the real Claude Code title generator just before completions.ask writes its request, and releases it once teardown joins the worker. Against the previous teardown it waited the full 60 s and the worker logged the Claude Code session replied to no completion within 60 s. With the fix it gets the test ended reply and passes in about 2 s. The existing join test, tests/model/test_thread_titles.py and three of the five kept tests also pass locally.

leaf-agent added a commit that referenced this pull request Nov 22, 2026
This week's duplicate sweep of `dev/`, `build/`, `tests/` and `worker/`
(week 47) moves six duplicated helpers onto one home each and moves
every caller. Behavior stays the same. The touched model tests, the dev
js_facts tests and the Worker's routing, storage and index tests pass. A
script compared the old and new outputs of the consolidated `leaf_dev`
functions and the seeded-log reads across the corpus, and they match.

| Question | Home | Copies removed (introducing PR) |
|---|---|---|
| Which stylesheets do the core and the bundled packages ship, leaving
out vendored files? | new `interact_support.shipped_sheets` | `sheets()`
in `test_interface_fonts.py` (#4804) and `test_theme_tokens.py` (#6025).
Five inline loops in `test_interact_layer.py` (#3138, #3886) |
| Run `tests/js_facts.mjs` | `interact_support.js_facts` (#2666) | its
own subprocess call in `dev/tests/test_js_facts.py` (#5118) |
| Lowercase hex of bytes in the Worker | `routing.hex`, which is
`newSessionId` (#313) renamed, plus a `sha256Hex` in `storage.ts` | the
publication-identity and chunk-digest copies in `storage.ts` (#2652) |
| Is this pid alive? | `leaf.machine.pid_alive` | `_alive` in
`tests/process/test_codex_tool.py` (#3331). `running()` in
`test_interact_layer.py` (#1774) |
| Read an example's seeded log | `read_event_lines(seed_log(source))`
(#4484) | inline parsers in `test_render_pages.py`,
`test_interact_product.py` (#924) and `test_render_gate.py` (#509). The
last one split lines with `splitlines()`, which also breaks at U+2028 |
| Paths of the bundled registries and packages; which registry keys name
elements | `leaf.schema.ASSETS` / `BUNDLED_PACKAGES` /
`DEFAULT_PACKAGE`, `leaf.registry.contract.is_element_name`,
`docs.registries()` | `docs.py`'s own `ASSETS`/`PACKAGES` (#3593) and
its `startswith("lf-")` checks (#2660). `logs usage`'s hand-written
regex and registry list (#5970). `ROOT / "packages" / "default"` in
`stills.py` (#3927) and `test_product_page.py` (#3593) |

`is_element_name` and the two checks it replaces give the same answer
for every key in the bundled registries today. A selector key such as
`lf-options.selected` would have passed the `lf-` prefix test.

<details><summary>Sets found and left alone</summary>

- **Sets an open PR is changing.** Nothing in this diff overlaps another
open PR's hunks. #6732 moves tests out of `test_render_gate.py`,
`test_render_pages.py` and `test_interact_layer.py`, but none of the
tests changed here.
- **Changes to browser tests with nothing run to check them.** The WCAG
contrast computation exists as about 11 copies across browser, journey
and model tests. Other copies: about 9 `EDITOR_ROOTS` shadow-root
keepers, the `/api/interaction` batch predicates, CDP `touch()`
closures, one-line patch templates, reply-holding route handlers, and
the `data-lf-entry` runtime-module import snippet in
`dev/leaf_dev/states.py` and in tests. Each would mean editing browser
tests that this sweep can't run on a shared host. They suit a sweep that
can run those tests.
- **Vendor bundling.** `build/browser/build.mjs` builds signals-core and
Lit with esbuild calls that repeat `build/vendor.mjs`'s `bundle()`.
Merging them changes build options and needs a full `check:browser` byte
comparison, so it was left for a change that runs that.
- **Copies that are near but not the same.** `_build.py`'s `check_links`
repeats `leaf_website.released_path`, but it also needs the matched
page's root and kind. The list of API-key variables an eval drops is
repeated across Python and the Promptfoo configs, as subsets and
supersets of one another. The Codex token-expiry check has different
thresholds, 1 h and 60 s.
- **Too small to be worth it.** Picking a free loopback port
(`eval_user.py`, `interact_support.available_loopback_port`). The XDG
state root in `leaf_dev.state_home` and `leaf.state.state_home`. The
`settled` helper in two `tests/runtime` files.

</details>

Co-authored-by: leaf-agent <[email protected]>
@leaf-agent
leaf-agent merged commit 2dc9d77 into main Nov 22, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the tests-over-budget-journeys branch November 22, 2026 10:19
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