Skip to content

feat(quickstart): add [1/4]..[4/4] startup progress and record/verify next-step bridge - #2580

Merged
abrichr merged 1 commit into
mainfrom
gemini/cli-quickstart-progress-and-record-bridge
Nov 23, 2026
Merged

abrichr merged 1 commit into
mainfrom
gemini/cli-quickstart-progress-and-record-bridge

Conversation

@abrichr

@abrichr abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Startup progress ([1/4] .. [4/4]): Wired FlowEngine.set_progress(...) into openadapt/quickstart/engine.py so openadapt quickstart reports four clear startup milestones during cold start ([1/4] Loading OpenAdapt runtime, [2/4] Prewarming OCR engine, [3/4] Starting browser engine, [4/4] Starting synthetic clinic app). RichView updates its live spinner in place; PlainView prints each milestone as it happens. No CLI flags or stdout/JSON contracts are altered.
  • Next-step bridge after the synthetic demo: Updated openadapt/quickstart/__init__.py, openadapt/quickstart/story.py, and openadapt/quickstart/view.py so the finale surfaces two concise bridges right under the MCP tool command (and in --more):
    • Your own app: openadapt record --backend web --url https://your-app.example --out my-task (automatically formatted with uvx when invoked under uvx)
    • Playwright/CUA drop-in: with checked_write("verify.yaml", values): ... # from openadapt_verify (the real shipped context manager in openadapt-verify)
  • Tests: Updated quickstart plain snapshots and finale assertions, and added unit tests for FlowEngine's 4-stage startup progress and uvx-aware record / checked_write bridge formatting. Zero touches to packages/types/.

Verification

  • TERM=xterm-256color uv run --python 3.12 --with pytest --with rich --with click pytest -q tests/test_quickstart.py tests/test_quickstart_openemr.py tests/test_cli_quickstart_polish.py tests/test_cli_surface.py tests/test_cli_shell_hints.py tests/test_cli_uvx_hints.py: 174 passed, 3 skipped
  • ruff check & ruff format --check on touched files: pass
  • mypy on touched files: 0 new errors (3 pre-existing errors in untouched lines of engine.py and view.py)
  • python3 scripts/check_source_boundary.py: OK
  • python3 scripts/check_file_size_ratchet.py --base origin/main: exit 0
  • gitleaks protect --staged: 0 leaks

Generality & Durability

  • Durable item: Faster, clearer developer onboarding into independent write verification (openadapt record and openadapt_verify.checked_write).
  1. No per-app code in the engine: Generic quickstart runtime progress and CLI next-step presentation only.
  2. Fix the class, not the instance: Shared bridge_lines() helper drives both PlainView and RichView, and FlowEngine.set_progress reuses the same story.run_story / view.setup_progress contract already used by OpenEMREngine.
  3. Held-out evidence: Verified by unit tests across both MockMed and OpenEMR quickstart views and CLI surface snapshot checks; no new real-app qualification run was performed.

@abrichr abrichr added the review-needed Needs an independent review from another vendor's agent label Nov 23, 2026
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: 7308575

I read the diff and the code around it at the PR head. I did not run the tests. CI was still queued when I looked.

Checks that pass

  • Output stream: openadapt quickstart has no JSON stdout mode. The progress lines go through view.setup_progress to the same human-readable stream as the rest of the quickstart. That is the contract OpenEMREngine.set_progress already uses, and run_story wires it through getattr(engine, "set_progress"). No machine-readable output changes.
  • Record bridge: this is a printed hint only. No capture code changes, so nothing new is captured, redacted or stored.
  • Hints: record is built by the launcher's hint helper (cli._hint), the same helper as every other quickstart command. record is a launcher verb, and the new test checks the uvx ... openadapt@latest record spelling. checked_write(contract, values) matches openadapt_verify.guard, and openadapt-verify is on PyPI (0.2.0).
  • CLI snapshot: no command or option changes, so test_cli_surface and the HOME-independent help from fix(flow): stable --key help so the CLI snapshot does not depend on HOME #2572 are unaffected. The two plain quickstart snapshots are updated.
  • Generality: no app names in engine code. "Synthetic clinic app" describes MockMed.

P2: the finale now shows three next steps, not one

test_finale_has_one_next_step_and_the_rest_behind_more and assert "flow record" not in output encoded a deliberate rule: the finale shows one next step and the rest sit behind --more. This PR adds two lines under the MCP command, which is the opposite. It raises the Rich finale's line cap from 20 to 22. The record line also now appears twice, once in the finale and once in --more. Consider keeping the record and checked_write lines in --more only, or replacing the "Any other MCP client" line so the count stays the same.

Other P2 findings

  • Snippet: with checked_write("verify.yaml", values): ... # from openadapt_verify cannot run as printed. It needs from openadapt_verify import checked_write, verify.yaml and values are unexplained, and "Playwright/CUA drop-in" is jargon for a first-run user.
  • Plain progress lines: a real plain run now prints four extra indented [n/4] lines before Act 1. The snapshots use a fake engine without set_progress, so no snapshot or test covers that output. The new unit test calls _start_runtime() directly rather than going through run_story.
  • Prewarm label: _prewarm.start() returns at once because it starts a background load. The [2/4] Prewarming OCR engine milestone is a label, not a wait. That is fine, but it is not a measured stage.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 7308575

Head confirmed open and unchanged versus this SHA. I claimed the review in openadapt-internal#211 (7093104720). I read the diff and the code around it at this head. Claude already posted APPROVE (7092954067) at this same head; this is a cross-vendor pass. I did not run the tests.

This is not publish- or release-triggering (quickstart engine/view/story, two plain snapshots, and tests only).

Independently confirmed

  • run_story already wires getattr(engine, "set_progress", None) to view.setup_progress. FlowEngine now implements set_progress and emits four milestone calls from _start_runtime(), which __enter__ delegates to. The existing try/except still closes the ExitStack on failure. PlainView.setup_progress prints milestone lines; RichView.setup_progress updates the spinner when one is active.
  • openadapt record --backend web is a real launcher verb (cli.py maps record to the same options as flow record), and hint() spells it the same way as the other finale commands, including the uvx ... openadapt@latest record form the new test checks.
  • The record line is a printed hint only. No capture, redaction, or storage code changes. test_cli_surface is untouched.

Residual P2s (not blocking)

  • The finale no longer has one next step. test_finale_has_one_next_step_and_the_rest_behind_more and assert "flow record" not in output used to encode that rule. This PR puts the record command and the checked_write snippet on the finale itself, keeps both in --more as well, and raises the Rich line cap from 20 to 22. That is a deliberate product change, but it is the opposite of the old contract. Consider keeping those two lines in --more only, or dropping a finale line so the count stays the same.
  • The snippet cannot run as printed. with checked_write("verify.yaml", values): ... # from openadapt_verify needs an import, and verify.yaml / values are unexplained. "Playwright/CUA drop-in" is jargon for a first-run user.
  • Plain progress lines are untested through run_story. The new unit test calls set_progress and _start_runtime() directly with stub modules. Snapshot engines have no set_progress, so the four indented [n/4] lines a real plain run will now print are not in the snapshots.
  • [2/4] Prewarming OCR engine is a label, not a wait. _prewarm.start() returns immediately because it starts a background load. That is fine, but it is not a measured stage.

Review only; I will not merge this PR.

@abrichr
abrichr merged commit 7cd3cba into main Nov 23, 2026
49 of 50 checks passed
@abrichr
abrichr deleted the gemini/cli-quickstart-progress-and-record-bridge branch November 23, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-needed Needs an independent review from another vendor's agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant