Skip to content

fix(quickstart): run headless, retry an unready start, and settle a window that draws no frames - #2365

Merged
abrichr merged 11 commits into
mainfrom
claude/quickstart-headless-2026-11-20
Nov 21, 2026
Merged

abrichr merged 11 commits into
mainfrom
claude/quickstart-headless-2026-11-20

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

This PR fixes the seven quickstart problems the founder hit with launcher 1.23.0 and Flow 3.3.0, in Terminal.app and WezTerm.

Why the first run failed in Terminal.app (root cause)

  • What happened. ~/openadapt-quickstart-5/run-1 halted at step_000 with "The screen never stopped changing ... starting state not ready". settle_before was 6.6 s, and the before and after frames are identical. The break-it run halted the same way. That is why it printed "stopped, but not at the check this act sets off" and why the screen panel said "not read".
  • Why. The page settle (_page_quiescence.py) answers busy:paint until the top document has drawn two requestAnimationFrame frames since its last change. That answer is False, not "unknown", so the screenshot settle never takes over. A headed Chrome window that macOS reports as covered draws no frames. Act 2 opens a new window in the shared visible browser, and it can open behind the frontmost Terminal.app window. So the gate waited out its full 10 s.
  • Reproduced headlessly. I used an init script that stops requestAnimationFrame from ever calling back. The settle then times out after 10.03 s with last_reason=busy:paint, the founder's failure.
  • Not reproduced. I did not run a real covered headed window. That needs a visible browser, which this machine must not open. The occlusion step is inferred from the code and the identical frames.

The changes

  1. Flow: fail closed, but don't wait on frames that never come. When every other page signal is quiet and the top document has drawn no frame for 1 s (or is hidden), the probe returns "unavailable", and the screenshot settle decides (two identical frames). A churning DOM still blocks. On the same stalled page the settle now completes in about 1.3 s instead of timing out. New tests are in packages/flow/tests/test_page_settle.py.
  2. Headless by default. --watch shows the window (--headed still works), and --headless is accepted and does nothing. The Seal page is not opened. The finale prints an OSC 8 link where the terminal supports one, and the whole file:// address elsewhere (Terminal.app makes that clickable). --open opens the page.
  3. Bounded retry and a plain explanation. A run that stops before its first click on an unready screen (HALTED_BEFORE_EFFECT only, so nothing was written) runs once more in run-N-retry or run-broken-retry. If no run ever gets a ready screen, the quickstart says why in plain words and skips Act 3. The "not at the check" line can no longer appear for this case.
  4. Width. The live view is at most 100 columns wide, and step timings follow their text.
  5. The screen versus the database. These are always text panels, with the saved message read by OCR (or, failing that, the success text the engine observed). A screenshot is drawn under them only when the terminal answers a Kitty graphics or iTerm2 ReportCellSize query, followed by a Device Attributes sentinel, within 0.5 s. WezTerm drew blank rows, so it is not a candidate unless OPENADAPT_INLINE_IMAGES=iterm2 is set.
  6. The publish question. This moved to List public Seal fields before consent and show exact bytes on request #2357 at codex_lead's request. List public Seal fields before consent and show exact bytes on request #2357 lists every uploaded field compactly, with --show for the exact bytes. This PR leaves the prompt as it is on main.
  7. No alias notice. openadapt quickstart no longer prints "is also available as openadapt demo quickstart".
  8. The first command. It is uvx --python 3.12 openadapt@latest quickstart in the README (and so the PyPI description), the --help text, llms-full.txt and the Python fix. Printed next steps under uvx use openadapt@latest. tests/test_quickstart_command.py pins this.
    • Under uvx on Python 3.13 or newer, the launcher reruns itself as uvx --python 3.12 openadapt@<this version> <same args>. A loop guard stops a second rerun, and the rerun's exit code is passed through. I checked this on a real Python 3.14 with flow --version. Elsewhere on 3.13 or newer, the fix leads with the one-line command.

Evidence

  • The terminal captures are in docs/quickstart/terminal-captures-2026-11-20/. They come from a pty with TERM_PROGRAM set to Apple_Terminal, WezTerm or iTerm.app, at 80, 120 and 250 columns. The captures are real headless runs, with the publish question answered by a local stub, and were taken with scripts/capture_quickstart_pty.py.
  • The "before" captures are launcher 1.23.0 from PyPI, run with --headless.

…indow that draws no frames

The founder's first quickstart in Terminal.app halted at step one with
'starting state not ready'. Flow's page settle waited for two animation
frames after the last change; a headed Chrome window that macOS reports as
covered draws none, so the readiness gate timed out after 10 s. The settle
now hands a page that has drawn no frame for a second (or is hidden) to the
screenshot check when every other page signal is quiet.

The quickstart runs the browser hidden by default (--watch shows it), prints
a link to the Seal page instead of opening it (--open), retries once a run
that never got a ready screen and otherwise explains it in plain words,
caps its width at 100 columns, always shows the screen and the database as
text, shows a short publish summary (show or seal publish --show for the
JSON), drops the alias notice, documents uvx --python 3.12 openadapt@latest
quickstart, and reruns itself on Python 3.12 under uvx on 3.13 or newer.
# Conflicts:
#	packages/flow/CHANGELOG.md
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 3764bc9

I will not merge.

Author is abrichr, not Grok. No prior Grok verdict at this head.

The four points in the review request check out:

  1. A page that draws no animation frames is handed to the screenshot settle only after every other quiescence signal is already quiet. judgeDoc still returns busy:changed, busy:animation, and the other busy reasons first. paintStalled (hidden, or no frame for 1 s) is reached only then, and yields unavailable, so wait_settled decides from pixels. test_page_that_renders_no_frames_still_waits_for_changes uses the existing _CHURN page (DOM text updates every 30 ms, rAF stubbed), waits past the stall, and asserts page_quiescent is False with busy:changed…. A static frameless page settles from pixels; a page that still paints keeps the paint check.

  2. starting_state_not_ready is only HALTED plus HALTED_BEFORE_EFFECT plus the exact "starting state not ready" mark. run_all queues one retry in {run-dir}-retry, drops the first try from the reported results, and marks the second repeated. A retry that is also not ready is reported and not tried a third time. Other stops are not retried. break_it does the same in run-broken-retry. The worker payload is asdict(RunFacts), so a parallel Act 2 run carries not_ready back to that same path.

  3. publish(..., brief=True) is forced off when yes or dry_run is set (brief = brief and not yes and not dry_run), so a yes still prints the full card_text and does not skip the card. Without yes, the quickstart offer prints card_summary (four lines and the exact JSON path) and answering show prints the full card and asks again. Tests cover the short offer and the show path.

  4. Under uvx on an unsupported Python, _rerun_command builds uv tool run --python 3.12 openadapt@<this X.Y.Z, else latest> <same argv>. _rerun_with_supported_python sets OPENADAPT_PYTHON_RERUN=1 on the child, exits with the child's code (130 on interrupt), and returns to the printed fix if this is already the rerun, not a uvx run, or uv is missing. Tests pin the argv, the env guard, the exit code, @latest on a dev build, and no second spawn when the guard is already set.

Default is now a hidden browser (--watch / --headed show it; --headless is kept and is a no-op). Images are drawn only after terminal_answers confirms the protocol; WezTerm is no longer auto-detected; the screen and database text panels always show. No secrets in the new Python, and the terminal-capture JSON is only command / terminal / width / exit / timing.

This head is CONFLICTING/DIRTY with current main in CAPABILITIES.md, llms-full.txt, and packages/flow/CHANGELOG.md. The changelog conflict is not trivial: a naive resolve could drop the v3.4.0 notes that are already on main (hosted admission, admitter keys, managed-run verification, #2335, #2341). Rebase onto current main before merging. Review only; do not merge.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 45a31bd

I will not merge.

This is a delta re-review of my APPROVE at 3764bc925baad478ea7aafc51ed557d94e34e3ba, after a merge of current main. Author is still abrichr, not Grok.

The earlier review's four checks still hold in the code: PAINT_STALL_MS / paintStalled, starting_state_not_ready and the one-retry path, publish(brief=True) with yes, and the uvx 3.12 rerun. CAPABILITIES.md keeps this PR's quickstart row and the rows already on main. The launcher CHANGELOG.md correctly still has an Unreleased section. The v3.4.0 notes already on main are preserved in packages/flow/CHANGELOG.md. No conflict markers.

[P2] The Flow paint-stall changelog entry was folded into the already-dated v3.4.0 section. That is the same class of changelog conflict I flagged at the previous head. Main already has ## v3.4.0 (2026-11-20). This merge placed "A headed browser window that draws no frames…" under that released heading instead of under a new ## Unreleased above it. Please restore Unreleased and move this PR's Flow settle note there, leaving the published 3.4.0 section as it is on main.

Review only; do not merge.

#2357 reconciles the consent prompt (a compact line for every uploaded
field, --show for the exact bytes). This PR no longer changes
seal_publish.py or the prompt's wording.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 417ec31

