Skip to content

Isolate automation previews from task delivery - #295

Merged
max-sixty merged 5 commits into
mainfrom
codex/isolate-preview-delivery
Sep 5, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/isolate-preview-delivery

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Browser automation needs Leaf's real HTTP and event-log boundary without turning its gestures into feedback for the current task. This change makes that process-owned lifetime a shared runtime primitive instead of test-only server wiring.

  • Add TemporaryPageServer and use it from browser fixtures, exact-version render previews, and leaf server run --temporary.
  • Add scripts/preview.py --automation to the existing live-reloading preview watcher. It preserves the page and URL across source/runtime reloads but creates no claim or durable service.json.
  • Keep automation and reader previews in distinct interaction slots, expose that interaction in preview diagnostics, and refuse mode reuse that could leak automation events into task delivery.

Verification

  • uv run pre-commit run --all-files
  • uv run pytest tests — 863 passed
  • uv run pytest tests/test_render_export.py --run-nightly -k preview_watches_runtime_and_source_without_losing_reader_state — 3 consecutive passes

This was written by Codex on behalf of max-sixty

Reuse one process-owned page server across the browser harness, render gates, and live automation previews while leaving standing reader services durable. Match Codex delivery retries by stable event identity so recreated preview paths cannot suppress new events.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two things, both about what the PR says rather than what the code does — I traced the server lifetime, the watcher control flow, and the mode-reuse refusals and they hold together. TemporaryPageServer.close() is also a quiet improvement on what it replaces: every ephemeral server in the old code called shutdown() without server_close(), so each one leaked its listening socket.

Three files of unrelated work ride in the merge commit. skills/leaf/packages/default/theme.css, skills/leaf/packages/default/widgets/lf-options-addition.js, and tests/test_render_options_addition.py differ from both parents of 3100c05f — they exist in neither b061c49d nor 56c5663c, so they were authored inside "Merge main into codex/isolate-preview-delivery". Reproduce with comm -23 over git diff --name-only 56c5663c 3100c05f and the branch commit's own file list. The change itself is a user-visible one: the Add button in lf-another now disappears (visibility: hidden via data-lf-empty) while the field is empty, and #sync() pulls focus back to the input when the button it was on goes away. Nothing in the title, the body, or b061c49d's message mentions it, and git log --no-merges — the ordinary way to read a branch's own work — doesn't show it. Root CLAUDE.md asks for "the smallest artifact that proves it… One sentence and an lf-shot before/after is the usual artifact for a static change"; there's neither. I'd move those three files to their own PR with that artifact, or at minimum say in the body what changed and why.

The README now points a human at the mode built to keep their gestures out of delivery. The sentence two lines above still promotes scripts/preview.py triage-board as the preview "with the real agent loop behind it, preserving reader feedback across edits", and this PR's own skill text says to "use the reader preview's distinct page when presenting a URL for feedback". An --automation page takes no claim, so a reader who follows the README to look at the feature gallery and leaves a comment has it sit in .tmp/previews/feature-gallery-automation/events.jsonl with nothing watching. The edit also drops the fact the old sentence carried — that the gallery is a developer playground kept out of the public catalog — and replaces it with a statement about the server instead. --automation is already documented where its readers are: scripts/CLAUDE.md, developing-with-leaf, and ui-sweep.

Comment thread README.md Resolved
@max-sixty
max-sixty merged commit 1cc4dba into main Sep 5, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/isolate-preview-delivery branch September 5, 2026 06:41
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