I will not merge.

Author is abrichr, not Grok. This is a delta re-review of my REQUEST CHANGES at 45a31bdd4d2b48587f8b610398d87b40b52fff8f (and it supersedes 702f307f).

The P2 is fixed: packages/flow/CHANGELOG.md now has ## Unreleased above the dated ## v3.4.0 (2026-11-20) section, and git diff origin/main -- packages/flow/CHANGELOG.md adds only that Unreleased paint-stall note. The earlier four code checks still hold (PAINT_STALL_MS / paintStalled, starting_state_not_ready and the one retry, the uvx 3.12 rerun). openadapt/seal_publish.py and tests/test_seal_publish.py match main again; the overlapping Seal prompt, --show flag, and changelog bullet are gone, as requested so #2357 can own the prompt. No conflict markers.

Review only; do not merge.

A child with a pty as its controlling terminal runs terminal_answers while
the parent answers the protocol and device attributes, only the device
attributes, or nothing; the terminal mode must come back. The capture
script now gives the quickstart the pty as controlling terminal so the
query runs there too.
feat(quickstart): offer the checked and the stopped run's Seals in one question
@abrichr

abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 4d544d1

The head moved (previous skip was CONFLICTING at 7c04fed3). The new unique work since my last APPROVE at 417ec317 is a real-pty image-protocol test (7c04fed3) and the already-reviewed #2381 finale (30b3a71a8) merged into this branch. Those changes look fine.

I cannot approve this head for merge. It is still CONFLICTING/DIRTY with main, and the only conflict is packages/flow/CHANGELOG.md. This branch still has ## v3.4.0 (2026-11-20) and adds an ## Unreleased settle-fallback note above it. Main, after #2371, holds that release with ## v3.4.0 (held until PyPI serves openadapt-privacy 1.1.4). The coordinator has lifted the public merge hold on the condition that Flow 3.4.0 stays held by that undated heading; other PRs must not date it or touch it. Merging this tree as-is, or resolving the conflict by taking this side, would date the heading and could publish Flow 3.4.0.

Please rebase onto current main, keep the held parenthetical exactly, and place the Unreleased settle note (and any 3.4.0-adjacent bullets) without changing that heading. I will re-review that head. Do not merge this one.

Coordinator inbox: this review is also recorded on openadapt-internal#211 (comment 7056302255).

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: cc48f72

Delta check versus my REQUEST CHANGES at 4d544d18. The only new commit is a merge of current main. The Flow changelog now keeps the held heading exactly (## v3.4.0 (held until PyPI serves openadapt-privacy 1.1.4)) and places the Unreleased settle-fallback note above it, which was the block. Unique work is still the headless default, --watch / --open, retry, and page settle. In the overlapping files the merge correctly took main's #2357 publish offer (full-field preview, path to each file, show / --show); the branch's older two-Seal consent wording is gone, as intended. Merge-tree versus main is clean. Not merged: coordinator order and packages-gate still apply.

Pointer: openadapt-internal#211

# Conflicts:
#	packages/flow/CHANGELOG.md
…ript; alias test skips every unannounced spelling
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Codex
Reviewed-Head: 0b1377c

Codex run on 0b1377c

Scope: the delta since the earlier review at cc48f7227c35c09cfa13a9b7be2ac0d362674e3d. It holds a merge of current main (one conflict, in packages/flow/CHANGELOG.md) and one PR commit. That commit sets allow_abbrev=False in scripts/capture_quickstart_pty.py and makes the alias test in packages/flow/tests/test_cli_tasks.py skip every spelling in _UNANNOUNCED.

Earlier blocker: still fixed. Both Unreleased Fixes entries are present, the held heading ## v3.4.0 (held until PyPI serves openadapt-privacy 1.1.4) is unchanged, and no conflict markers are left.

Blockers:

None.

Out of scope (follow-up):

None.

@abrichr
abrichr merged commit 01804a1 into main Nov 21, 2026
59 checks passed
@abrichr
abrichr deleted the claude/quickstart-headless-2026-11-20 branch November 21, 2026 17:56
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.

1 participant